Set Ctrl+Shift as prefix in tmux

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 !

Best Answer

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-^.

Related Question