This document serves as a guide for the workflow to add/modify cmp
sources
vim_item.menu
in format
function of nvim-cmp
setup function. As an example, to add foo_src
source:-- lua/plugins/nvim-cmp.lua
--- ....
vim_item.menu = ({
buffer = "[Buffer]",
foo_src = "[Foo]"
})[entry.source.name]
--- ....
M.sources
map in
plugins/nvim-cmp-sources.lua
and for basic source
registration, use M._register
function with the source name-- lua/plugins/nvim-cmp-sources.lua
--example
M.sources["foo/bar"] = {
M._register("foo_src")
}
You can add more instructions if needed in the M.source[<src-name>]
function
if needed.
cmp_sources
list of plugins.lua
file.M.sources
map of
plugins/nvim-cmp-sources.lua
are called by Packer's
config
function.cmp_sources
list of plugins.lua
file
share a common package setup
function. Essentially, the setup function
ensures packer loads the logging and cmp package. If you need
further customization, you need to add it outside of cmp_sources
list;
refer to how tzachar/cmp-tabnine
source is added for an example.run
in Packer's use
function, you
have to define it out of cmp_sources
list. refer to how
tzachar/cmp-tabnine
source is added for an example.M._register(<source-name>)
function :
cmp
config.