fix: new function to check for cmp completitions

This commit is contained in:
max397574 2021-10-08 15:08:57 +02:00 committed by siduck76
parent 5799af49e2
commit 40554c80ad

View File

@ -43,7 +43,7 @@ cmp.setup {
select = true,
},
["<Tab>"] = function(fallback)
if vim.fn.pumvisible() == 1 then
if cmp.visible() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-n>", true, true, true), "n")
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
@ -52,7 +52,7 @@ cmp.setup {
end
end,
["<S-Tab>"] = function(fallback)
if vim.fn.pumvisible() == 1 then
if cmp.visible() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-p>", true, true, true), "n")
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")