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

@@ -99,11 +99,11 @@ Diagnostics:
- `g.` open diagnostic float
- `gl` send diagnostics to the location list
- `gle` display error information
- `gie` toggle inline errors
- `gve` toggle virtual line errors
- `]g` jump to next error
- `[g` jump to previous error
- `gld` display diagnostic information
- `gid` toggle inline diagnostics
- `gvd` toggle virtual line diagnostics
- `]g` jump to next warning or error
- `[g` jump to previous warning or error
## Tree-sitter

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" })

View File

@@ -23,7 +23,7 @@ local function diag_virtual_text()
end
return {
severity = vim.diagnostic.severity.ERROR,
severity = vim.diagnostic.severity.WARN,
}
end