Set Ctrl+Shift as prefix in tmux

I would want to have Ctrl+Shift as prefix in tmux (because I’m trying to switch from terminator, and the majority of my shortcuts used Ctrl+Shift).

I tried this in my .tmux.conf :

unbind-key C-b
set-option -g prefix C-S
bind-key C-S send-prefix

It unbind Ctrl+B, but it doesn’t rebind it to Ctrl+Shift (actually, the second line alone has the same behavior).

Is there a way to do that, or, as these are two “special” keys, we can’t bind them alone?

Thanks !

Asked By: Corentin Peuvrel

||

See the man page for the list of keys tmux recognises:

KEY BINDINGS
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.
Note that to bind the ‘”’ or ‘’’ keys, quotation marks are necessary.

Note that Shift is not included…

Answered By: jasonwryan

Ctrl and Shift are modifiers. These keys aren’t transmitted to applications running in a terminal. Rather, when you press something like Ctrl+Shift+A, this sends a character or a character sequence at the time you press the A key. See How do keyboard input and text output work? for more details.

There may be some terminal emulators that can be configured to send a key sequence when you press Ctrl+Shift, but even that isn’t a given and might depend on which order you press the two keys in, and you’d lose the ability to make Ctrl+Shift+key shortcuts.

If your terminal emulator permits it, you could configure it to send C-b a when you press Ctrl+Shift+A and so on. That would allow you to use single-keychord bindings for some commands.

If you want to free the keychord Ctrl+B so that it’s sent to the underlying application, pick a different prefix such as C- or C-] or C-^.

Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.