tmux send-keys syntax

On the tmux man page I found no reference to how it names keys.

For example, to send ctrl + r to tmux you would do:

tmux send-keys C-r

and to send the esc key you do

tmux send-keys Escape

Is there a list which maps keyboard keys to how tmux sendkeys expects you to name them? I have a feeling that I missed a memo that its using some-long-forgotten-program's syntax for convenience.

Note, this is nothing to do with key bindings.


Solution 1:

The key names used by send-keys are the same ones that bind-key uses.
From the Key Bindings section of the tmux manpage:

When specifying keys, most represent themselves (for example ‘A’ to ‘Z’). Ctrl keys may be prefixed with ‘C-’ or ‘^’, and Alt (meta) with ‘M-’. In addition, the following special key names are accepted: Up, Down, Left, Right, BSpace, BTab, DC (Delete), End, Enter, Escape, F1 to F20, Home, IC (Insert), NPage/PageDown/PgDn, PPage/PageUp/PgUp, Space, and Tab.

Although they are not listed in the man page, there are also special names for keypad-specific keys: KP0 through KP9, KP/, KP*, KP-, KP+, KP., and KPEnter.

Several of the more cryptic key names (BTab, IC, DC, NPage, PPage) probably come from the terminfo library.

Emacs shares the convention of using C- and M- prefixes to indicate modifiers (I would not be surprised if there were earlier uses of this convention).