diff options
-rw-r--r-- | dotfiles/nvim/init.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/dotfiles/nvim/init.lua b/dotfiles/nvim/init.lua index 9a41c7b..5e3da99 100644 --- a/dotfiles/nvim/init.lua +++ b/dotfiles/nvim/init.lua @@ -515,6 +515,7 @@ require('lazy').setup({ -- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + map('<leader>cl', vim.lsp.codelens.run, '[C]ode [L]ens') -- Opens a popup that displays documentation about the word under your cursor -- See `:help K` for why this keymap @@ -524,6 +525,7 @@ require('lazy').setup({ -- For example, in C this would take you to the header map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed @@ -544,6 +546,12 @@ require('lazy').setup({ callback = vim.lsp.buf.clear_references, }) end + if client and client.server_capabilities.codeLensProvider then + vim.api.nvim_create_autocmd({ 'BufEnter', 'CursorHold', 'InsertLeave' }, { + buffer = event.buf, + callback = vim.lsp.codelens.refresh, + }) + end end, }) |