diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index 28ac9a4..076dfe5 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -51,7 +51,6 @@ local lsp = { vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" }) for server, config in pairs(lspconfig_opts.servers) do - -- TODO: Check if it actually can be ignored in Nvim 0.11+, see https://cmp.saghen.dev/installation.html#lazy-nvim if vim.fn.has("nvim-0.11") == false then config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities) end @@ -206,16 +205,28 @@ vim.api.nvim_create_autocmd("LspAttach", { require("which-key").add({ "l", group = "language" }) end map("n", "ld", "lua vim.diagnostic.open_float()", o({ desc = "Show line diagnostics" })) - map("n", "lI", function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) - end, o({ desc = "Toggle inlay hints" })) map("n", "la", "lua vim.lsp.buf.code_action()", o({ desc = "Codeactions" })) map("n", "ln", "lua vim.lsp.buf.rename()", o({ desc = "Rename element" })) map("n", "lc", "lua vim.lsp.buf.declaration()", o({ desc = "Declaration" })) map("n", "ls", "lua vim.lsp.buf.signature_help()", o({ desc = "Signature help" })) - map("n", "lo", function() + + map("n", "lI", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + end, o({ desc = "Toggle inlay hints" })) + map("n", "lD", function() vim.diagnostic.enable(not vim.diagnostic.is_enabled()) end, o({ desc = "Toggle Diagnostics" })) + -- FIXME: Will be re-enabled with insert-mode autocmd above + map("n", "lo", function() + 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 + map("n", "lO", function() + local c = vim.diagnostic.config() or {} + vim.diagnostic.config({ virtual_lines = not c["virtual_lines"] }) + end, o({ desc = "Toggle virtual diag lines" })) + end local pref = function(glances, telescope, fallback) if glances and vim.fn.exists(":Glance") > 0 then