diff options
Diffstat (limited to '')
-rw-r--r-- | lua/config/lsp.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 413e06f..8e71e24 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -27,3 +27,34 @@ vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { vim.treesitter.start(nil, "angular") end, }) + +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local buffer = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client then + -- Keybindings + local map = vim.keymap.set + local opts = { buffer = buffer } + + map("n", "<leader>cr", vim.lsp.buf.rename, opts) + map("n", "gd", vim.lsp.buf.definition, opts) + map("n", "gD", vim.lsp.buf.declaration, opts) + map("n", "gI", vim.lsp.buf.implementation, opts) + map("n", "gy", vim.lsp.buf.type_definition, opts) + map("n", "gr", vim.lsp.buf.references, opts) + + map("n", "K", function() + return vim.lsp.buf.hover() + end, opts) + + map("n", "gK", function() + return vim.lsp.buf.signature_help() + end, opts) + + map("n", "<C-i>", function() + return vim.lsp.buf.signature_help() + end, opts) + end + end, +}) |