From 4dd1350f258d32d125aede625bf884369fce6007 Mon Sep 17 00:00:00 2001 From: jdhao Date: Tue, 15 Mar 2022 20:25:30 +0800 Subject: [PATCH] working config for cmp-omni and vimtex --- after/ftplugin/tex.lua | 17 ----------------- lua/config/nvim-cmp.lua | 6 ++++-- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/after/ftplugin/tex.lua b/after/ftplugin/tex.lua index ec86f50..a11226a 100644 --- a/after/ftplugin/tex.lua +++ b/after/ftplugin/tex.lua @@ -1,19 +1,2 @@ -local cmp = require('cmp') -cmp.setup.buffer { - formatting = { - format = function(entry, vim_item) - vim_item.menu = ({ - omni = (vim.inspect(vim_item.menu):gsub('%"', "")), - buffer = "[Buffer]", - })[entry.source.name] - return vim_item - end, - }, - sources = cmp.config.sources({ - { name = 'buffer' }, - { name = 'omni',}, - }) -} - vim.o.textwidth = 120 vim.o.wrap = true diff --git a/lua/config/nvim-cmp.lua b/lua/config/nvim-cmp.lua index e9f5781..c4547dc 100644 --- a/lua/config/nvim-cmp.lua +++ b/lua/config/nvim-cmp.lua @@ -35,6 +35,7 @@ cmp.setup({ { name = 'nvim_lua' }, -- for nvim lua function { name = 'path' }, -- for path completion { name = 'buffer', keyword_length = 4 }, -- for buffer word completion + { name = 'omni' }, { name = 'emoji', insert = true, } -- emoji completion }, completion = { @@ -47,14 +48,15 @@ cmp.setup({ formatting = { format = lspkind.cmp_format({ mode = "symbol_text", - menu = { + menu = ({ nvim_lsp = "[LSP]", ultisnips = "[US]", nvim_lua = "[Lua]", path = "[Path]", buffer = "[Buffer]", emoji = "[Emoji]", - }, + omni = "[Omni]", + }), }), }, })