Mark and swap panes
Panes read C, A, B from left to right and no pane is marked.
Neighbours swap with one key. Any two panes need a mark:
C-b }/C-b {- swap the active pane with the next or previous one
C-b m- mark the active pane (
C-b Mclears the mark) swap-paneatC-b :- swap the marked pane with the active one, wherever either sits
Swapping moves what is in a pane, not the pane’s slot. Sizes and positions stay exactly as they are; programs and titles trade places. Pane numbers belong to positions, so a number never travels with a program.
Only one pane on the whole server can be marked at a time. Its border turns green and its window gets an M flag.
Left to right the panes are titled A, B, C; A is active.
Press C-b Right twice to reach C, then C-b m.
Its border turns green and the list shows M.
Press C-b Left twice to reach A, then C-b :, type swap-pane, Enter.
The order is now C, B, A.
The swap carried you along, so A is active on the right. Press C-b Left to reach B, then C-b }.
The order is C, A, B.
Press C-b M.
The mark and the M flag go.
Swapping without a marked pane
Run swap-pane with nothing marked and it behaves like C-b }, swapping with the next pane.
Here is what just happened.
C-b m runs select-pane -m; C-b M runs select-pane -M. swap-pane used the mark as its source and the active pane as its target. C-b } runs swap-pane -D, which ignores the mark and takes the next pane. The titles moved with the programs; positions 0, 1 and 2 stayed where they were.
- Swap the active pane with the next (or previous) paneC-bthen}
- Toggle the marked pane; M clears the mark entirelyC-bthenm
- Swap the marked pane with the active pane:swap-pane
Go further
swap-pane -s 0.0 -t 0.2names both panes and needs no mark.-dswaps without moving the active pane.swap-windowdoes the same for whole windows.
- 1
swap-panewith no arguments uses the marked pane. Mark C first, then run it from A. - 2
C-b mmarks the active pane;C-b }swaps the active pane with its right neighbour;C-b Mclears the mark. - 3On C press
C-b m; move to A,C-b :swap-pane;C-b Leftto the middle pane,C-b }; thenC-b M.
This is a live terminal. Typing goes to the machine, including Tab. Press Shift and Tab together to move focus back out to the page.
A real terminal, in this tab
Alpine Linux and tmux 3.4 on an x86 emulator. Nothing to install, and no server behind it.
about 15 MB, once
Done when
not started- Window 0 of session learn holds panes titled C, A, B in that order— not done yet
- No pane is marked once the rearrange is done— not done yet