I have three windows:
1:zsh 2:vim* 3:htop
When I delete the current window (#2), I have these windows left:
1:zsh 3:htop
How can I make it so that it automatically renumbers them as
1:zsh 2:htop
If I recall correctly, this is the default behavior of GNU Screen. I know I could always :swap-window
, but I would like to know if this is possible automatically.
The recently released tmux 1.7 includes the renumber-windows session option (keeps window numbers gapless), and the move-window -r command (does a one-time renumbering of windows). If you want “gapless” numbers for all sessions, then you could put set -g renumber-windows on in your config file (once you have tmux 1.7).
ctrl + d kills a window in linux terminal, also works in tmux.
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
Since tmux 1.7, you can type just one command to do so:
tmux movew -r
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With