I've got some trouble when setting my preferred tmux hotkey on Mac OS X.
The most common hotkeys that invokes tmux's magics are CTRL+A and CTRL+B. But I would rather select other keystrokes for the following reasons: C-a is the global hot key for "jumping to the beginning of a line"; C-b is for "moving backward on a line" and "Page UP in Vim". I don't want to break these nice rules in tmux.
So, I try to set some non-so-frequently-used keystrokes for tmux hotkey. What I choose is CTRL-, , CTRL-., or CTRL-;
I write this statement in my .tmux.conf file:
set-option -g prefix C-,
I start tmux. Oh, it says "bad key". I replace C-, with C-. or C-;. It doesn't work either.
So, how can I set tmux hotkey to CTRL-,?
Using xterm terminal
1) put these in your ~/.Xresources
to generate escape sequence of F13 when CTRL-,, CTRL-. or CTRL-; is pressed
XTerm.VT100.translations: #override \
Ctrl<Key>period: string(0x1b) string("[1;2P") \n\
Ctrl<Key>comma: string(0x1b) string("[1;2P") \n\
Ctrl<Key>semicolon: string(0x1b) string("[1;2P")
run xrdb ~/.Xresources
to load these conf.
2) change prefix in your ~/.tmux.conf
set -g prefix F13
3) fire xterm and tmux
$ tmux
None of comma, period, or semicolon are standard control characters. Your terminal emulator probably just sends the plain character, or nothing at all when you type them; you can type them at into cat -v
to see what it is sending.
See Wikipedia’s “ASCII control characters” and “How control characters map to keyboards”.
If you can reconfigure your terminal emulator to send some other character/sequence, you should be able to use it in tmux (e.g. have your terminal emulator send the same character as C-\
(hex 1C), and set your prefix to that).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With