From 7066045d6e5612d440b3a922edc5a66aae60fee8 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Wed, 3 Jul 2024 14:04:18 +0300 Subject: [PATCH] Nvim: add keybind to close other buffers --- home/.config/nvim/lua/plugins/which-key.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/home/.config/nvim/lua/plugins/which-key.lua b/home/.config/nvim/lua/plugins/which-key.lua index 0a65beac..616cca0d 100644 --- a/home/.config/nvim/lua/plugins/which-key.lua +++ b/home/.config/nvim/lua/plugins/which-key.lua @@ -11,6 +11,10 @@ local function toggle_theme() end end +local function close_other_buffers() + vim.cmd('silent! execute "%bd|e#|bd#"') +end + --- @type LazyPluginSpec return { "folke/which-key.nvim", @@ -21,6 +25,7 @@ return { wk.register({ h = { "nohlsearch", "Turn off search highlight" }, b = { toggle_theme, "Toggle background between dark and light" }, + co = { close_other_buffers, "Close other buffers" }, }, { prefix = "" }) wk.register({