How do I bind the tmux prefix key to C-'?
Most terminal emulators only generate special output for a restricted set keys when used in combination with the Control modifier key. The apostrophe key is one of the keys that does not generate any special output sequence (it ether does nothing or just outputs a regular apostrophe).
See Wikipedia’s “ASCII control characters” and “How control characters map to keyboards”.
You can check to see if your terminal emulator generates any output for Control-'
, by typing it into cat -v
, or at a shell prompt (in most common shells) after typing a Control-V.
If it does generate some special output (not just '
), then you might be able to bind it in tmux if the control code/sequence is known to tmux. The list of keys names that tmux recognizes is in its manpage under the “Key Bindings” section. tmux will only recognize special keys if the terminfo entry for your TERM outside of tmux defines them (see man terminfo
for the “capability” names and infocmp
for the ones your TERM defines); if needed, you can extend your system’s terminfo entry just for tmux with its terminal-overrides
configuration variable (or recompile your own custom entry with tic
).
If it does not generate any special output then you would have to somehow reconfigure it to do so (if that is possible); you might have it generate the same code as ^]
, or the sequence for “F20” (if it is defined in your TERM’s entry when outside tmux).