I'd like to bind Ctrl-` in tmux to select-pane.

I've tried: bind -n C-` select-pane -t :.+ Which gives me: unknown key C-`

I've also tried: bind -n 'C-`' select-pane -t :.+ Which gives me the same error.

I then tried just plain `: bind -n ` select-pane -t :.+ That worked fine (but bound ` not C-`.

Most confusingly, I tried: bind -n `-C select-pane -t :.+ Which surprisingly worked (I had to hit backtick first, and then ctrl). What is it within Ctrl-` that tmux doesn't like?


tmux uses this logic for handling the ctrl modifier in key-string.c (backtick is code 96):

    /* Convert the standard control keys. */                               
    if (key < KEYC_BASE && (modifiers & KEYC_CTRL) && !strchr(other, key)) {
            if (key >= 97 && key <= 122)
                    key -= 96;
            else if (key >= 64 && key <= 95)
                    key -= 64;
            else if (key == 32)
                    key = 0;
            else if (key == 63)
                    key = KEYC_BSPACE;
                    return (KEYC_NONE);
            modifiers &= ~KEYC_CTRL;

Although some applications may treat the whole range from 64 to 126 as valid for ctrl, tmux excludes backtic, curly braces, vertical bar and tilde. The likely reason is that they are less useful for key bindings because the unmodified keys are often used in shell scripts.

On the other hand, ctrl-@ would have the same expected interpretation, and you could use that instead.

  • I've tried C-@ and that didn't work (It selected panes with Ctrl+@ but not with Ctrl+`) :(
    – Jon Q
    Jun 24 '15 at 9:24
  • But as one can see (reading the source code), tmux does not do what was requested, unless you modify the program. Jun 24 '15 at 9:27

I found somewhere the advice to use cat inside tmux to check escape sequence.

  1. Run tmux
  2. Run cat
  3. Press keys C-`

On my terminal I've got ^@

So in the config I've put

set -g prefix ^@ Worked for me with roxterm

  • ^@ works well with tilix
    – ilyuha21st
    Apr 9 at 21:42

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.