vim-pandoc-legacy icon indicating copy to clipboard operation
vim-pandoc-legacy copied to clipboard

support for zotero

Open dsanson opened this issue 13 years ago • 8 comments

I've started a "zotero" branch. So far, it implements citekey completion from zotero, relying on pygnotero. This remains half-baked, because there is currently no easy way to get zotero to provide a bibliographical database containing these citekeys in any of the formats supported by citeproc-hs.

So real support will have to wait until the zotero apis are improved. But ultimately, I'd like to support completion both from a local zotero database and from zotero.org, and sucking the database both from a local zotero instance and from zotero.org.

dsanson avatar Sep 03 '11 15:09 dsanson

I've been thinking about this, and we could make it so adding something like "@zotero" to g:pandoc_bibfiles would make completion use zotero as a source (the same could be done with the citekeys dictionary, btw).

fmoralesc avatar Sep 10 '11 20:09 fmoralesc

Zotero support has to remain mothballed at the moment, since they say they are working on improving the API, and right now there is no reliable way to get the database out in a format the citeproc-hs can process.

(There is a neat project, zotero-plain, that aims to provide support for zotero + citeproc-js in RST documents.)

Eventually, Zotero support will require (when using local zotero) a user supplied directory to a zotero folder. That could be done via something like "@zotero:/path/to/zotero/data" in g:pandoc_bibfiles, I suppose. Using the zotero.org server will require some other settings.

dsanson avatar Sep 11 '11 15:09 dsanson

This would be a very nice feature to have. In the meantime I share my manual procedure in case someone finds it useful:

  1. In Zotero: Actions -> Export Library -> Format: BibTex
  2. Then in a terminal:
grep '@[a-z]*{.*,' zotero.bib | sed 's/@.*{\(.*\),/\1/g' > zotero.dict
  1. In .vim/ftplugin/:
" bibtex keys
set dictionary=$HOME/.citations/zotero.dict

" also scan dictionary files
set complete=.,w,b,u,t,k,i

" add dash and underscore as letter of words in dictionaries
set iskeyword=@,48-57,-,_,*,:,192-255

ivotron avatar Sep 23 '11 04:09 ivotron

Thanks for the tip. If you put the dict file (or a symlink to the dict file) at

~/.pandoc/citationkeys.dict

then vim-pandoc will add it to your dictionary automatically, and you can use it with dictionary completion (CTRL-X CTRL-K). But we don't set iskeyword. Maybe we should?

But if you are using vim-pandoc, you can just use the bibtex file directly, rather than harvesting the keys into a dict file. Either put the exported bibtex file somewhere the bundle can find it (:help pandoc-bibfiles for details), or specify where it is in your .vimrc:

let g:pandoc_bibfiles = ['/the/path/to/your/bibtex/file.bib']

Then, instead of dictionary completion, use omnicompletion (CTRL-X CTRL-O), and we've got a completion function that will search through the bibtex file, returning a popup with citekey, author - title.

If you have bibtool installed, you can

let g:pandoc_use_bibtool = 1

and the completion function will search for matching author and title, not just citekey...

:help pandoc-citation-completion has all the details :-)

dsanson avatar Sep 23 '11 17:09 dsanson

Some progress on this front. According to this post, the API now supports getting citeproc JSON. So it should just be a matter of scanning the file for citekeys, asking Zotero to provide a citeproc JSON bibliography for those entries, and passing that on to pandoc. But it may be that zotero-plain will implement a robust solution that we can piggy-back on.

dsanson avatar Dec 07 '11 21:12 dsanson

Any news regarding this one? Or a vim-zotero plugin? This would be great..

dorvak avatar Aug 16 '13 08:08 dorvak

It would be great, indeed. I've started a topic on Zotero forums on suport for plain text files... But no one manifested a will to develop such a tool... https://forums.zotero.org/discussion/29413/integration-with-plain-text-editors-multimarkdown-composer/

danilomm avatar Dec 26 '13 03:12 danilomm

I think now a separate plugin is best. However, we should provide ways to hook it (and other possible bibliographic sources) with our auto completion functionality.

I'll be out of reach for the next two weeks, but I'll be thinking about this.

fmoralesc avatar Dec 26 '13 09:12 fmoralesc