3

I am able to bind Ctrl-Alt-[a-z] using M-C-a, M-C-b etc.

However, when I attempt to bind Ctrl-Alt and a number key I get:

.tmux.conf: 45: unknown key: M-C-0

Any idea why? I'm running tmux ver 1.7

Related: How to bind "Ctrl-Alt-b" as the prefix of tmux?

0

The problem is that tmux does not expect a control0.

In key_string_lookup_string, it strips off the modifiers, and then (because you have the control modifier) tries to convert it from something like ^A (see source code). But ASCII digits range from 48 to 57, and you can see from the code that tmux will not accept a digit, returning KEYC_UNKNOWN (a failure):

/* 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;
    else
        return (KEYC_UNKNOWN);
    modifiers &= ~KEYC_CTRL;
}

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.