This is a hacked up and simplified version of cmp-pandoc. I've removed support for bibtex files, and only support json files. I've also removed support for detecting the bibliography in the YAML front matter. The bibliography is set globally using the setup function instead. I've also (temporarily) removed support for cross-reference completion.
require'cmp_pandoc'.setup({
filetypes = { "pandoc", "markdown", "rmd", 'markdown.pandoc', 'markdown.pandoc.carnap' },
bibliography = {
path = '/Users/desanso/Documents/zotero.json',
documentation = true,
},
})Pandoc source for nvim-cmp
Neovim >= 0.5.0plenary.nvim
- Multiple bibliography files
- Support pandoc-crossref
- Equation preview with
nabla.nvim
use {
'aspeddro/cmp-pandoc.nvim',
requires = {
'nvim-lua/plenary.nvim',
'jbyuki/nabla.nvim' -- optional
}
}Plug 'nvim-lua/plenary.nvim'
Plug 'jbyuki/nabla.nvim' "optional
Plug 'aspeddro/cmp-pandoc.nvim'require'cmp'.setup{
sources = {
{ name = 'cmp_pandoc' }
}
}
require'cmp_pandoc'.setup()Following are the default config for the setup(). If you want to override, just modify the option that you want then it will be merged with the default config.
{
-- What types of files cmp-pandoc works.
-- 'pandoc', 'markdown' and 'rmd' (Rmarkdown)
-- @type: table of string
filetypes = { "pandoc", "markdown", "rmd" },
-- Customize bib documentation
bibliography = {
-- Enable bibliography documentation
-- @type: boolean
documentation = true,
-- Fields to show in documentation
-- @type: table of string
fields = { "type", "title", "author", "year" },
},
-- Crossref
crossref = {
-- Enable documetation
-- @type: boolean
documentation = true,
-- Use nabla.nvim to render LaTeX equation to ASCII
-- @type: boolean
enable_nabla = false,
}
}Add bibliography file on YAML Header
---
bibliography: path/to/references.bib
---Multiple bibliography files:
---
bibliography:
- path/to/references.bib
- path/to/other/references.bib
---A YAML metadata block is a valid YAML object, delimited by a line of three hyphens
---at the top and a line of three hyphens---or three dots...at the bottom. A YAML metadata block may occur anywhere in the document, but if it is not at the beginning, it must be preceded by a blank line. Pandoc.org
More details, see pandoc-crossref
-
YAML metadata inside code blocks with
bibliographyfield enablecmp-pandoc. The parser does not check if it is inside a fenced code block. -
Pandoc crossref support a couple options to add code block labels, but only the following style is supported:
```haskell main :: IO () main = putStrLn "Hello World!" ``` : Listing caption {#lst:code}

