feat: use virtual_text instead of virtual_lines and add keymap to toggle this

This commit is contained in:
Oliver Ladner 2025-04-01 11:02:14 +02:00
commit b5be5a3659
2 changed files with 57 additions and 48 deletions

View file

@ -109,10 +109,9 @@ vim.diagnostic.config({
[vim.diagnostic.severity.INFO] = "",
},
},
-- virtual_text = { current_line = true },
-- virtual_lines = true,
-- virtual_text = true,
virtual_lines = {
current_line = true,
},
virtual_text = true,
virtual_lines = false,
-- virtual_lines = {
-- current_line = true,
-- },
})

View file

@ -128,3 +128,13 @@ end, { desc = "Turn diagnostics on/off" })
-- Toggle trouble (for document)
--vim.keymap.set("n", "<leader>qq", ":TroubleToggle<CR>")
--vim.keymap.set("n", "<leader>qq", "<cmd>Trouble diagnostics toggle<cr>")
-- By default, show virtual_text and hide virtual_lines.
-- This keymap allows to do the opposite. Can be useful when there are multiple
-- severities on the same line
vim.keymap.set("n", "<leader>tdd", function()
vim.diagnostic.config({
virtual_lines = not vim.diagnostic.config().virtual_lines,
virtual_text = not vim.diagnostic.config().virtual_text,
})
end, { desc = "Toggle diagnostic virtual lines and virtual text" })