From 65fb85fa900a9f69dc84fca362d481277eaae7c8 Mon Sep 17 00:00:00 2001 From: sloane <1699281+sloanelybutsurely@users.noreply.github.com> Date: Fri, 19 Jul 2024 09:26:20 -0400 Subject: [PATCH] set base cmp config --- .config/nvim/lua/plugins/lsp.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index c38330b..021fad8 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -26,6 +26,38 @@ return { end, }, }) + + local cmp = require('cmp') + cmp.setup({ + sources = { + {name = 'nvim_lsp'}, + }, + mapping = { + [''] = cmp.mapping.confirm({select = false}), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.select_prev_item({behavior = 'select'}), + [''] = cmp.mapping.select_next_item({behavior = 'select'}), + [''] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item({behavior = 'insert'}) + else + cmp.complete() + end + end), + [''] = cmp.mapping(function() + if cmp.visible() then + cmp.select_next_item({behavior = 'insert'}) + else + cmp.complete() + end + end), + }, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + }) end }, }