I'd like to be able to map emacs keys (like C-v/M-v) for scrolling in tmux instead of default PgUp/PgDown, is that possible? Can't see that from the manual at the moment (apologies if its there, seems like a such a natural thing considering the rest of the emacs-like navigation key bindings tmux uses)
- 481
1 Answers
By default, the emacs-copy key binding table has all of C-v, Page Down (NPage), and Space bound to page-down as well as both M-v and Page Up (PPage) bound to page-up.
You can check your bindings with tmux list-keys -t emacs-copy | grep -i page.
If these bindings are missing you can reestablish them by hand (e.g. in your ~/.tmux.conf):
bind-key -t emacs-copy C-v page-down
bind-key -t emacs-copy M-v page-up
But since these are the default, you will need to track down where they are being changed/removed before you will know where to put the above commands to make them effective (they will need to come after whatever else is modifying the bindings).
Are you sure your mode-keys option is set to emacs? It does default to emacs, but tmux will set it to vi (along with status-keys) if you have the VISUAL environment variable set and its value has vi in it†, or if you do not have VISUAL set but do have EDITOR set and its value has vi in it.
You can check your global mode-keys value with tmux show-options -g -w | grep mode-keys. You may also have a per-window mode-keys value (omit the -g to check its value; you may use -t to target another window if you can not run the command in the window itself).
If you want to override the “auto-detection” and always use the emacs binding tables, then you can put these lines in your ~/.tmux.conf:
set-option -g status-keys emacs
set-option -gw mode-keys emacs
† The “has vi in it” test is actually more like “vi occurs after the last / (or anywhere if there / does not occur in the value)”. This means that a value like /opt/vital/bin/emacs will not count as vi (despite the vi in vital).
- 42,029