Fix vsnip

This commit is contained in:
theanonymousexyz 2022-04-27 16:09:18 +02:00
parent 2a5de20641
commit 3323c83db8
No known key found for this signature in database
GPG Key ID: 35EE09F5481049BB
1 changed files with 18 additions and 0 deletions

View File

@ -66,6 +66,24 @@ cmp.setup({
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { "i", "s" }),
['<S-Tab>'] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },