configure trouble plugin
This commit is contained in:
@@ -113,3 +113,32 @@ create_cmd({"InsertLeave", "CmdlineLeave", "TermLeave", "BufEnter", "WinEnter" }
|
||||
trailing_hl_match_ids[window] = vim.fn.matchadd("TrailingWhitespace", [[\s\+$]])
|
||||
end
|
||||
})
|
||||
|
||||
-- Open Trouble Quickfix list automatically
|
||||
create_cmd("QuickFixCmdPost", {
|
||||
desc = "Automatically open Quickfix List in Trouble",
|
||||
group = create_group("cmd-quickfix-open-trouble", { clear = true }),
|
||||
callback = function()
|
||||
vim.cmd([[Trouble qflist open]])
|
||||
end
|
||||
})
|
||||
|
||||
-- Automatically open diagnostic float when hovering with cursor
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
callback = function()
|
||||
if not vim.api.nvim_get_current_win() then return end
|
||||
vim.diagnostic.open_float(nil, { focus = false, scope = "cursor" })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
callback = function()
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
local config = vim.api.nvim_win_get_config(win)
|
||||
if config.relative ~= "" then
|
||||
vim.api.nvim_win_close(win, false)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
@@ -31,15 +31,15 @@
|
||||
]]
|
||||
|
||||
vim.diagnostic.config({
|
||||
update_in_insert = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
border = vim.g.ui.popupborder,
|
||||
source = true,
|
||||
},
|
||||
underline = true,
|
||||
-- underline = true,
|
||||
-- underline only from a specified severity level
|
||||
-- underline = { severity = { min = vim.diagnostic.severity.WARN } },
|
||||
underline = { severity = { min = vim.diagnostic.severity.WARN } },
|
||||
virtual_text = {
|
||||
prefix = vim.g.ui.symbols.diagnostic.virtual_text_prefix,
|
||||
severity = nil, -- show all severities
|
||||
|
||||
@@ -97,3 +97,22 @@ map("n", "<leader>bd", smart_buffer_delete, { desc = "Close Current Buffer" })
|
||||
map("n", "<leader>bw", smart_buffer_wipeout, { desc = "Wipeout Current Buffer" })
|
||||
map("n", "<leader>bD", delete_other_buffers, { desc = "Close All Other Buffers" })
|
||||
map("n", "<leader>bW", wipeout_other_buffers, { desc = "Wipeout All Other Buffers" })
|
||||
|
||||
-- Trouble Keybinds
|
||||
-- open diagnostics window
|
||||
map("n", "<leader>xd", [[<Cmd>Trouble diagnostics toggle focus=false filter.buf=0<CR>]], { desc = "Toggle diagnostic message for current buffer" })
|
||||
map("n", "<leader>xD", [[<Cmd>Trouble diagnostics toggle focus=false<CR>]], { desc = "Toggle diagnostic message for project" })
|
||||
map("n", "grt", [[<Cmd>Trouble symbols toggle focus=false<CR>]], { desc = "Open TreeSitter Symbols" })
|
||||
map("n", "grs", [[<Cmd>Trouble lsp_document_symbols toggle focus=false<CR>]], { desc = "Open LSP Document Symbols", silent = true, noremap = true })
|
||||
map("n", "grS", [[<Cmd>Trouble lsp_workspace_symbols toggle focus=false<CR>]], { desc = "Open LSP Workspace Symbols", silent = true, noremap = true })
|
||||
map("n", "grD", [[<Cmd>Trouble lsp_declarations toggle<CR>]], { desc = "Show LSP Declarations", silent = true, noremap = true })
|
||||
map("n", "grd", [[<Cmd>Trouble lsp_definitions toggle<CR>]], { desc = "Show LSP Definitions", silent = true, noremap = true })
|
||||
map("n", "gri", [[<Cmd>Trouble lsp_implementations toggle<CR>]], { desc = "Show LSP Implementations", silent = true, noremap = true })
|
||||
map("n", "grc", [[<Cmd>Trouble lsp_incoming_calls toggle<CR>]], { desc = "Show LSP incoming calls", silent = true, noremap = true })
|
||||
map("n", "grC", [[<Cmd>Trouble lsp_outgoing_calls toggle<CR>]], { desc = "Show LSP outgoing calls", silent = true, noremap = true })
|
||||
map("n", "grr", [[<Cmd>Trouble lsp_references toggle<CR>]], { desc = "Show LSP references", silent = true, noremap = true })
|
||||
map("n", "<leader>xq", [[<Cmd>Trouble qflist toggle focus=false<CR>]], { desc = "Show Quickfix List" })
|
||||
map("n", "<leader>xl", [[<Cmd>Trouble loclist toggle focus=false<CR>]], { desc = "Show Location List" })
|
||||
map("n", "grn", vim.lsp.buf.rename, { desc = "Rename", silent = true, noremap = true })
|
||||
map("n", "gra", vim.lsp.buf.code_action, { desc = "Action", silent = true, noremap = true })
|
||||
map("n", "gl", vim.diagnostic.open_float, { desc = "Open Diagnostic Float" })
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ local function show_lsp_details()
|
||||
table.insert(lines, "")
|
||||
table.insert(lines, "Health Check (vim.treesitter):")
|
||||
table.insert(lines, "=======================")
|
||||
local health_lines = run_healthcheck("vim.treesitter")
|
||||
health_lines = run_healthcheck("vim.treesitter")
|
||||
for _, l in ipairs(health_lines) do
|
||||
table.insert(lines, " " .. l)
|
||||
end
|
||||
|
||||
@@ -32,5 +32,6 @@
|
||||
|
||||
require("plugins/catppuccin")
|
||||
require("plugins/lualine")
|
||||
require("plugins/trouble")
|
||||
|
||||
require("plugins/whichkey")
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
--[[
|
||||
|
||||
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣷⣦⣄⡀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠚⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠗⢀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣄⡉⠓⠦⣌⡙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣡⠴⠚⢉⣠⣤⣀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣶⣿⣿⣿⣿⣿⣷⣦⣄⡉⠓⠦⣌⡙⠻⢿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣡⠴⠚⢉⣠⣴⣾⣿⣿⣿⣿⣿⣶⣤
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠐⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠓⠦⣌⡙⠻⠟⢋⣡⠴⠚⢉⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⠂
|
||||
⠀⠀⠀⠀⢀⣠⣴⣆⡈⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠃⠘⢉⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢁⣰⣦⣄⡀
|
||||
⠀⠀⠐⠾⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠷⠂
|
||||
⠀⢸⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⡇
|
||||
⠀⢸⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⡇
|
||||
⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⡆⢰⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||||
⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠃⠘⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⡇⢸⣿⣿⣿⣿⠿⠛⠉
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⡇⢸⠿⠛⠉
|
||||
|
||||
__ _ _
|
||||
/ _|___ ___| |_ __ _ ___| | __
|
||||
| ||_ /____/ __| __/ _` |/ __| |/ /
|
||||
| _/ /_____\__ \ || (_| | (__| <
|
||||
|_|/___| |___/\__\__,_|\___|_|\_\
|
||||
|
||||
Neovim v0.12 configuration
|
||||
(C) Frank Zechert 2026
|
||||
]]
|
||||
|
||||
vim.pack.add({
|
||||
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },
|
||||
{ src = "https://github.com/folke/trouble.nvim" },
|
||||
})
|
||||
|
||||
local trouble = require("trouble")
|
||||
trouble.setup({
|
||||
auto_preview = true,
|
||||
auto_refresh = true,
|
||||
auto_jump = false,
|
||||
modes = {
|
||||
diagnostics = {
|
||||
preview = {
|
||||
type = "split",
|
||||
relative = "win",
|
||||
position = "right",
|
||||
size = 0.4
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -41,4 +41,7 @@ wk.setup({
|
||||
})
|
||||
wk.add({
|
||||
{ "<leader>b", group = "Buffers" },
|
||||
{ "<leader>x", group = "Trouble" },
|
||||
{ "<leader>c", group = "Code" },
|
||||
{ "gr", group = "LSP" },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user