From 4e6384ac3e3ac7affde09b51bc97f512f953ca3b Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Thu, 3 Feb 2022 10:26:39 +0100 Subject: [PATCH] Fix: cmp mapping (tab to confirm) --- nvim/.config/nvim/lua/completion.lua | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/nvim/.config/nvim/lua/completion.lua b/nvim/.config/nvim/lua/completion.lua index 6324447..668a7e3 100644 --- a/nvim/.config/nvim/lua/completion.lua +++ b/nvim/.config/nvim/lua/completion.lua @@ -65,26 +65,26 @@ cmp.setup{ }, mapping = { -- [""] = cmp.mapping.confirm({select = true, behavior = cmp.ConfirmBehavior.Replace}), - [""] = cmp.mapping.confirm({select = true, behavior = cmp.ConfirmBehavior.Insert}), - [""] = cmp.mapping(function(fallback) - if vim.fn.pumvisible() == 1 then - feedkey("", "n") - elseif vim.fn["vsnip#available"]() == 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.confirm({select = true, behavior = cmp.ConfirmBehavior.Insert}), + -- [""] = cmp.mapping(function(fallback) + -- if vim.fn.pumvisible() == 1 then + -- feedkey("", "n") + -- elseif vim.fn["vsnip#available"]() == 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 vim.fn.pumvisible() == 1 then - feedkey("", "n") - elseif vim.fn["vsnip#jumpable"](-1) == 1 then - feedkey("(vsnip-jump-prev)", "") - end - end, { "i", "s" }), + -- [""] = cmp.mapping(function() + -- if vim.fn.pumvisible() == 1 then + -- feedkey("", "n") + -- elseif vim.fn["vsnip#jumpable"](-1) == 1 then + -- feedkey("(vsnip-jump-prev)", "") + -- end + -- end, { "i", "s" }), }, sources = { { name = 'vsnip' },