How do I make tmux reorder windows when one is deleted?

Since tmux 1.7, you can type just one command to do so:

tmux movew -r

Let's do it more simply.

If you are using tmux below version 1.7, append next line to ~/.tmux.conf:

 bind-key C-s run "for i in $(tmux lsw|awk -F: '{print $1}'); do tmux movew -s \$i; done"

You could sort all windows, by typing PREFIX-KEY, then Ctrl + s.

Else, if you are using tmux version 1.7 or above, as already everybody says, append next line to ~/.tmux.conf:

 set-option -g renumber-windows on

Tags:

Unix

Tmux