Screen goes with CTRL+a. tmux, as developed within screen, uses CTRL+b. Both are also keystrokes in other editors, shells, etc. What do you suggest, which one conflictes at least with other programs?

link|improve this question

feedback

10 Answers

up vote 6 down vote accepted

Ctrl+A is also known to cause problems with Emacs, including Bash in Emacs mode. It sounds like this is not a problem for you.

Ctrl+O is the other option I've seen. Apparantly, this is the default in RatPoison (this is an X window manager that doesn't need a mouse). I've used Ctrl+O when using nested screens: Ctrl+O for the outer one and Ctrl+A for the inner ones. Worked well, but kinda scared my colleagues. :-)

I was just thinking and if you use vi rather than Emacs, there are a few alternatives. Ctrl+G isn't used by much, for instance.

link|improve this answer
1  
For Emacs users Ctrl+O seems to be the the best pick: In emacs it´s only "open a new line at the cursor" and in bash "repeate a command sequence". – Flow Nov 24 '09 at 8:15
+1 if you are OK with right handed ctrl-operations, this looks like a good backup. I'm a lefty myself ;-) – DaveParillo Nov 24 '09 at 16:56
feedback

I use a complex system for screen. My default escape is set to \140\140, which is backtick. The Ctrl-A complicates both Emacs and command line editting for me within Zsh, and I dislike Ctrl-O (2 hand operations for most screen actions).

I rebind 's' to screen 1 so that new sessions are created from left to right on the keyboard starting at 1. This allows me to reserve screen 0 for what I consider persistent or reference windows. It's very quick one handed gesture to (backtick)1, (backtick)2, (backtick)3 to swap between windows.

The issue with using backtick in a unix environment is when attempting to cut and paste shell/perl script code. For this reason I bindkey F11/F12 to switch between my escape character.

bindkey -d -k F1        escape ^O^O # bound to F11

bindkey -d -k F2        escape \140\140 # bound to F12

This will swap the escape to Ctrl-O for when I'm doing cut and paste operations. I've found hitting a double tick is simple, and a good trade off for most screen operations.

link|improve this answer
Creative solution. I'm impressed. – staticsan Nov 25 '09 at 2:30
bind-key -n F11 set -g prefix ` bind-key -n F12 set -g prefix C-o Updates for tmux in case others want to adapt this. – milkypostman Feb 10 at 4:49
Is there a way to set some kind of minimal timeout for prefix+other_key combo in tmux so when pasting code it doesn't trigger any command but when typing backtick+key from keyboard it does because the pause between backtick and the other key was longer? – sickill May 5 at 16:15
feedback

I think ^\ (a.k.a. ^|) is the best if it's in a convenient position on your keyboard layout. It's uses in other programs are quite rare:

  • sending SIGQUIT to a process
  • aborting for or while loops in a shell when ^C is intercepted
  • toggle-input-method in emacs

I don't know of any other uses.

~/.tmux.conf:

unbind-key C-b
set -g prefix C-\
bind-key C-\ send-prefix

~/.screenrc:

escape ^|^|
link|improve this answer
Nice one! Thanks! – grm May 15 at 17:02
feedback

Personally, b is just too far away from Ctrl for me. When I use tmux, I alway change the binding from C-b to C-a. The main conflict with C-a is select all, but I have not found this to be a problem with the programs I use tmux with.

link|improve this answer
indeed, i use the default (in screen, never tried tmux) and haven't yet found a need to change it. – quack quixote Nov 24 '09 at 4:31
feedback

I've heard of ` (backtick) being used and then you just have to type it twice for an actual backtick. Might be better for vi users who are used to the action (unless you do the Caps lock thing).

link|improve this answer
How can you define backtick for tmux? – Alexandre Nizoux Feb 8 '11 at 21:16
Something like: unbind C-b; set -g prefix ''; bind '' send-prefix; see Darren Hall's answer above. – bluehavana Feb 10 '11 at 0:55
feedback

I use Ctrl-Q in tmux and it has worked well so far. I have to mention, though, that it conflicts with shell flow control. By default, Ctrl-Q is used to re-enable output after stopping it with Ctrl-S. Having been surprised by a stuck shell a few times after accidentally hitting Ctrl-S, I have learned not to press Ctrl-S.

(One could also turn off flow control altogether with stty -ixon, or bind different keys to stty start and stty stop.)

# tmux.conf
unbind C-b
set -g prefix C-q
link|improve this answer
feedback

For people who want to use backtick as the escape in tmux, you'll want to add:

unbind C-b
set -g prefix `
bind-key ` send-prefix

That last one is important, else you can't type a backtick for other purposes :-)

link|improve this answer
feedback

As a GNU emacs, zsh, and MS Windows user, I use Control-T. (e.g. in .screenrc:)

escape "^T^T"

Yes Control-T has something bound to it, like the pull down menu in Ubuntu's aptitude, or transpose character in Emacs.

I disregarded C-o because it requires two hands for me.

link|improve this answer
feedback

I like to reserve ^Space for very special/common operations because I find it to be the easiest prefix to type, but right now I'm trying it mapped as the prefix in tmux.

It leaves your fingers free to instantly jump to the command you want to type. Give it a try.

link|improve this answer
That didn't last long – I'm back to ^j. ^Space is too similar to commands that I use to invoke OSX-level apps (Spotlight, QuickSilver, DTerm). – msutherl Aug 22 '10 at 3:32
feedback

I like the suggestion of binding ctrl-\ as the prefix, but in order to get this to work on Linux Mint 12, I had to escape the place the binding at the bottom. Otherwise, it wouldn't take. See my .tmux.conf here: Using tmux with both emacs and vim

link|improve this answer
Please don't refer to answers as "above" and "below" as the order could change. Link the answer instead. Thanks for your answer :) – Flow Feb 4 at 9:43
feedback

Your Answer

 
or
required, but never shown

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