set base cmp config

This commit is contained in:
sloane 2024-07-19 09:26:20 -04:00
parent 0e48d46372
commit 65fb85fa90
No known key found for this signature in database

View file

@ -26,6 +26,38 @@ return {
end, end,
}, },
}) })
local cmp = require('cmp')
cmp.setup({
sources = {
{name = 'nvim_lsp'},
},
mapping = {
['<C-y>'] = cmp.mapping.confirm({select = false}),
['<C-e>'] = cmp.mapping.abort(),
['<Up>'] = cmp.mapping.select_prev_item({behavior = 'select'}),
['<Down>'] = cmp.mapping.select_next_item({behavior = 'select'}),
['<C-p>'] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item({behavior = 'insert'})
else
cmp.complete()
end
end),
['<C-n>'] = 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 end
}, },
} }