5

After reading the man zathurarc for the map command, I still don't know how to remap an existing keybinding. By "remapping", I mean replacing a current keymapping for a given action.

Problem:

<C-Button1> (Control + click) is currently mapped to the synctex backward search, with the following settings in my zathurarc config file:

set dbus-service true # Already the default
set synctex true      # Already the default
set synctex-editor-command "gvim --servername GVIMTEX --remote +%{line} %{input}"

However, I don't like using the mouse, so I want to map the synctex action to, say <C-s>.

Trials

I tried the following line in my zathurarc:

map <C-s> feedkeys "<C-Button1>"

It doesn't work and shows "open n1>" in the inputbar.

Alternative ideas

I could also map <C-s> to the shortcut_function for synctex, if only I knew what it was...

Complains

I find that there is too few information in the zathura documentation. For example I would like to know:

  1. how to list all current key bindings (that would help not to override current mappings...)
  2. how to use the feedkeys function, because it is nowhere in my documentation, and I don't know from which version it was available (I have Ubuntu 16.04 and zathura 0.3.5).
  3. what is the shortcut_function used for synctex. Is there one?

Could anyone show me how to use <C-s> instead of <C-Button1>?

1

A bit late to the party, but using xdotool to do the ctrl click did the job for me. I wrote this short bash script (also found here zathura_backward_search.sh):

#!/bin/bash

ACTIVEWINDOW=$(xdotool getactivewindow)
eval $(xdotool getwindowgeometry --shell $ACTIVEWINDOW)

HALF_WIDTH="$(($WIDTH / 2 + 10))"
HALF_HEIGHT="$(($HEIGHT / 2))"

xdotool mousemove --window $ACTIVEWINDOW $HALF_WIDTH $HALF_HEIGHT keydown ctrl click 1 keyup ctrl

Place this on your path, chmod +x it, and execute it in zathura using :exec zathura_backward_search.sh. Alternatively you can map <C-s> to this script using map <C-s> exec ctrl_click_center_window.sh in your zathurarc. It is a bit slow (and could probably be made faster), but works nonetheless.

| improve this answer | |
  • 2
    The github gist appears to have your name in it; could you claim or disclaim ownership of the code there? Thank you! – Jeff Schaller May 4 at 19:19
  • How can I do that? It is my code, yes, I wrote it yesterday while searching for a solution for this. I am new to stackexchange (having a profile and posting that is, not to getting help). Is there some way I can link my github profile? – halvarsu May 5 at 11:08
  • Simply say something like "I wrote this code on github..." with the link. Thank you for including the actual code in your post, to avoid being deleted as a link-only answer. Welcome to U&L! – Jeff Schaller May 5 at 12:55
  • Sure, will do that in the future:) Thanks! – halvarsu May 6 at 12:20

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.