From 6be2309fdc9ea3a4ad8db62a072775fb4a6c6d2a Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Thu, 21 Apr 2022 13:03:22 -0700 Subject: [PATCH] Fix cmp mappings --- neovim/lua/plugins/completion.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/neovim/lua/plugins/completion.lua b/neovim/lua/plugins/completion.lua index 6e1f5df..be18116 100644 --- a/neovim/lua/plugins/completion.lua +++ b/neovim/lua/plugins/completion.lua @@ -19,9 +19,11 @@ function M.config_cmp() { name = "buffer" }, { name = "spell" }, }, - mapping = { - [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), + mapping = cmp.mapping.preset.insert({ + -- Scroll docs with readline back - forward + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + -- Expand snippets with Tab [""] = cmp.mapping(function(fallback) if luasnip.expand_or_jumpable() then luasnip.expand_or_jump() @@ -29,19 +31,17 @@ function M.config_cmp() fallback() end end), + -- Start and cycle completions with C-Space [""] = cmp.mapping(function() if cmp.visible() then cmp.select_next_item() else cmp.complete() end - end, { "i", "c" }), - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), + end), + -- Confirm completion with Enter [""] = cmp.mapping.confirm({ select = true }), - }, + }), }) -- Add a plug mapping to use in C-Space binding