From 3323c83db85253d5b703178eec1ee08b6c0c95e4 Mon Sep 17 00:00:00 2001 From: theanonymousexyz Date: Wed, 27 Apr 2022 16:09:18 +0200 Subject: [PATCH] Fix vsnip --- nvim/.config/nvim/init.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 0d49999..9116106 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -66,6 +66,24 @@ cmp.setup({ c = cmp.mapping.close(), }), [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif vim.fn["vsnip#available"](1) == 1 then + feedkey("(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 ``. + end + end, { "i", "s" }), + [''] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#jumpable"](-1) == 1 then + feedkey("(vsnip-jump-prev)", "") + end + end, { "i", "s" }), }, sources = cmp.config.sources({ { name = 'nvim_lsp' },