learntmux.dev

Mark and swap panes

Goal

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 M clears the mark)
swap-pane at C-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.

Do this

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.

Stuck on this one?

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

about 15 MB, once

session learn

Done when

not started
  1. Window 0 of session learn holds panes titled C, A, B in that order— not done yet
  2. No pane is marked once the rearrange is done— not done yet