1

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

2 Answers 2

1

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
4
  • 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
    Commented Jul 28, 2020 at 12:46
  • Are you using Alt+X as tmux prefix key then? Answer edited above. Commented Jul 28, 2020 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
    Commented Jul 28, 2020 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. Commented Jul 28, 2020 at 13:49
0

I've set mine to Ctrl-Space. This works really well. I imagine other combinations with Space will work as long as it's the second character in the chain.

In your config you can

unbind C-b
set -g prefix C-Space
bind Space send-prefix

This will:

  1. Unbind the default C-bprefix
  2. Set C-Space to the new prefix
  3. And ensure any presses to Space get passed to the active pane

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .