update config for updated plugins

This commit is contained in:
Ray Elliott 2021-12-13 15:16:24 +00:00
parent 2df15c3410
commit ca57edd143
3 changed files with 13 additions and 15 deletions

View File

@ -58,7 +58,7 @@ Plug '~/nvim-paper-tonic'
Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' } Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' }
Plug 'hrsh7th/cmp-buffer', { 'branch': 'main' } Plug 'hrsh7th/cmp-buffer', { 'branch': 'main' }
Plug 'hrsh7th/cmp-path', { '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 let g:cmp_dictionary_exact = -1
Plug 'quangnguyen30192/cmp-nvim-ultisnips', { 'branch': 'main' } Plug 'quangnguyen30192/cmp-nvim-ultisnips', { 'branch': 'main' }

View File

@ -7,7 +7,6 @@ cmp.setup({
nvim_lsp = "[LSP]", nvim_lsp = "[LSP]",
path = "[Path]", path = "[Path]",
buffer = "[Buffer]", buffer = "[Buffer]",
dictionary = "[Dict]",
ultisnips = "[UltiSnips]", ultisnips = "[UltiSnips]",
})[entry.source.name] })[entry.source.name]
return vim_item return vim_item
@ -24,12 +23,17 @@ cmp.setup({
end, end,
}, },
mapping = { mapping = {
['<C-n>'] = cmp.mapping.complete(),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
-- ['<C-e>'] = cmp.mapping.close(),
['<C-e>'] = cmp.mapping.abort(),
['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-u>'] = cmp.mapping.scroll_docs(4), ['<C-u>'] = cmp.mapping.scroll_docs(4),
["<C-n>"] = cmp.mapping({
i = function()
if cmp.visible() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert })
else
cmp.complete()
end
end,
}),
}, },
sources = { sources = {
{ {
@ -43,16 +47,10 @@ cmp.setup({
keyword_length = 4, keyword_length = 4,
max_item_count = 20, max_item_count = 20,
}, },
{
name = 'dictionary',
keyword_length = 4,
max_item_count = 20,
},
{ {
name = 'ultisnips', name = 'ultisnips',
priority_weight = 10, priority_weight = 10,
keyword_length = 1, keyword_length = 1,
}, },
...
} }
}) })

View File

@ -1,9 +1,9 @@
-- nvim-autopairs -- nvim-autopairs
require('nvim-autopairs').setup{} require('nvim-autopairs').setup{}
-- you need setup cmp first put this after cmp.setup() -- you need setup cmp first put this after cmp.setup()
require("nvim-autopairs.completion.cmp").setup({ require("cmp").setup({
map_cr = true, -- map <CR> on insert mode map_cr = false, -- map <CR> on insert mode
map_complete = true, -- it will auto insert `(` after select function or method item map_complete = false, -- it will auto insert `(` after select function or method item
auto_select = true -- automatically select the first item auto_select = true -- automatically select the first item
}) })