9

I have tmux 1.5 installed on a couple of Ubuntu machines and I have this in my ~/.tmux.conf:

unbind-key C-b
set-option -g prefix C-\

So, on a couple of RedHat machines I have ssh access to (but not root) I compiled tmux 1.6 and installed it in my directory. Now when I try to set C-\ as my prefix, I get this on startup:

 /home/user/.tmux.conf: 2: line continuation at end of file

Obviously its not parsing the file correctly. As a test I change it to:

unbind-key C-b
set-option -g prefix C-'

And I get:

 /home/user/.tmux.conf: 2: invalid or unknown command: set-option -g prefix C-'

So it's still not parsing correctly.

However, this does work:

unbind-key C-b
set-option -g prefix C-o

So it seems to be a problem with non-alphanumeric keys.

any ideas>

1 Answer 1

12

In tmux 1.6 a backslash at the end of a configuration line acts as a line continuation character. You can arrange to get the backslash to the command itself in several ways:

Simply make sure it is not the last character. Put a space after it, or a space and a comment:

set-option -g prefix C-\ # (not a line continuation!)

Wrap it in single quotes:

set-option -g prefix 'C-\'

Wrap it in double quotes (and escape it, since backslash is special inside double quotes):

set-option -g prefix "C-\\"

Your C-' was failing because the single quote was starting a quoted string (the error message is not so helpful here).

Also, there is no standard control character or sequence for Control-', so tmux would have complained (bad key: C-') even if you had double quoted it to get it past the initial parsing stage; there are only a handful of non-alphabetic control characters: @[\]^_?.

5
  • Yep that worked fine! I figured it was a feature of the new version.
    – MikeHoss
    Apr 27, 2012 at 14:00
  • How can I assign < character for prefix?. I am using Turkish keyboard and I am trying set -g prefix 'C-<' but I am getting bad key error. Jun 14, 2013 at 11:40
  • @mesuutt: C-< is not a standard control character (see the last paragraph of the answer). Versions of tmux before 1.8 do not support it at all (giving the “bad key” message); starting with 1.8, tmux will recognize it, but only via xterm-style modifyOtherKeys sequences (e.g. ESC [27;5;60~ for C-<), which your terminal emulator may or may not support. Jun 14, 2013 at 19:36
  • @ChrisJohnsen I am using zsh and tmux 1.8. I cant understand exactly what you mean. What should I write to .tmux.conf for change prefix to C-< ? What is the ESC [27;5;60~ ? Jun 14, 2013 at 22:37
  • @mesuutt: I can successfully do set -g prefix 'C-<' when using tmux 1.8 (I do not get the “bad key” message that 1.7 and earlier give); your shell does not much matter. That escape sequence is what tmux will recognize as C-<, so your terminal needs to send those eight bytes when you press C-< (tmux asks for this behavior by sending another sequence when it starts, but not all terminal emulators support it). Try typing C-< after running printf '\e[>4;1m';cat outside tmux; if you do not get the sequence, then your terminal probably does not have the necessary support. Jun 14, 2013 at 23:00

You must log in to answer this question.

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