neovim: jump through snippet if cmp isn't visible

This commit is contained in:
2023-11-26 11:33:19 +03:00
parent a48823065a
commit 3f06d8b4f8

View File

@@ -39,17 +39,17 @@ cmp.setup({
}, },
mapping = { mapping = {
["<C-j>"] = cmp.mapping(function() ["<C-j>"] = cmp.mapping(function()
if ls.in_snippet() then if cmp.visible() then
ls.jump(1)
else
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
ls.jump(1)
end end
end), end),
["<C-k>"] = cmp.mapping(function() ["<C-k>"] = cmp.mapping(function()
if ls.in_snippet() then if cmp.visible() then
ls.jump(-1)
else
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
else
ls.jump(-1)
end end
end), end),
["<C-space>"] = cmp.mapping(function() ["<C-space>"] = cmp.mapping(function()