fix: nvim_cmp config for copilot (wip)

This commit is contained in:
Rob Watson 2023-09-18 08:01:47 +02:00
parent c468aecea9
commit d5d5ca6fa7
1 changed files with 4 additions and 4 deletions

8
nvimrc
View File

@ -367,23 +367,23 @@ lua <<EOF
cmp.setup({ cmp.setup({
completion = { completion = {
completeopt = 'menu,menuone,noinsert', completeopt = 'menu,menuone,noinsert',
keyword_length = 3,
}, },
snippet = { snippet = {
expand = function(args) expand = function(args)
vim.fn["vsnip#anonymous"](args.body) vim.fn["vsnip#anonymous"](args.body)
end, end,
}, },
mapping = { mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), ['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4), ['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(), ['<C-e>'] = cmp.mapping.close(),
['C-y'] = cmp.mapping.confirm({ select = true, behaviour = cmp.ConfirmBehavior.Replace }),
['<CR>'] = cmp.mapping.confirm({ select = true, behaviour = cmp.ConfirmBehavior.Replace }), ['<CR>'] = cmp.mapping.confirm({ select = true, behaviour = cmp.ConfirmBehavior.Replace }),
}, }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'copilot', keyword_length = 0 }, { name = 'copilot', keyword_length = 0 },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp', keyword_length = 3 },
{ {
name = 'buffer', name = 'buffer',
option = { option = {