Renumber all windows in tmux
If you have a large number of windows open in tmux, it can be a pain when deleting some of them as the numbers are no longer consxistent. You could have 20 windows open, but the next window you create will be #2 because that was the first free spot.
A quick way to fix this is to run :movew -r
which will renumber all existing windows.
Note: Older versions of tmux may not have the -r option.
:movew
without any arguments can be run to renumber the current window only to the first available spot.
And :movew -t <num>
can be used to renumber the current window to a specific index.
Reference
Help for the move-window
command:
move-window[-ardk] [-s src-window] [-t dst-window] This is similar to link-window except the window at src-windowis moved to dst-window With -r all windows in the session are renumbered in sequential order, respecting the base-indexoption.