feat: trouble.nvim

This commit is contained in:
punkfairie 2025-01-01 17:44:00 -08:00
parent fd6161e902
commit 3460ac5650
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
3 changed files with 57 additions and 0 deletions

View file

@ -52,6 +52,7 @@ with final.pkgs.lib; let
flash-nvim
which-key-nvim
gitsigns-nvim
trouble-nvim
aerial-nvim
# Treesitter

View file

@ -6,5 +6,6 @@ return {
req('gitsigns-nvim'),
req('grug-far-nvim'),
req('neo-tree-nvim'),
req('trouble-nvim'),
req('which-key-nvim'),
}

View file

@ -0,0 +1,55 @@
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,
}