nvim: migrate cmp to custom menu

This commit is contained in:
PowerUser64 2021-10-14 03:37:07 -07:00
parent 88f39be97d
commit fda0750475

View file

@ -134,15 +134,15 @@ M.cmp = function()
select = false, select = false,
}, },
['<Tab>'] = function(fallback) ['<Tab>'] = function(fallback)
if vim.fn.pumvisible() == 1 then if cmp.visible() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n') cmp.select_next_item()
else else
fallback() fallback()
end end
end, end,
['<S-Tab>'] = function(fallback) ['<S-Tab>'] = function(fallback)
if vim.fn.pumvisible() == 1 then if cmp.visible() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n') cmp.select_prev_item()
else else
fallback() fallback()
end end
@ -164,13 +164,13 @@ M.cmp = function()
vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. " " .. vim_item.kind vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. " " .. vim_item.kind
-- set a name for each source -- set a name for each source
vim_item.menu = ({ vim_item.menu = ({
path = "(Path)", path = "[Path]",
buffer = "(Buffer)", buffer = "[Buffer]",
calc = "(Calc)", calc = "[Calc]",
nvim_lsp = "(LSP)", nvim_lsp = "[LSP]",
nvim_lua = "(Lua)", nvim_lua = "[Lua]",
spell = "(Spell)", spell = "[Spell]",
treesitter = "(TS)", treesitter = "[TS]",
})[entry.source.name] })[entry.source.name]
return vim_item return vim_item
end, end,