nvim: add <Space>ud to toggle virtual diagnostic lines

This commit is contained in:
Daniel Lundin 2025-03-12 15:03:21 +01:00
parent c2d855850a
commit 58ea91fac9
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
2 changed files with 45 additions and 37 deletions
home/common/nvim

View file

@ -114,8 +114,16 @@ vim.diagnostic.config {
[vim.diagnostic.severity.HINT] = "",
},
},
virtual_lines = true,
virtual_lines = { current_line = true },
}
vim.keymap.set('n', '<Space>ud', function()
if vim.diagnostic.config().virtual_lines == true then
vim.diagnostic.config({ virtual_lines = { current_line = true } })
else
vim.diagnostic.config({ virtual_lines = true })
end
end, { desc = 'Toggle diagnostic virtual_lines' })
-- Make <Tab> work for snippets
vim.keymap.set({ "i", "s" }, "<Tab>", function()