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 }, }