From aac2ce8f3070711768295ecc7876bb86ca55877a Mon Sep 17 00:00:00 2001 From: Jean-Pierre Appel Date: Tue, 3 Oct 2023 12:29:38 -0400 Subject: changed completion menu apperance, added dynamic find reference bind --- nvim/lua/plugins/nvim-cmp.lua | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'nvim/lua/plugins') diff --git a/nvim/lua/plugins/nvim-cmp.lua b/nvim/lua/plugins/nvim-cmp.lua index 907ba2e..32285bf 100644 --- a/nvim/lua/plugins/nvim-cmp.lua +++ b/nvim/lua/plugins/nvim-cmp.lua @@ -2,6 +2,8 @@ local Plugins = {} +-- FIXME: plugin not loading correctly + -- Autocompletion local cmp_plugin = { 'hrsh7th/nvim-cmp', @@ -25,8 +27,8 @@ table.insert(Plugins, cmp_plugin) table.insert(Plugins, { 'aspeddro/cmp-pandoc.nvim', - enabled = false, - event = 'InsertEnter', + enabled = true, + -- event = 'InsertEnter', ft = {'markdown', 'pandoc', 'rmd'}, dependencies = { 'nvim-lua/plenary.nvim', @@ -39,7 +41,7 @@ table.insert(Plugins, { } }) -function cmp_plugin.config() +cmp_plugin.config = function() user.augroup = vim.api.nvim_create_augroup('compe_cmds', {clear = true}) vim.api.nvim_create_user_command('UserCmpEnable', user.enable_cmd, {}) @@ -80,21 +82,22 @@ function cmp_plugin.config() zindex = 50, } }, - -- formatting = { - -- fields = {'menu', 'abbr', 'kind'}, - -- format = function(entry, item) - -- local menu_icon = { - -- nvim_lsp = 'λ', - -- luasnip = '⋗', - -- buffer = 'Ω', - -- path = '🖫', - -- nvim_lua = 'Π', - -- } - -- - -- item.menu = menu_icon[entry.source.name] - -- return item - -- end, - -- }, + formatting = { + fields = {'menu', 'abbr', 'kind'}, + format = function(entry, item) + local menu = { + nvim_lsp = '[LSP]', + luasnip = '[Snip]', + buffer = '[Buffer]', + path = '[Path]', + nvim_lua = '[Lua]', + cmp_pandoc = '[Pandoc]' + } + + item.menu = menu[entry.source.name] + return item + end, + }, mapping = { [''] = cmp.mapping.scroll_docs(-5), [''] = cmp.mapping.scroll_docs(5), -- cgit v1.2.3