From 71f3cf6e4586240d2d7aff7258f0c4edcf8dd48d Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 9 Sep 2022 06:24:18 +0200 Subject: [PATCH] nvim: simplify completion sources --- .config/nvim/lua/my/completion.lua | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/.config/nvim/lua/my/completion.lua b/.config/nvim/lua/my/completion.lua index ea52db4..84afdf2 100644 --- a/.config/nvim/lua/my/completion.lua +++ b/.config/nvim/lua/my/completion.lua @@ -43,6 +43,8 @@ if cmp and luasnip then sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'luasnip' }, + { name = 'nvim_lua' }, + { name = 'dictionary' }, { name = 'zsh' }, }, { { 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 `/` cmp.setup.cmdline('/', { mapping = cmp.mapping.preset.cmdline(), @@ -93,6 +76,9 @@ if cmp and luasnip then dic = { ['gitcommit'] = vim.fn.stdpath('config') .. '/resources/git.dict', + -- doesn't work, filetype is probably set too late + ['NeogitCommitMessage'] = + vim.fn.stdpath('config') .. '/resources/git.dict', } })