try to make nvim-cmp and luasnip work together

This commit is contained in:
cy 2024-12-24 23:05:01 -05:00
parent 18e0c512d7
commit e2c65f5243

View file

@ -8,7 +8,7 @@ cmp.setup {
end,
},
mapping = {
["<C-e"] = cmp.mapping.abort(),
["<C-h"] = cmp.mapping.abort(),
["<C-k>"] = cmp.mapping(function(fallback)
if cmp.visible() then
@ -25,20 +25,20 @@ cmp.setup {
end),
["<C-n>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.locally_jumpable(1) then
if luasnip.locally_jumpable(1) then
luasnip.jump(1)
elseif cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { "i", "s" }),
["<C-p>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
elseif cmp.visible() then
cmp.select_prev_item()
else
fallback()
end