diff --git a/nvim/lua/plugins/menu.lua b/nvim/lua/plugins/menu.lua index 91391f8..d1c2625 100644 --- a/nvim/lua/plugins/menu.lua +++ b/nvim/lua/plugins/menu.lua @@ -459,6 +459,32 @@ function get_git_menu() } end +local quit_only_ft = { + 'help', + 'Outline', + 'trouble', + 'toggleterm', + 'man', +} + +function add_close_quit_menuitem(tbl) + if table.getn(tbl) > 0 then + table.insert(tbl, { name = 'separator' }) + end + if not helper.contains(quit_only_ft, vim.bo.ft) then + table.insert(tbl, { + name = ' Close Buffer', + cmd = 'BufferClose', + rtxt = 'bd', + }) + end + table.insert(tbl, { + name = ' Quit Window', + cmd = 'q', + rtxt = 'q', + }) +end + return { { 'nvchad/volt', @@ -466,9 +492,12 @@ return { 'nvchad/menu', config = function() local ignore_ft = { - 'help', - 'Outline', - 'trouble', + 'dapui_scopes', + 'dapui_breakpoints', + 'dapui_stacks', + 'dapui_watches', + 'dap-repl', + 'dapui_console', } vim.keymap.set('n', '', function() if not helper.contains(ignore_ft, vim.bo.ft) then @@ -476,8 +505,12 @@ return { local menu if vim.bo.ft == 'NvimTree' then menu = get_nvim_tree_menu() + elseif helper.contains(quit_only_ft, vim.bo.ft) then + menu = {} + add_close_quit_menuitem(menu) else menu = get_default_menu() + add_close_quit_menuitem(menu) end require('menu').open(menu, { mouse = true }) end