How can you assign keys in tmux without Ctrl-b first?
tmux has several key-binding tables, as documented in man tmux
under "bind-key". There are several default tables:
- The
root
table is where the prefix key itself is bound. - The
prefix
table is used after the prefix is pressed, and is the one your usual keybindings go. - The
copy-mode
table is used in copy mode if mode-keys is set to "emacs". - The
copy-mode-vi
table is used in copy mode if mode-keys is set to "vi".
If you want to bind without the prefix key, use the -n
or -T root
option to bind-key.
Esc might behave slightly weird, as the terminal codes for nearly all special keys (Alt+keys, function keys, arrow keys, etc) also begin with exactly the same Esc. Programs like Vim use a timer to distinguish the two. You may need to lower the escape-time parameter in tmux.