9

zathura is my default PDF reader. Some files cause it trouble though, and in such cases I run

:exec acroread $FILE

which automatically opens the same file with Acrobat Reader.

How do I add a key shortcut to the zathura configuration file (~/.config/zathura/zathurarc) to do that?

  • 1
    @FelixBou $FILE is the only substring that's treated specially. (It's here in the source.) – Anko Sep 1 '14 at 21:48
7

I recently bumped against a similar problem and, for future reference, here is a workaround:

map <C-o> focus_inputbar ":exec acroread $FILE"

This will map ctrl+o (or whichever your key is) to open the input bar you would normally open with : and input there that text. You can then press Enter to launch the command. This is far from ideal and still requires a two-key press, but surely faster than writing all the command by hand.

  • Is there something like $FILE or % in zathura which brings back the directory (not the filename)? – SdidS May 21 '18 at 9:31
  • @SdidS not to my knowledge, but the zathura documentation is quite lacking (they also have an open issue regarding this here: gitlab). Anyway: everything after exec is executed by zathura so you could probably try to pass the filename to a script that will then extract the folder from the $FILE and do what you need it to do. If you need something more specific I suggest trying to open an issue on the gitlab I linked above. – CarloDePieri May 22 '18 at 13:30
  • @CarloDePieri, Thanks I've asked it here and came up with the same solution as you said. – SdidS May 22 '18 at 19:44
6

A slight improvement on the answer offered by CarloDePieri might be this:

map <C-o> feedkeys ":exec acroread $FILE<Return>"

This avoids the second keypress.

3

I agree that would be seriously useful, but you can't currently do this.

In the source code, the input-bar exec command mapping is here in config.c. However, the shortcut mappings (starting here) which seem to define what functions can be referred to from the configs don't mention exec. The code isn't structured to easily mix "command" functions and "shortcut" functions yet...

The developers have a page with methods to contact them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.