learntmux.dev

Move and renumber windows

Goal

The window list reads 0:editor 1:logs 2:tests 3:shell.

An index is a slot in the window list. These three commands change slots without closing anything:

C-b .
prompt for a new index for the current window
swap-window at C-b :
trade the current window with the one holding the marked pane
movew -r at C-b :
renumber every window from 0, closing the gaps

The mark is the same one from C-b m: mark a pane in the window you want to move, go to the window you want it to trade with, then run swap-window.

Do this

Press C-b 3 to reach tests, then C-b ., type 2, Enter.

The list shows 2:tests.

Press C-b 1 to reach editor, then C-b m.

Its pane is marked.

Press C-b 0 to reach logs, then C-b :, type swap-window, Enter.

editor is now at 0 and logs at 1.

Press C-b :, type movew -r, Enter.

7:shell becomes 3:shell, leaving 0:editor 1:logs 2:tests 3:shell.

Replacing an occupied index

move-window refuses an index that is already taken, unless you add -k to replace whatever is there.

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. The tests window has been moved to index 2— not done yet
  2. The window list reads 0:editor 1:logs 2:tests 3:shell with no gaps— not done yet