override quickfix and loclist to toggle instead of just show
This commit is contained in:
@@ -81,6 +81,36 @@ return {
|
||||
desc = 'Close buffer from tabline',
|
||||
},
|
||||
|
||||
['<Leader>xq'] = {
|
||||
function()
|
||||
local qf_open = vim.tbl_isempty(vim.tbl_filter(function(win)
|
||||
return win.quickfix == 1
|
||||
end, vim.fn.getwininfo()))
|
||||
|
||||
if qf_open then
|
||||
vim.cmd.copen()
|
||||
else
|
||||
vim.cmd.cclose()
|
||||
end
|
||||
end,
|
||||
desc = 'Toggle Quickfix list',
|
||||
},
|
||||
|
||||
['<Leader>xl'] = {
|
||||
function()
|
||||
local ll_open = vim.tbl_isempty(vim.tbl_filter(function(win)
|
||||
return win.loclist == 1
|
||||
end, vim.fn.getwininfo()))
|
||||
|
||||
if ll_open then
|
||||
vim.cmd.lclose()
|
||||
else
|
||||
vim.cmd.lopen()
|
||||
end
|
||||
end,
|
||||
desc = 'Toggle Local list',
|
||||
},
|
||||
|
||||
-- tables with just a `desc` key will be registered with which-key if it's installed
|
||||
-- this is useful for naming menus
|
||||
-- ["<Leader>b"] = { desc = "Buffers" },
|
||||
|
||||
Reference in New Issue
Block a user