Fix: <leader>qa global keymap implementation in alpha window button.

This commit is contained in:
psychhim
2025-10-14 18:40:10 +05:30
parent 1dd8c87ec4
commit 036a8d766c
3 changed files with 11 additions and 11 deletions

View File

@@ -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`

View File

@@ -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', '<leader>qa', close_nvim_with_prompt, { noremap = true, silent = true, desc = 'Quit Neovim' })
vim.keymap.set('n', '<leader>qa', _G.close_nvim_with_prompt, { noremap = true, silent = true, desc = 'Quit Neovim' })
-- [[ Switch below/right split windows ]]
vim.keymap.set('n', '<leader><Tab>', '<C-W><C-W>')

View File

@@ -18,8 +18,8 @@ return {
dashboard.button('i', ' New File', '<Cmd>ene <Bar> startinsert<CR>'),
-- Open Neo-tree in starting directory
dashboard.button('<leader>n', ' Open Neo-tree', '<Cmd>cd ' .. vim.fn.fnameescape(start_dir) .. ' | Neotree toggle float<CR>'),
-- Quit Neovim
dashboard.button('<leader>qa', ' Quit', '<Cmd>qa<CR>'),
-- Quit Neovim using custom function
dashboard.button('<leader>qa', ' Quit', '<Cmd>lua close_nvim_with_prompt()<CR>'),
}
alpha.setup(dashboard.opts)