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

Configuration of zot: link handler #57

Closed
jabirali opened this issue Mar 16, 2020 · 4 comments
Closed

Configuration of zot: link handler #57

jabirali opened this issue Mar 16, 2020 · 4 comments

Comments

@jabirali
Copy link

Currently, the handler for zot: links (Zotero) assumes that:

  1. The search tool binary is named fd;
  2. The Zotero folder is ~/.local/zotero.

The first is e.g. not the case on Ubuntu, where the binary is named fdfind to prevent name collision with a different fd tool. The second is not actually the default location of the Zotero directory (on my system it defaults to ~/Zotero if I install Zotero manually, and ~/snap/zotero-snap/common/Zotero if I install it via snap, so any other choice like ~/.local/zotero has to be configured manually.) Ideally, there should be config options for these: e.g. g:wiki_find_tool and g:wiki_zotero_root.

If these requirements are not met, trying to follow a zot: link in wiki.vim also fails silently. I think it could be useful with an error message in that case, so the user notices that e.g. fd is missing.

@lervag lervag closed this as completed in bb59cb9 Mar 16, 2020
@lervag
Copy link
Owner

lervag commented Mar 16, 2020

Thanks for the suggestions. I've added support for fdfind and also find as a fallback. I try to avoid options if possible, so I'll not add he g:wiki_find_tool option for now.

I've added the g:wiki_zotero_root option with default setting ~/.local/zotero. The scheme handler should now give a more detailed error message if it fails. It will also display a menu if more than one match is found. This is also useful as a feature to e.g. find papers by a given first author (e.g. I can use zot:lervag to easily list all my publication where I'm first author and choose which to open).

@jabirali
Copy link
Author

I try to avoid options if possible

Sensible design policy :)

I've added the g:wiki_zotero_root option with default setting ~/.local/zotero. The scheme handler should now give a more detailed error message if it fails.

Just tested it, and this now works as expected. I get a useful error message if I don't configure the path, while it works fine (via fdfind) if I set the new config option g:wiki_zotero_root.

It will also display a menu if more than one match is found.

Cool! Are you considering integrating this feature with the omni-completion as well? I.e., so one can complete references to papers the same way one completes references to other wiki notes?

@lervag
Copy link
Owner

lervag commented Mar 17, 2020

Cool! Are you considering integrating this feature with the omni-completion as well? I.e., so one can complete references to papers the same way one completes references to other wiki notes?

Good idea. Initial support is already added.

@lervag
Copy link
Owner

lervag commented Mar 17, 2020

Feel free to open a new issue if you have further ideas or issues with the completion feature.

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

No branches or pull requests

2 participants