diff options
author | ZachIR <zachir@librem.one> | 2025-06-29 13:45:14 -0500 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2025-06-29 13:45:14 -0500 |
commit | 7811be6ae04782a054868529d5c3e8a3f22179e4 (patch) | |
tree | a08fcb792ef50b7df10aed56726daa346d5b9508 /nvim/lua/lsp.lua | |
parent | de01a7b92da2962d841dc38fd5f32cf5dfeecc73 (diff) |
Add lsp to neovim
Diffstat (limited to 'nvim/lua/lsp.lua')
-rw-r--r-- | nvim/lua/lsp.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua new file mode 100644 index 0000000..343c76b --- /dev/null +++ b/nvim/lua/lsp.lua @@ -0,0 +1,22 @@ +-- Remove Global Default Key mapping +vim.keymap.del("n", "grn") +vim.keymap.del("n", "gra") +vim.keymap.del("n", "grr") +vim.keymap.del("n", "gri") +vim.keymap.del("n", "gO") + +-- Create keymapping +-- LspAttach: After an LSP Client performs "initialize" and attaches to a buffer. +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local keymap = vim.keymap + local lsp = vim.lsp + local bufopts = { noremap = true, silent = true } + + keymap.set("n", "gr", lsp.buf.references, bufopts) + keymap.set("n", "gd", lsp.buf.definition, bufopts) + keymap.set("n", "<space>rn", lsp.buf.rename, bufopts) + keymap.set("n", "K", lsp.buf.hover, bufopts) + keymap.set("n", "<space>f", lsp.buf.format, bufopts) + end +}) |