How to switch between two latest windows in tmux?

57

18

screen has a Ctrl-a,Ctrl-a to switch between two latest windows?

How to do it in tmux?

kev

Posted 2012-05-28T04:39:25.873

Reputation: 9 972

Answers

86

To do this in tmux, you do

Ctrl-Bl

(that is an 'L'). This assumes you have left Ctrl-B as your activation key.

If you want to use the same keypresses as screen, then add the following to your ~/.tmux.conf:

set-option -g prefix C-a
bind-key C-a last-window

The first sets Ctrl-A as your activation key, the second says Ctrl-A after activation should go to the last window.

Paul

Posted 2012-05-28T04:39:25.873

Reputation: 52 173

2

Paul's answer is correct, but it seems to leave you without a way to type ^A.

See this thread for details, but essentially you can do this to get a C-a (^A) if you need one:

bind-key v send-prefix

Now if you type C-a v you'll get a ^A.

fbicknel

Posted 2012-05-28T04:39:25.873

Reputation: 161