dotfiles/symlinks/config/nvim/lua/lsp/server_config.lua

69 lines
1.2 KiB
Lua
Raw Normal View History

2021-10-02 23:36:29 +00:00
-------------------------------------------------------------------------------
-- - LSP servers common config -
-------------------------------------------------------------------------------
local M = {}
M.on_attach = function(client, bufnr)
vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
2021-10-02 23:36:29 +00:00
-- Lsp keymaps
local opts = {buffer = bufnr}
vim.keymap.set(
"n",
"<C-]>",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.definition,
opts
)
vim.keymap.set(
"n",
"gD",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.declaration,
opts
)
vim.keymap.set(
"n",
"gr",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.references,
opts
)
vim.keymap.set(
"n",
"gi",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.implementation,
opts
)
vim.keymap.set(
"n",
"<Leader>rn",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.rename,
opts
)
vim.keymap.set(
"n",
"<C-k>",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.signature_help,
opts
)
vim.keymap.set(
"n",
"K",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.hover,
opts
)
vim.keymap.set(
"n",
"<A-CR>",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.code_action,
opts
)
vim.keymap.set(
"n",
"<Leader>ac",
2022-04-27 16:46:14 +00:00
vim.lsp.buf.code_action,
opts
)
2021-10-02 23:36:29 +00:00
end
return M