A source for nvim-cmp, providing completion for bibliography, reference and cross-ref items.
Note I have overridden the ItemKinds
, they are set to cmp.lsp.CompletionItemKind.Reference
by default.
Assuming Packer:
use({
"hrsh7th/nvim-cmp",
requires = {
{ "jc-doyle/cmp-pandoc-references" }
}
})
Add the source:
require('cmp').setup {
sources = {
{ name = 'pandoc_references' }
}
}
This source parses and validates the bibliography: [your/bib/location.bib]
YAML metadata field, to determine the destination of the file (see Pandoc). If it is not included (or you specify it through a command-line argument), no bibliography completion items will be found.
(I use the metadata block to reference bibliographies, if you'd like automatic scanning of directories/sub-directories, feel free to submit a PR)