From ca57edd1431740e013c951431667aa9f12ec8558 Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 13 Dec 2021 15:16:24 +0000 Subject: [PATCH] update config for updated plugins --- init.plugins.vim | 2 +- lua/init-cmp.lua | 20 +++++++++----------- lua/init-plugins.lua | 6 +++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 5cb9351..60a0792 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -58,7 +58,7 @@ Plug '~/nvim-paper-tonic' Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' } Plug 'hrsh7th/cmp-buffer', { 'branch': 'main' } Plug 'hrsh7th/cmp-path', { 'branch': 'main' } - Plug 'uga-rosa/cmp-dictionary', { 'branch': 'main' } + " Plug 'uga-rosa/cmp-dictionary', { 'branch': 'main' } let g:cmp_dictionary_exact = -1 Plug 'quangnguyen30192/cmp-nvim-ultisnips', { 'branch': 'main' } diff --git a/lua/init-cmp.lua b/lua/init-cmp.lua index ba51a67..e2a05b6 100644 --- a/lua/init-cmp.lua +++ b/lua/init-cmp.lua @@ -7,7 +7,6 @@ cmp.setup({ nvim_lsp = "[LSP]", path = "[Path]", buffer = "[Buffer]", - dictionary = "[Dict]", ultisnips = "[UltiSnips]", })[entry.source.name] return vim_item @@ -24,12 +23,17 @@ cmp.setup({ end, }, mapping = { - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.confirm({ select = true }), - -- [''] = cmp.mapping.close(), - [''] = cmp.mapping.abort(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping({ + i = function() + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) + else + cmp.complete() + end + end, + }), }, sources = { { @@ -43,16 +47,10 @@ cmp.setup({ keyword_length = 4, max_item_count = 20, }, - { - name = 'dictionary', - keyword_length = 4, - max_item_count = 20, - }, { name = 'ultisnips', priority_weight = 10, keyword_length = 1, }, - ... } }) diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index a6f2f97..6e92327 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -1,9 +1,9 @@ -- nvim-autopairs require('nvim-autopairs').setup{} -- you need setup cmp first put this after cmp.setup() -require("nvim-autopairs.completion.cmp").setup({ - map_cr = true, -- map on insert mode - map_complete = true, -- it will auto insert `(` after select function or method item +require("cmp").setup({ + map_cr = false, -- map on insert mode + map_complete = false, -- it will auto insert `(` after select function or method item auto_select = true -- automatically select the first item })