1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

fix nvim-cmp error

check https://github.com/hrsh7th/nvim-cmp/issues/231#issuecomment-1098175017
This commit is contained in:
jdhao 2022-04-14 00:14:25 +08:00
parent 8059940caa
commit 4ab3d0414f

View File

@ -9,32 +9,27 @@ cmp.setup({
vim.fn["UltiSnips#Anon"](args.body)
end,
},
mapping = {
['<Tab>'] = {
i = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
c = cmp.config.disable
},
['<S-Tab>'] = {
i = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
c = cmp.config.disable
},
['<Esc>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
},
mapping = cmp.mapping.preset.insert({
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-e>'] = cmp.mapping.abort(),
['<Esc>'] = cmp.mapping.close(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
}),
sources = {
{ name = 'nvim_lsp' }, -- For nvim-lsp
{ name = 'ultisnips' }, -- For ultisnips user.