Reorder window, swap window number 2(src) and 1(dst)

windows

// what it does

swap-window exchanges the positions of two existing windows: `-s 2` (source) and `-t 1` (target) trade index numbers. Unlike move-window it never fails on an occupied target — swapping is the whole point. Run it from the command prompt (prefix + `:`) or a binding to reorder windows without leaving gaps.

// tmux command

: swap-window -s 2 -t 1

// gotcha

If `-s` is omitted and you've marked a pane (select-pane -m), swap-window uses the marked pane's window as the source instead of the current one — a surprise if you forgot a pane is marked.