From 187e1baf2f2c70a11fd3c68a7fccb7748011646c Mon Sep 17 00:00:00 2001 From: hyzen Date: Thu, 2 Jul 2026 14:22:45 +0530 Subject: [PATCH] Update: window closing keybind --- init.lua | 7 ++++++- lua/keymaps.lua | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 8807daa..939f6c6 100644 --- a/init.lua +++ b/init.lua @@ -53,8 +53,13 @@ require('lazy').setup({ 'folke/which-key.nvim', event = 'VeryLazy', opts = { + sort = { 'manual', 'group', 'mod' }, spec = { - { 'q', group = 'Quit' }, + { 'q', group = 'q' }, + { 'qq', desc = 'Close' }, + { 'qy', desc = 'Save & close' }, + { 'qn', desc = 'Discard changes & close' }, + { 'qa', desc = 'Quit Neovim' }, }, }, config = function(_, opts) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index f8a9f5b..2b4b89d 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -447,13 +447,16 @@ end -- Keymaps vim.keymap.set('n', 'q', function() close_window() -end, { desc = 'Close window' }) +end, { desc = 'Close' }) +vim.keymap.set('n', 'qq', function() + close_window() +end, { desc = 'Close' }) vim.keymap.set('n', 'qy', function() close_window 'save' -end, { desc = 'Save & quit current window' }) +end, { desc = 'Save & close' }) vim.keymap.set('n', 'qn', function() close_window 'discard' -end, { desc = 'Discard changes in current window & quit' }) +end, { desc = 'Discard changes & close' }) -- [[ Close Neovim ]] -- Function to close Neovim, discarding all unsaved changes if confirmed