Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for zotero #14

Open
dsanson opened this issue Sep 3, 2011 · 8 comments
Open

support for zotero #14

dsanson opened this issue Sep 3, 2011 · 8 comments

Comments

@dsanson
Copy link

dsanson commented Sep 3, 2011

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.

@fmoralesc
Copy link
Member

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).

@dsanson
Copy link
Author

dsanson commented Sep 11, 2011

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.

@ivotron
Copy link

ivotron commented Sep 23, 2011

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

@dsanson
Copy link
Author

dsanson commented Sep 23, 2011

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
Copy link
Author

dsanson commented Dec 7, 2011

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.

@dorvak
Copy link

dorvak commented Aug 16, 2013

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

@danilomm
Copy link

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/

@fmoralesc
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants