Created
August 1, 2021 15:20
-
-
Save mengwangk/604b8bb8e486a156a703e7db47504e56 to your computer and use it in GitHub Desktop.
LSP Config for Code Lens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local alt_key_mappings = { | |
{"code_lens", "n", "<leader>lcld","<Cmd>lua vim.lsp.codelens.refresh()<CR>"}, | |
{"code_lens", "n", "<leader>lclr", "<Cmd>lua vim.lsp.codelens.run()<CR>"} | |
} | |
local function set_lsp_config(client, bufnr) | |
require"lsp_signature".on_attach({ | |
bind = true, | |
handler_opts = {border = "single"} | |
}) | |
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(...) end | |
local function buf_set_option(...) vim.api.nvim_buf_set_option(...) end | |
buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') | |
for _, mappings in pairs(alt_key_mappings) do | |
local capability, mode, lhs, rhs = unpack(mappings) | |
if client.resolved_capabilities[capability] then | |
buf_set_keymap(bufnr, mode, lhs, rhs, opts) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment