1
0
Fork 0

nvim: simplify completion sources

This commit is contained in:
tastytea 2022-09-09 06:24:18 +02:00
parent eb786ea5a8
commit 71f3cf6e45
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 5 additions and 19 deletions

View File

@ -43,6 +43,8 @@ if cmp and luasnip then
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'nvim_lua' },
{ name = 'dictionary' },
{ name = 'zsh' }, { name = 'zsh' },
}, { }, {
{ name = 'buffer' }, { name = 'buffer' },
@ -50,25 +52,6 @@ if cmp and luasnip then
}) })
}) })
-- set configuration for specific filetypes
cmp.setup.filetype('lua', {
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'nvim_lua' },
}, {
{ name = 'buffer' },
})
})
cmp.setup.filetype({ 'gitcommit', 'NeogitCommitMessage' }, {
sources = cmp.config.sources({
{ name = 'dictionary' }
}, {
{ name = 'buffer' }
})
})
-- Use buffer source for `/` -- Use buffer source for `/`
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
@ -93,6 +76,9 @@ if cmp and luasnip then
dic = { dic = {
['gitcommit'] = ['gitcommit'] =
vim.fn.stdpath('config') .. '/resources/git.dict', vim.fn.stdpath('config') .. '/resources/git.dict',
-- doesn't work, filetype is probably set too late
['NeogitCommitMessage'] =
vim.fn.stdpath('config') .. '/resources/git.dict',
} }
}) })