How do I change the tmux prefix keyboard shortcut from ctrl+B to space+B while, by default, the space button has a command?


From tmux man page:

tmux allows a command to be bound to most keys, with or without a pre-fix key. When specifying keys, most represent themselves (for example ‘A’ to ‘Z’). Ctrl keys may be prefixed with ‘C-’ or ‘^’, and Alt (meta) with ‘M-’.

Which means you can bind Ctrl and Alt as prefix keys - not space. Actually, I don't know any app that let's you bind space as a prefix key, but please enlighten me.

To bind another key as tmux prefix key, add the following to .tmux.conf (for Alt+X as prefix key):

set -g prefix M-x
bind M-x send-prefix
  • Well, now that there is no way to set the space, how do I set the Alt and x + % buttons to halve the screen vertically? Alt + x + %
    – M UBU 2020
    Jul 28 '20 at 12:46
  • Are you using Alt+X as tmux prefix key then? Answer edited above. Jul 28 '20 at 12:49
  • My tmux version is tmux 3.0a But I did not find a file called .tmux.conf Can this method >>(set -g prefix M-x bind M-x send-prefix)<< be adjusted by typing <command prompt> in tmux itself?
    – M UBU 2020
    Jul 28 '20 at 13:29
  • Yes I believe so. But maybe you have to create the .tmux.conf file first if it's not in your user dir, makes things much easier. Jul 28 '20 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.