nvim: Add mapping for inlay hints

`<localleader>li` will show inlay hints if they are available
for the active LSP server.
This commit is contained in:
Marty Oehme 2024-06-06 09:45:34 +02:00
parent c03b88c6cc
commit cb21789f3a
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -77,6 +77,9 @@ local function on_attach(client, bufnr)
"<cmd>lua vim.diagnostic.open_float()<cr>",
{ buffer = bufnr, desc = "Line diagnostics" }
)
map("n", "<localleader>li", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end, { buffer = bufnr, desc = "Inlay hints" })
map("n", "<localleader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", { buffer = bufnr, desc = "Codeactions" })
map("n", "<localleader>ln", "<cmd>lua vim.lsp.buf.rename()<cr>", { buffer = bufnr, desc = "Rename element" })
if vim.fn.exists(":Glance") then