93 lines
1.9 KiB
Lua
93 lines
1.9 KiB
Lua
---@module 'trouble'
|
|
|
|
return {
|
|
"folke/trouble.nvim",
|
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
cmd = { "Trouble" },
|
|
keys = {
|
|
{
|
|
"<leader>fD",
|
|
"<cmd>Trouble diagnostics open<cr>",
|
|
desc = "Find diagnostics (Trouble)",
|
|
},
|
|
{
|
|
"<leader>fd",
|
|
"<cmd>Trouble diagnostics open filter.buf=0<cr>",
|
|
desc = "Find buffer diagnostics (Trouble)",
|
|
},
|
|
{
|
|
"<leader>ll",
|
|
"<cmd>Trouble symbols open<cr>",
|
|
desc = "Symbols (Trouble)",
|
|
},
|
|
{
|
|
"<leader>li",
|
|
"<cmd>Trouble lsp open<cr>",
|
|
desc = "LSP info of node (Trouble)",
|
|
},
|
|
{
|
|
"<leader>fq",
|
|
"<cmd>Trouble qflist open<cr>",
|
|
desc = "Quickfix List (Trouble)",
|
|
},
|
|
},
|
|
opts = function()
|
|
---@type trouble.Window.opts
|
|
local win_opts = {
|
|
-- size = { width = 30, height = 0.5 },
|
|
minimal = true,
|
|
border = "rounded",
|
|
position = "bottom",
|
|
}
|
|
|
|
---@type trouble.Config
|
|
return {
|
|
focus = true,
|
|
|
|
---@type trouble.Window.opts
|
|
preview = {
|
|
type = "split",
|
|
relative = "win",
|
|
position = "top",
|
|
},
|
|
|
|
---@type table<string, trouble.Action.spec|false>
|
|
keys = {
|
|
["<s-cr>"] = "jump_close",
|
|
["<cr>"] = "jump",
|
|
["<2-leftmouse>"] = "jump",
|
|
["<c-v>"] = "jump_split_close",
|
|
["<c-s>"] = "jump_vsplit_close",
|
|
["v"] = "jump_split_close",
|
|
["s"] = "jump_vsplit_close",
|
|
["<c-k>"] = "cancel", -- hack to fool myself into thinking I move to the avobe window
|
|
["a"] = function(view, ctx)
|
|
-- TODO: this is not possible until this issue is solved
|
|
-- https://github.com/neovim/neovim/issues/31206
|
|
local trouble = require("trouble")
|
|
view:action("jump_only")
|
|
|
|
vim.lsp.buf.code_action()
|
|
|
|
trouble.focus(view, ctx)
|
|
end,
|
|
},
|
|
win = win_opts,
|
|
---@type table<string, trouble.Mode>
|
|
modes = {
|
|
symbols = {
|
|
focus = true,
|
|
win = win_opts
|
|
},
|
|
lsp_references = {
|
|
focus = true,
|
|
win = win_opts
|
|
},
|
|
lsp = {
|
|
focus = true,
|
|
win = win_opts
|
|
},
|
|
}
|
|
}
|
|
end
|
|
}
|