marleyvim/nvim/lua/plugins/editor/trouble-nvim.lua

56 lines
1.2 KiB
Lua
Raw Normal View History

2025-01-01 17:44:00 -08:00
return {
'trouble.nvim',
cmd = { 'Trouble' },
keys = {
{
'<LEADER>xQ',
'<CMD>Trouble qflist toggle<CR>',
desc = 'quickfix list (trouble)',
},
{
'<LEADER>xx',
'<CMD>Trouble diagnostics toggle<CR>',
desc = 'diagnostics',
},
{
'<LEADER>xX',
'<CMD>Trouble diagnostics toggle filter.buf=0<CR>',
desc = 'buffer diagnostics',
},
{
'[q',
function()
if require('trouble').is_open() then
require('trouble').prev({ skip_groups = true, jump = true })
else
local ok, err = pcall(vim.cmd.cprev)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = 'previous trouble/quickfix item',
},
{
']q',
function()
if require('trouble').is_open() then
require('trouble').next({ skip_groups = true, jump = true })
else
local ok, err = pcall(vim.cmd.cnext)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
},
},
after = function()
require('trouble').setup({
modes = { lsp = { win = { position = 'right' } } },
})
end,
}