better diagnostic behavior

This commit is contained in:
2026-07-03 04:34:43 +02:00
parent baf089a8e5
commit 74fa81f857
3 changed files with 20 additions and 16 deletions

View File

@@ -111,22 +111,26 @@ vim.api.nvim_create_autocmd("LspAttach", {
map("n", "g.", vim.diagnostic.open_float, { desc = "line diagnostics" })
map("n", "gl", vim.diagnostic.setloclist, { desc = "diagnostic list" })
-- diagnostics only on error. g] is used by mini.ai
-- diagnostics on warnings and errors.
map("n", "]g", function()
vim.diagnostic.goto_next({
severity = vim.diagnostic.severity.ERROR,
severity = {
min = vim.diagnostic.severity.WARN,
},
})
end, { desc = "next error" })
end, { desc = "next warning/error" })
map("n", "[g", function()
vim.diagnostic.goto_prev({
severity = vim.diagnostic.severity.ERROR,
severity = {
min = vim.diagnostic.severity.WARN,
},
})
end, { desc = "prev error" })
end, { desc = "prev warning/error" })
map("n", "gle", vim.diagnostic.setloclist, { desc = "display error information" })
map("n", "gie", function()
map("n", "gld", vim.diagnostic.setloclist, { desc = "display diagnostic information" })
map("n", "gid", function()
vim.diagnostic.config({ virtual_text = not vim.diagnostic.config().virtual_text })
end, { desc = "toggle inline errors" })
map("n", "gve", function()
end, { desc = "toggle inline diagnostics" })
map("n", "gvd", function()
vim.diagnostic.config({ virtual_lines = not vim.diagnostic.config().virtual_lines })
end, { desc = "toggle virtual line errors" })
end, { desc = "toggle virtual line diagnostics" })