nvim-cmp source providing bespoke support for Vimtex's omnifunc.
Check out the tutorial for an in-depth explanation of the plugin's functionality.
Provides support for:
\cite{
(normally, it has to be done manually).Install the plugin through your plugin manager:
require("lazy").setup({
"micangl/cmp-vimtex",
})
Add cmp-vimtex as a completion source:
require('cmp').setup({
sources = {
{ name = 'vimtex', },
},
})
If you're manually specifying a custom format
function (this doesn't apply to lspkind.nvim), make sure not to overwrite cmp-vimtex
's additional information:
format = function(entry, vim_item)
vim_item.menu = ({
-- Use this line if you wish to add a specific kind for cmp-vimtex:
--vimtex = "[Vimtex]" .. (vim_item.menu ~= nil and vim_item.menu or ""),
vimtex = vim_item.menu,
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
})[entry.source.name]
return vim_item
end
Eventually, apply your configuration (note:this is not necessary unless you want to apply a custom configuration):
require('cmp_vimtex').setup({
-- Eventual options can be specified here.
-- Check out the tutorial for further details.
})
This is covered in the tutorial.
This plugin is based on @hrsh7th's cmp-omni. The timer implementation has been taken from cmp-buffer. The bibtex parser is a lua rewrite of Vimtex's integrated parser, which has also been adapted for asynchronous execution.
I'd like to thank @lervag for all the help provided when developing this plugin.