From 2f6b1d1613670c156022a8000cca306c298dd335 Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Sat, 9 Sep 2023 04:55:26 +0200 Subject: [PATCH] Update nvim-cmp config --- lua/plugin/config/cmp.lua | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lua/plugin/config/cmp.lua b/lua/plugin/config/cmp.lua index 36c136e..bfcb902 100644 --- a/lua/plugin/config/cmp.lua +++ b/lua/plugin/config/cmp.lua @@ -63,7 +63,6 @@ cmp.setup({ [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), [""] = cmp.mapping.close(), [""] = cmp.mapping( function (fallback) @@ -92,7 +91,6 @@ cmp.setup({ end end, { "i", "s", } ), - [""] = cmp.mapping( function (fallback) if cmp.visible() then @@ -104,14 +102,32 @@ cmp.setup({ end end, { "i", "s", } ), + [""] = cmp.mapping( + function (fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i", "s", } + ), + [""] = cmp.mapping( + function (fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i", "s", } + ), }, sources = { - -- { name = 'buffer' }, - { name = "path", }, { name = "nvim_lsp", }, + { name = "luasnip", }, + { name = "path", }, + -- { name = 'buffer' }, -- { name = 'nvim_lsp_signature_help' }, -- { name = 'nvim_lua' }, - { name = "luasnip", }, }, })