tmux-keybtest is a utility for identifying which key sequences tmux can
detect in your terminal. When you press a key, its tmux name, like C-M-Up
,
will be displayed on the status line if recognized.
Terminals are often rather limited in what keys they implement supported beyond the basics.
In some cases missing keys can be configured, but especially on tablets this is usually fairly limited.
Terminals can sometimes misinterpret key presses, generating the wrong sequence or nothing at all. tmux-keybtest helps you evaluate which keys are available in your current terminal and can assist in selecting a terminal with better support for key sequences.
Note: If your operating system or terminal has already bound certain keys, tmux may not detect them. It may be possible to reconfigure your system or terminal to free up these keys for tmux use.
- Clone this repository and navigate to its directory.
- Run
keybtest.sh
this generates akeybtest.conf
for the version of tmux found and starts a tmux session that will display the tmux notation for any recognized key press.
- Some keys might not send the intended sequence, causing tmux to interpret them differently.
- Avoid running this script inside an existing tmux session, as this may interfere with key detection.
- To exit the session, press
C-x C-c
. The exit sequence is displayed in the status line for convenience.
S-
: Shift key is pressed.C-
: Control key is pressed.M-
: Alt (Meta) key is pressed.
Use the key names displayed to customize your tmux.conf
according to your
terminal's capabilities.
- Shifted regular keys are not tested. Instead of binding
S-a
orS-A
, useA
.
- Prior to 3.5 - Cannot be bound:
~ $ % & * { } | "
- Prior to 3.3 - Cannot be bound:
` /
- Prior to 3.0 - Cannot be bound:
;
- Case is ignored: Binding
C-A
afterC-a
will overrideC-a
, so only lowercase is bound. - Keys skipped due to collision:
C-i
is the same asTab
C-m
is the same asEnter
C-[
is the same asEscape
- Regular keys not tested, same as with
S-
.
- Regular keys not tested, same as with
S-
.
- Same limitations as under
C-
- Case is ignored: Binding
C-M-A
afterC-M-a
will overrideC-M-a
, so only lowercase is bound.
- Same limitations as under
C-
- No lowercase keys are bound due to the use of Shift.
- Insert is referred to as
IC
and Delete asDC
in tmux. If you see these, the terminal is functioning correctly. - If a key generates an unrecognized code, the terminal might beep. Consider muting your sound before running this in public spaces.
- Unrecognized keys will be printed. Please submit such outputs as an issue, including the key/sequence and, if possible, your keyboard type.
If a terminal generates a sequence that tmux recognizes but is not the
intended one (e.g., M-Up
generates S-F3
), bind the desired action for M-Up
to S-F3
.
If a terminal generates an unrecognized but unique sequence, you can bind it
to an action using user-keys. Tmux requires octal notation for user-keys,
formatted as three digit values (0 padded) and prefixed with \
.
showkey -a
can be used to find the octals, examine the middle column.
Example:
set -g user-keys[200] "\302\247"
bind -n User200 send Escape
Be aware that the send Escape
in this case is only sent to apps running inside tmux.
It is not picked up by tmux itself. For that User200
must be used.
This is probably amongst the least intuitive features in tmux
- assign a key (sequence) using
user-key[200]
- when using it inside tmux refer to it as
User200
To determine what sequence a key generates, use the following commands outside of tmux:
showkeys -a
xxd