From 43c1615822eeeb29d8213ca117760476f9e9f4dc Mon Sep 17 00:00:00 2001 From: jdhao Date: Tue, 22 Nov 2022 21:17:47 +0800 Subject: [PATCH] fix: cmp-omni messes with the lsp completion If we use cmp-omni and lsp together, it seems that it will mess the autocompletion. So we only use it with tex file, where lsp in not used. --- lua/config/nvim-cmp.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/config/nvim-cmp.lua b/lua/config/nvim-cmp.lua index 188c9859..a402f1c7 100644 --- a/lua/config/nvim-cmp.lua +++ b/lua/config/nvim-cmp.lua @@ -35,7 +35,6 @@ cmp.setup { { name = "ultisnips" }, -- For ultisnips user. { name = "path" }, -- for path completion { name = "buffer", keyword_length = 2 }, -- for buffer word completion - { name = "omni" }, { name = "emoji", insert = true }, -- emoji completion }, completion = { @@ -61,6 +60,15 @@ cmp.setup { }, } +cmp.setup.filetype("tex", { + sources = { + { name = "omni" }, + { name = "ultisnips" }, -- For ultisnips user. + { name = "buffer", keyword_length = 2 }, -- for buffer word completion + { name = "path" }, -- for path completion + }, +}) + -- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu vim.cmd([[ highlight! link CmpItemMenu Comment