feat(nvim): update to trouble.nvim v3 beta

This commit is contained in:
Price Hiller 2024-03-29 11:35:28 -05:00
parent 44757983ac
commit 1e5db276f7
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
4 changed files with 52 additions and 70 deletions

View File

@ -1 +0,0 @@
vim.opt_local.list = false

View File

@ -239,7 +239,6 @@ return {
end,
desc = "LSP: Toggle Diagnostics in Current Buffer",
},
{ "<leader>lD", vim.lsp.buf.declaration, desc = "LSP: Declaration" },
{ "<leader>k", vim.lsp.buf.hover, desc = "LSP: Hover" },
{ "<leader>K", vim.lsp.buf.signature_help, desc = "LSP: Sig Help" },
{ "<leader>lR", ":LspRestart<CR>", desc = "LSP: Restart" },

View File

@ -1,8 +0,0 @@
return {
{
"hedyhli/outline.nvim",
cmd = { "Outline" },
keys = { { "<localleader>o", "<cmd>Outline<CR>", desc = "Toggle Outline" } },
config = true,
},
}

View File

@ -1,77 +1,69 @@
return {
{
"folke/todo-comments.nvim",
event = { "BufReadPre", "BufNewFile" },
keys = {
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Trouble: Todo Items" },
},
cmd = {
"TodoTrouble",
"TodoTelescope",
"TodoQuickFix",
"TodoLocList",
},
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
keywords = {
SECURITY = {
icon = "󰒃",
color = "warning",
alt = { "SEC", "SECURITY" },
},
},
},
},
{
"folke/trouble.nvim",
branch = "dev",
keys = {
{ "<leader>x", desc = "> Trouble" },
{ "<leader>lr", "<cmd>Trouble lsp_references<cr>", desc = "LSP: References" },
{ "<leader>lr", "<cmd>Trouble lsp_references toggle win.position=right<cr>", desc = "LSP: References" },
{
"<leader>li",
"<cmd>Trouble lsp_implementations<cr>",
"<cmd>Trouble lsp_implementations toggle win.position=right<cr>",
desc = "LSP: Implementation",
},
{ "<leader>ld", "<cmd>Trouble lsp_definitions<CR>", desc = "LSP: Definition" },
{ "<leader>xd", desc = "> Trouble: Diagnostics" },
{ "<leader>xdd", "<cmd>Trouble document_diagnostics<cr>", desc = "Trouble: Document Diagnostics" },
{ "<leader>xdw", "<cmd>Trouble workspace_diagnostics<cr>", desc = "Trouble: Workspace Diagnostics" },
{ "<leader>xl", "<cmd>Trouble loclist<cr>", desc = "Trouble: Loclist" },
{ "<leader>xq", "<cmd>Trouble quickfix<cr>", desc = "Trouble: Quickfix" },
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Trouble: Todo Items" },
{ "<leader>xx", "<cmd>TroubleToggle<cr>", desc = "Trouble: Toggle" },
{ "<leader>ld", "<cmd>Trouble lsp_definitions toggle win.position=right<CR>", desc = "LSP: Definitions" },
{
"<leader>lD",
"<cmd>Trouble lsp_type_definitions toggle win.position=right<CR>",
desc = "LSP: Type Definitions",
},
{ "<leader>xx", "<cmd>Trouble lsp toggle focus=false win.position=right<CR>", desc = "Trouble: LSP" },
{
"<leader>xd",
"<cmd>Trouble diagnostics toggle win.position=right<cr>",
desc = "Trouble: Document Diagnostics",
},
{ "<leader>xl", "<cmd>Trouble loclist toggle win.position=right<cr>", desc = "Trouble: Loclist" },
{ "<leader>xq", "<cmd>Trouble qflist toggle win.position=right<cr>", desc = "Trouble: Quickfix" },
{ "<leader>xt", "<cmd>Trouble todo toggle win.position=right<cr>", desc = "Trouble: Todo Items" },
{
"<leader>xo",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Trouble: Symbols",
},
},
event = { "QuickFixCmdPre" },
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
vim.api.nvim_create_autocmd("QuickFixCmdPost", {
callback = function()
vim.cmd.TroubleRefresh()
vim.cmd.Trouble("quickfix")
end,
})
-- HACK: Unfortuantely Neovim & Vim don't expose some C level functions to know when content in the
-- quickfix has been updated 😢. A serious issue with this is that it just tries to refresh after 200ms,
-- which may or may not work depending on how long the quickfix filtering took :/
vim.api.nvim_create_autocmd({ "CmdlineLeave", "CmdwinLeave" }, {
callback = function()
vim.defer_fn(vim.cmd.TroubleRefresh, 200)
end,
})
require("trouble").setup({
auto_open = false,
auto_close = true,
position = "right",
action_keys = {
cancel = "q",
dependencies = {
"nvim-tree/nvim-web-devicons",
{
"folke/todo-comments.nvim",
cmd = {
"TodoTrouble",
"TodoTelescope",
"TodoQuickFix",
"TodoLocList",
},
})
end,
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
keywords = {
SECURITY = {
icon = "󰒃",
color = "warning",
alt = { "SEC", "SECURITY" },
},
},
},
},
},
opts = {
win = {
type = "split",
},
keys = {
["<tab>"] = "fold_toggle",
},
},
cmd = {
"Trouble",
"TroubleClose",
"TroubleToggle",
"TroubleRefresh",
},
},
}