diff options
Diffstat (limited to '')
-rw-r--r-- | lua/config/lsp.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 413e06f..7004b6c 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -10,6 +10,8 @@ vim.lsp.enable({ "nixd", + "qmlls", + "rust-analyzer", "angular-language-server", @@ -27,3 +29,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", "i" }, "<C-;>", function() + return vim.lsp.buf.signature_help() + end, opts) + end + end, +}) |