configure LSP, codelens, and trouble

This commit is contained in:
2026-06-28 20:52:55 +02:00
parent d256020251
commit 9810b20e0b
6 changed files with 71 additions and 25 deletions
+21 -17
View File
@@ -46,9 +46,10 @@ create_cmd("TextYankPost", {
create_cmd("FileType", {
desc = "Disable list characters for some filetypes",
group = create_group("cmd-disable-listchars", { clear = true }),
pattern = { "netrw" },
pattern = { "netrw", "trouble" },
callback = function(args)
vim.opt_local.list = false
vim.opt.textwidth = 0
end
})
@@ -124,21 +125,24 @@ create_cmd("QuickFixCmdPost", {
})
-- 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,
create_cmd("CursorHold", {
desc = "Automatically open Diagnostic Float",
group = create_group("cmd-auto-open-diagnostic-float", { clear = true }),
callback = function()
-- If any floating window exists, do nothing
for _, win in ipairs(vim.api.nvim_list_wins()) do
local cfg = vim.api.nvim_win_get_config(win)
if cfg.relative ~= "" then
return
end
end
-- Only open if there is a diagnostic under cursor
local diags = vim.diagnostic.get(0, { lnum = vim.fn.line('.') - 1 })
if #diags == 0 then
return
end
vim.diagnostic.open_float(nil, { focus = false, scope = "cursor" })
end,
})