add quit/close to most menus. more ignore filetype menu filtering
This commit is contained in:
parent
c4547c7dec
commit
a06e2d805c
|
@ -459,6 +459,32 @@ function get_git_menu()
|
||||||
}
|
}
|
||||||
end
|
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 = '<leader>bd',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
table.insert(tbl, {
|
||||||
|
name = ' Quit Window',
|
||||||
|
cmd = 'q',
|
||||||
|
rtxt = 'q',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'nvchad/volt',
|
'nvchad/volt',
|
||||||
|
@ -466,9 +492,12 @@ return {
|
||||||
'nvchad/menu',
|
'nvchad/menu',
|
||||||
config = function()
|
config = function()
|
||||||
local ignore_ft = {
|
local ignore_ft = {
|
||||||
'help',
|
'dapui_scopes',
|
||||||
'Outline',
|
'dapui_breakpoints',
|
||||||
'trouble',
|
'dapui_stacks',
|
||||||
|
'dapui_watches',
|
||||||
|
'dap-repl',
|
||||||
|
'dapui_console',
|
||||||
}
|
}
|
||||||
vim.keymap.set('n', '<RightMouse>', function()
|
vim.keymap.set('n', '<RightMouse>', function()
|
||||||
if not helper.contains(ignore_ft, vim.bo.ft) then
|
if not helper.contains(ignore_ft, vim.bo.ft) then
|
||||||
|
@ -476,8 +505,12 @@ return {
|
||||||
local menu
|
local menu
|
||||||
if vim.bo.ft == 'NvimTree' then
|
if vim.bo.ft == 'NvimTree' then
|
||||||
menu = get_nvim_tree_menu()
|
menu = get_nvim_tree_menu()
|
||||||
|
elseif helper.contains(quit_only_ft, vim.bo.ft) then
|
||||||
|
menu = {}
|
||||||
|
add_close_quit_menuitem(menu)
|
||||||
else
|
else
|
||||||
menu = get_default_menu()
|
menu = get_default_menu()
|
||||||
|
add_close_quit_menuitem(menu)
|
||||||
end
|
end
|
||||||
require('menu').open(menu, { mouse = true })
|
require('menu').open(menu, { mouse = true })
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue