cmp-pandoc-references
cmp-pandoc-references copied to clipboard
A source for nvim-cmp, providing completion for bibliography, reference and cross-ref items in Pandoc/Markdown.
cmp-pandoc-references
A source for nvim-cmp, providing completion for bibliography, reference and cross-ref items.
Demo

Note I have overridden the ItemKinds, they are set to cmp.lsp.CompletionItemKind.Reference by default.
Installation & Usage
Assuming Packer:
use({
"hrsh7th/nvim-cmp",
requires = {
{ "jc-doyle/cmp-pandoc-references" }
}
})
Add the source:
require('cmp').setup {
sources = {
{ name = 'pandoc_references' }
}
}
Explanation & Limitations
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)