From 036a8d766cee919a656f744957a18c3735fddd8d Mon Sep 17 00:00:00 2001 From: psychhim Date: Tue, 14 Oct 2025 18:40:10 +0530 Subject: [PATCH] Fix: qa global keymap implementation in alpha window button. --- init.lua | 12 ++++++------ lua/keymaps.lua | 6 +++--- lua/plugins/custom/alpha.lua | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/init.lua b/init.lua index 0903a54..f0201c8 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,12 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +-- keymaps.lua +require 'keymaps' + +-- Copy custom snippets from custom_friendly_snippets folder +require 'replace_with_custom_snippets' + -- :UpdateKickestEnd command to safely update KickestEnd.nvim config from origin/master require 'update_kickestend' @@ -274,12 +280,6 @@ require('lazy').setup({ { import = 'plugins.custom' }, }, {}) --- custom/keymaps.lua file -require 'keymaps' - --- Copy custom snippets from custom_friendly_snippets folder -require 'replace_with_custom_snippets' - -- [[ Setting options ]] -- See `:help vim.o` diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 52bf584..4dddc66 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -310,7 +310,7 @@ end, { desc = 'Discard changes in current window & quit' }) -- [[ Close Neovim ]] -- Function to close Neovim, discarding all unsaved changes if confirmed -local function close_nvim_with_prompt() +_G.close_nvim_with_prompt = function() -- Get list of all listed buffers local buffers = vim.fn.getbufinfo { buflisted = 1 } -- Check for unsaved buffers @@ -332,10 +332,10 @@ local function close_nvim_with_prompt() vim.cmd 'qa!' else -- Cancel quitting - print 'Cancelled closing Neovim.' + print '\nCancelled closing Neovim.' end end -vim.keymap.set('n', 'qa', close_nvim_with_prompt, { noremap = true, silent = true, desc = 'Quit Neovim' }) +vim.keymap.set('n', 'qa', _G.close_nvim_with_prompt, { noremap = true, silent = true, desc = 'Quit Neovim' }) -- [[ Switch below/right split windows ]] vim.keymap.set('n', '', '') diff --git a/lua/plugins/custom/alpha.lua b/lua/plugins/custom/alpha.lua index 00015f4..bade2a1 100644 --- a/lua/plugins/custom/alpha.lua +++ b/lua/plugins/custom/alpha.lua @@ -18,8 +18,8 @@ return { dashboard.button('i', ' New File', 'ene startinsert'), -- Open Neo-tree in starting directory dashboard.button('n', ' Open Neo-tree', 'cd ' .. vim.fn.fnameescape(start_dir) .. ' | Neotree toggle float'), - -- Quit Neovim - dashboard.button('qa', ' Quit', 'qa'), + -- Quit Neovim using custom function + dashboard.button('qa', ' Quit', 'lua close_nvim_with_prompt()'), } alpha.setup(dashboard.opts)