What prefix keys are allowable in tmux

tmux

Lots of people modify their tmux prefix keys. Usually it's Control+something. But surely other things are possible.

I tried, for example, ,t, but on starting tmux, I got the error bad key: ,t.

So what are the rules? What prefixes are allowed in tmux?

Best Answer

It needs to be a single “key stroke”.

The basic set of recognized keys includes

  • the ASCII characters (including the C0 control characters),
  • the function keys: F1F20,
  • the movement keys: Up, Down, Left, Right, Home, End, PageUp, PageDown,
  • the editing keys: IC (Insert), DC (Delete), and
  • the keypad keys: KP/, KP*, KP-, KP+, KP., KPEnter, KP0KP9.

Not all terminals support sending unique sequences for all those keys; also, not all of those keys are described in every terminfo entry (indicated by the TERM environment variable when attaching to a tmux session). So, some of them might not be available in your particular setup.

If an Escape character precedes the sequence for one of the above keys, then it will be treated as a Meta modifier. This is represented as a M- prefix when naming the key (e.g. M-F1).

tmux also recognizes some special sequences that xterm can send when Shift, Control, and Meta are used with most of the non-ASCII keys (e.g. S-C-M-Up), but many terminals do not generate these sequences (or only support a limited set of modifiers for just the arrow keys).

Related Question