Update: window closing keybind

This commit is contained in:
hyzen
2026-07-02 14:22:45 +05:30
parent 1beb8fb948
commit 187e1baf2f
2 changed files with 12 additions and 4 deletions

View File

@@ -53,8 +53,13 @@ require('lazy').setup({
'folke/which-key.nvim', 'folke/which-key.nvim',
event = 'VeryLazy', event = 'VeryLazy',
opts = { opts = {
sort = { 'manual', 'group', 'mod' },
spec = { spec = {
{ '<leader>q', group = 'Quit' }, { '<leader>q', group = 'q' },
{ '<leader>qq', desc = 'Close' },
{ '<leader>qy', desc = 'Save & close' },
{ '<leader>qn', desc = 'Discard changes & close' },
{ '<leader>qa', desc = 'Quit Neovim' },
}, },
}, },
config = function(_, opts) config = function(_, opts)

View File

@@ -447,13 +447,16 @@ end
-- Keymaps -- Keymaps
vim.keymap.set('n', '<leader>q', function() vim.keymap.set('n', '<leader>q', function()
close_window() close_window()
end, { desc = 'Close window' }) end, { desc = 'Close' })
vim.keymap.set('n', '<leader>qq', function()
close_window()
end, { desc = 'Close' })
vim.keymap.set('n', '<leader>qy', function() vim.keymap.set('n', '<leader>qy', function()
close_window 'save' close_window 'save'
end, { desc = 'Save & quit current window' }) end, { desc = 'Save & close' })
vim.keymap.set('n', '<leader>qn', function() vim.keymap.set('n', '<leader>qn', function()
close_window 'discard' close_window 'discard'
end, { desc = 'Discard changes in current window & quit' }) end, { desc = 'Discard changes & close' })
-- [[ Close Neovim ]] -- [[ Close Neovim ]]
-- Function to close Neovim, discarding all unsaved changes if confirmed -- Function to close Neovim, discarding all unsaved changes if confirmed