Open artkpv opened 4 months ago
It doesn't work on my side either. Please, update the plugin and put let zotcite_wait_attachment = 1
in your vimrc
.
After that, I can see the following error message:
Error running `xdg-open "zotero://open-pdf/library/items/GWCTFLHS"`: $(realpath: -c: line 2: unexpected EOF while looking for matching `)'
I installed Zotero manually. This should be the reason why xdg-open
doesn't know what to do with zotero://
.
I edited my zotero.desktop
file and replaced
Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U"
with
Exec=/path_to/zotero -url %U"
and now I can replicate the issue as you reported. Maybe the ZotFile
extension is required (see https://forums.zotero.org/discussion/73776/create-external-link-to-open-pdf-within-zotero), but it's installed here...
This feature was introduced by @jasonccox
@jalvesaq I can open attachments by pressing <leader>zo
for pdfs, htmls. The issue is about openning an item inside the Zotero program which means a record there that contains biblio info, links to PDFs, or PDFs themselves, etc. When I place a cursor inside my vim buffer on a @some_id_author_year
and press Enter key then the zotero window appears but it does not focus the item inside Zotero. Hope it is clear now what's the issue.
I've tried let zotcite_wait_attachment = 1
it doesn't show anything
Same bug here. I don't know how to fix it.
Chiming in as the original author of this feature. I don't have Zotero installed anymore, so I can't do much debugging right now, but I'd guess that the issue is related to the logic to build the zotero://
URL: https://github.com/jalvesaq/zotcite/blob/4f1d669e704900ced262a03ea4325dc94bc72b04/autoload/zotcite.vim#L251. I don't recall how I figured out how to construct that URL, and I'm not finding any documentation on those URLs from a quick search either.
Thanks, @jasonccox!
When we can't find anything on the web, we have to look at the source code. I downloaded Zotero from Git Hub and used grep
to search the string "open.*pdf". Part of the output was:
chrome/content/zotero/ZoteroProtocolHandler.jsm: * zotero://open-pdf/library/items/[itemKey]?page=[page]
chrome/content/zotero/ZoteroProtocolHandler.jsm: * zotero://open-pdf/groups/[groupID]/items/[itemKey]?page=[page]
chrome/content/zotero/ZoteroProtocolHandler.jsm: * zotero://open-pdf/[libraryID]_[key]/[page]
The first line has the command that we are already using, but it doesn't work.
Looking at the code, I found:
whose part of the diff is:
- uriPath = uriPath.substr('//open-pdf/'.length);
- var mimeType, content = '';
+ uriPath = uriPath.replace(/^\/\/open(-pdf)?\//, '');
And in Zotero, clicking on "Help / Debug Output Logging / View Output", I find:
[JavaScript Error: "URIError: malformed URI sequence" {file: "resource://gre/modules/osfile/ospath_unix.jsm" line: 188}]
This is the end of my research, and I still don't know how to fix the bug.
Perhaps, someone will find a solution. I will wait a few days before removing the option zotcite_open_in_zotero
.
I also experience the issues pointed out here. I notice though that the @ZoteroKey#
's are different for a parent and child Item. Using the ZotFile plugin to get the keys for each (ie directly in zotero itself right clicking and selecting "copy select item links" https://forums.zotero.org/discussion/comment/317284/#Comment_317284, I notice that I get two different ones for the citation and the pdf itself.
So when I do: xdg-open "zotero://open-pdf/library/items/NMPZXK65"
generated from the original @ZoteroKey#
zotero opens but no pdf opens but when I do xdg-open "zotero://open-pdf/library/items/C892Q6IM"
generated from the pdf itself then the pdf opens.
How are the URI's made? Based on the original @ZoteroKey#
or by the key associated with the pdf.
Here's a snippet from the sqlite database
{"key":"MSNST3S9","version":1571,"parentItem":"C892Q6IM","itemType"
In the above snippet both MSNST3S9
and C892Q6IM
work to open the pdf.
Would you be able to make a pull request fixing this issue?
I can, I just noticed though that if I set in config open_in_zotero = true
and then press <leader>zo
I can get it to work and the ID used for the URI is correct, this is referring to the lines here:
Here's an example:
@9IQRHJF2#Remedios_Logothetis_Kayser-2014 IP2MW2MU
Then I'm a bit confused about where the logic is failing in this, since enter
for me is not doing anything anymore since moving the merge from lua to master.
My guess is that this commit caused the problem:
https://github.com/zotero/zotero/commit/a7d59a90d37695e4eaa0e42d9e2301b049d0a0e7
Hi @jalvesaq! Thank you for the tool. How to open an item (book, article, etc.) in Zotero from a zotero link in my vim buffer? I place my cursor at the
@<somelinkhere>
and press Enter. It opens Zotero but doesn't focus on the item I expect. While other features are working like open attachment, get biblio info etc.:Zinfo
: