I have two panes in horizontal split. I'd like to have the pane currently on the right to be on the left in the window. I'm not talking about moving the focus (Ctrl+B o). How do I achieve this?
'left pane' <--> 'right pane'
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityThe swap-pane
command can do this for you. The { and } keys are bound to swap-pane -U
and swap-pane -D
in the default configuration.
So, to effect your desired change, you can probably use Prefix { when you are in the right pane (or Prefix } if you are in the left pane).
The -U
and -D
refer to “up” and “down” in the pane index order (“up” is the same direction that Prefix o moves across panes). You can see the pane indices with display-panes
(Prefix q, by default).
Prefix
instead of assuming everyone will use Ctrl-b
Oct 5, 2017 at 15:55
Ctrl-a
, since they're the people who know that the prefix can be changed to suit the user.
swap-pane
(and answer to question in title).
You can hit Ctrl b and keep holding down Ctrl while hitting o. This will rotate all existing panes around, so in your case it will swap the only two existing panes.
Ctrl b + Alt o rotates the opposite way (useful when you have more than two panes).
Ctrl+o
is being sent to the shell instead of to tmux, especially if this is not the case for repeatedly pressing Ctrl+b
(or other tmux commands?).
Feb 14, 2017 at 23:45
Ctrl+b;
, which keeps rotating the cursor between two panes.
Feb 16, 2017 at 2:58
The most precise control you can have is by using the command swap-pane
directly. This is not so difficult to do:
ctrl-b q
shows you the "ID" for each pane in current window - remember the two panes you want to swap. Let's say they're 3 and 5.ctrl-b :
to activate the tmux command line. Then issue command swap-pane -s3 -t5
.Note that you have auto-completion when typing commands. Also you can search for syntax of a command directly from tmux manpage. That's how I learn the syntax for swap-pane
.
To directly swap two panes:
:swap-pane