configure trouble plugin

This commit is contained in:
2026-06-28 20:15:04 +02:00
parent 9c48b3b3a0
commit d256020251
9 changed files with 115 additions and 4 deletions
+29
View File
@@ -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,
})