nvimrc: Update completion configuration

This commit is contained in:
Rob Watson 2021-12-12 10:59:58 +01:00
parent 488728cc61
commit d184697933
1 changed files with 18 additions and 3 deletions

21
nvimrc
View File

@ -68,7 +68,6 @@ set updatetime=250
set pastetoggle=<f2> set pastetoggle=<f2>
set pumheight=200 set pumheight=200
" Required for nvim-compe: " Required for nvim-compe:
set completeopt=menu,menuone,noselect
set complete-=i set complete-=i
set nrformats-=octal set nrformats-=octal
set ttimeout set ttimeout
@ -608,8 +607,12 @@ packadd! cmp-calc " https://github.com/hrsh7th/cmp-calc
lua <<EOF lua <<EOF
local cmp = require('cmp') local cmp = require('cmp')
local cmp_buffer = require('cmp_buffer')
cmp.setup({ cmp.setup({
completion = {
completeopt = 'menu,menuone,noinsert',
},
snippet = { snippet = {
expand = function(args) expand = function(args)
vim.fn["vsnip#anonymous"](args.body) vim.fn["vsnip#anonymous"](args.body)
@ -624,10 +627,22 @@ lua <<EOF
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'buffer' }, {
name = 'buffer',
option = {
get_bufnrs = function()
return vim.api.nvim_list_bufs()
end
},
},
{ name = 'path' }, { name = 'path' },
{ name = 'calc' }, { name = 'calc' },
}) }),
sorting = {
comparators = {
function(...) return cmp_buffer:compare_locality(...) end,
}
}
}) })
EOF EOF