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