Yes, via nvim_cmp
configuration formatting.format
like so
local cmp = require("cmp")
cmp.setup({
formatting = {
format = function(entry, vim_item)
vim_item.menu = entry.source.name
return vim_item
end,
}, -- formatting
-- rest of configuration for nvim-cmp
})
If you want to combine with other formatting functions like lspkind
(which adds symbols ) you can:
local lspkind = require("lspkind")
local lspkind = require("lspkind")
local lspkind_cmp_format = lspkind.cmp_format({})
cmp.setup({
formatting = {
format = function(entry, vim_item)
vim_item.menu = entry.source.name
kreturn lspkind.cmp_format({})(entry, vim_item)
end,
}, -- formatting
-- rest of configuration for nvim-cmp
})