nvim: Fix diagnostic toggle mappings

Finally changed the 'show line diagnostics' (opening a popup with all
diagnostics on current line) mapping to fit to the other remappings
moving 'diagnostics' to the `e` key, with `<localleader>le`.

And fixed the ability to toggle diagnostics as virtual lines with
`<localleader>lO`.
This commit is contained in:
Marty Oehme 2025-12-01 09:59:42 +01:00
parent 726c7cf9c0
commit ce8c40e717
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -149,7 +149,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
o({ desc = "Next error" })
)
map("n", "<localleader>ld", "<cmd>lua vim.diagnostic.open_float()<cr>", o({ desc = "Show line diagnostics" }))
map("n", "<localleader>le", "<cmd>lua vim.diagnostic.open_float()<cr>", o({ desc = "Show line diagnostics" }))
map("n", "<localleader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", o({ desc = "Codeactions" }))
map("n", "<localleader>ln", "<cmd>lua vim.lsp.buf.rename()<cr>", o({ desc = "Rename element" }))
map("n", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", o({ desc = "Declaration" }))
@ -166,7 +166,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
local c = vim.diagnostic.config() or {}
vim.diagnostic.config({ virtual_text = not c["virtual_text"] })
end, o({ desc = "Toggle virtual diag text" }))
if vim.fn.has("nvim-0.11") == true then -- new feature https://gpanders.com/blog/whats-new-in-neovim-0-11/#virtual-lines
if vim.fn.has("nvim-0.11") == 1 then -- new feature https://gpanders.com/blog/whats-new-in-neovim-0-11/#virtual-lines
map("n", "<localleader>lO", function()
local c = vim.diagnostic.config() or {}
vim.diagnostic.config({ virtual_lines = not c["virtual_lines"] })