summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
authorShubham Saini <me@ubh.sh>2024-04-25 17:49:34 +0000
committerShubham Saini <me@ubh.sh>2024-04-25 17:49:34 +0000
commit7807371b580b0d7ffb063daf8620c4606bcdb787 (patch)
tree908a087caa97bfe14895f2c912cc40cfa403b9b2 /nvim
parent88b6386771726b43e346ce7cd1cb93a901c30ac9 (diff)
nvim: fix for lsp.lua
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/after/plugin/lsp.lua38
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
3lsp.preset("recommended") 3lsp.preset("recommended")
4 4
5lsp.ensure_installed({
6 'rust_analyzer',
7})
8
9-- Fix Undefined global 'vim' 5-- Fix Undefined global 'vim'
10lsp.configure('sumneko_lua', { 6lsp.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
21local cmp = require('cmp') 16local cmp = require('cmp')
22local cmp_select = {behavior = cmp.SelectBehavior.Select} 17local cmp_action = require('lsp-zero').cmp_action()
23local 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
32cmp_mappings['<Tab>'] = nil
33cmp_mappings['<S-Tab>'] = nil
34 18
35lsp.setup_nvim_cmp({ 19cmp.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
39lsp.set_preferences({ 37lsp.set_preferences({