27 lines
715 B
Lua
27 lines
715 B
Lua
local cmp = require('cmp')
|
|
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
|
local luasnip= require('luasnip')
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
--
|
|
cmp.setup({
|
|
snippet = {
|
|
expand = function(args)
|
|
luasnip.lsp_expand(args.body)
|
|
end
|
|
},
|
|
sources = {
|
|
{name = 'path'},
|
|
{name = 'nvim_lsp'},
|
|
{name = 'nvim_lua'},
|
|
{name = 'luasnip'},
|
|
},
|
|
mapping = cmp.mapping.preset.insert({
|
|
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
|
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
|
['<Tab>'] = cmp.mapping.confirm({ select = true }),
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
}),
|
|
})
|
|
|
|
|