From 74fa81f85747486fb90509185600650d3bbe7ea9 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 3 Jul 2026 04:34:43 +0200 Subject: [PATCH] better diagnostic behavior --- nvim/.config/nvim/README.md | 10 ++++---- nvim/.config/nvim/lua/romanzy/keymaps.lua | 24 +++++++++++-------- nvim/.config/nvim/lua/romanzy/plugins/lsp.lua | 2 +- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/nvim/.config/nvim/README.md b/nvim/.config/nvim/README.md index a63b85a..a84fb7f 100644 --- a/nvim/.config/nvim/README.md +++ b/nvim/.config/nvim/README.md @@ -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 diff --git a/nvim/.config/nvim/lua/romanzy/keymaps.lua b/nvim/.config/nvim/lua/romanzy/keymaps.lua index 89a7399..73c5eb4 100644 --- a/nvim/.config/nvim/lua/romanzy/keymaps.lua +++ b/nvim/.config/nvim/lua/romanzy/keymaps.lua @@ -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" }) diff --git a/nvim/.config/nvim/lua/romanzy/plugins/lsp.lua b/nvim/.config/nvim/lua/romanzy/plugins/lsp.lua index 8a3e183..c2b72b7 100644 --- a/nvim/.config/nvim/lua/romanzy/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/romanzy/plugins/lsp.lua @@ -23,7 +23,7 @@ local function diag_virtual_text() end return { - severity = vim.diagnostic.severity.ERROR, + severity = vim.diagnostic.severity.WARN, } end