diff options
author | Shubham Saini <me@ubh.sh> | 2024-04-25 17:49:34 +0000 |
---|---|---|
committer | Shubham Saini <me@ubh.sh> | 2024-04-25 17:49:34 +0000 |
commit | 7807371b580b0d7ffb063daf8620c4606bcdb787 (patch) | |
tree | 908a087caa97bfe14895f2c912cc40cfa403b9b2 /nvim | |
parent | 88b6386771726b43e346ce7cd1cb93a901c30ac9 (diff) |
nvim: fix for lsp.lua
Diffstat (limited to 'nvim')
-rw-r--r-- | nvim/.config/nvim/after/plugin/lsp.lua | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/nvim/.config/nvim/after/plugin/lsp.lua b/nvim/.config/nvim/after/plugin/lsp.lua index 675c2bd..1d64ec5 100644 --- a/nvim/.config/nvim/after/plugin/lsp.lua +++ b/nvim/.config/nvim/after/plugin/lsp.lua | |||
@@ -2,12 +2,8 @@ local lsp = require("lsp-zero") | |||
2 | 2 | ||
3 | lsp.preset("recommended") | 3 | lsp.preset("recommended") |
4 | 4 | ||
5 | lsp.ensure_installed({ | ||
6 | 'rust_analyzer', | ||
7 | }) | ||
8 | |||
9 | -- Fix Undefined global 'vim' | 5 | -- Fix Undefined global 'vim' |
10 | lsp.configure('sumneko_lua', { | 6 | lsp.configure('lua_ls', { |
11 | settings = { | 7 | settings = { |
12 | Lua = { | 8 | Lua = { |
13 | diagnostics = { | 9 | diagnostics = { |
@@ -17,23 +13,25 @@ lsp.configure('sumneko_lua', { | |||
17 | } | 13 | } |
18 | }) | 14 | }) |
19 | 15 | ||
20 | |||
21 | local cmp = require('cmp') | 16 | local cmp = require('cmp') |
22 | local cmp_select = {behavior = cmp.SelectBehavior.Select} | 17 | local cmp_action = require('lsp-zero').cmp_action() |
23 | local cmp_mappings = lsp.defaults.cmp_mappings({ | ||
24 | ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), | ||
25 | ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), | ||
26 | ['<C-y>'] = cmp.mapping.confirm({ select = true }), | ||
27 | ["<C-Space>"] = cmp.mapping.complete(), | ||
28 | }) | ||
29 | |||
30 | -- disable completion with tab | ||
31 | -- this helps with copilot setup | ||
32 | cmp_mappings['<Tab>'] = nil | ||
33 | cmp_mappings['<S-Tab>'] = nil | ||
34 | 18 | ||
35 | lsp.setup_nvim_cmp({ | 19 | cmp.setup({ |
36 | mapping = cmp_mappings | 20 | window = { |
21 | completion = cmp.config.window.bordered(), | ||
22 | documentation = cmp.config.window.bordered(), | ||
23 | }, | ||
24 | mapping = cmp.mapping.preset.insert({ | ||
25 | ['<C-Space>'] = cmp.mapping.complete(), | ||
26 | ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), | ||
27 | ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), | ||
28 | ['<C-y>'] = cmp.mapping.confirm({ select = true }), | ||
29 | }), | ||
30 | snippet = { | ||
31 | expand = function(args) | ||
32 | require('luasnip').lsp_expand(args.body) | ||
33 | end, | ||
34 | }, | ||
37 | }) | 35 | }) |
38 | 36 | ||
39 | lsp.set_preferences({ | 37 | lsp.set_preferences({ |