2

I take notes in markdown files which I sometimes convert to other documents with pandoc. With the --bibliography=bibliography.bib argument, pandoc recognizes the @key citation format in markdown and adds the corresponding bibliographical reference at the end of the document. I would like to use some autocomplete menu to insert those citations based on the keys available in the bib file.

The vimtex plugin autocompletes citations based on a bibtex file. Would it be possible to do the same in markdown files?

0
2

I hope it's OK to answer my question once again, the answer is easy once you know about the existence of the vim-pandoc plugin, but somehow I couldn't find it directly . I use Vundle to install plugins, added the following to my .vimrc:

" Markdown citation and syntax
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'
" Disable folding of vim-pandoc plugin
let g:pandoc#modules#disabled = ["folding"]

Mention a bibliography file in the yaml front matter of the markdown file :

---
title: Reading notes
author: Author Name
bibliography: /path/to/references.bib
abstract: Reading notes with references
---

Then the vim-pandoc plugin can autocomplete @key... references with CTRL X CTRL O based on the keys in the bibliography.

It can look for the bibliography in other places and retrieve suggestions that match in any field using the bibtool program, see :help vim-pandoc-bibliographies-module.

4
  • 1
    Paul, it is absolutely ok to answer your own question. You can even accept your own answer, but only after 48 hours (maybe someone comes around with a better answer).
    – Ralf
    Jun 27 '20 at 5:48
  • I have been trying to use vim-pandoc for this, but I get 'Omni completion (^O^N^P) Pattern not found' errors. Did you have to do anything else to get it working?
    – twsh
    Oct 26 '20 at 19:57
  • @twsh this error message is probably because vim cannot find your bibliography. Try a few differnt ways to specify the bibliography mentioned in :help vim-pandoc-bibliographies-module.. If it still doesn't work, try to make a minimal vimrc that loads only vim-pandoc and ask a new question. Copy and paste your minimal .vimrc and minimal bibliography in the question so others can reproduce your error and help you. Oct 27 '20 at 11:24
  • @PaulRougieux It turns out that things are stranger than it simply not working. I asked a question here: vi.stackexchange.com/questions/27809/…
    – twsh
    Oct 27 '20 at 11:51

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .