Last Updated: February 25, 2016
· gkb

Reorganizing windows in a long-running tmux session

If you're like me, you have long-running tmux sessions which organize the different windows you're working in. You open new windows and close some. At the end of all the madness, your tmux window number sequence may read something like this '1, 2, 6, 12, 17, ...'. It's somewhat sparse, don't you think? The sequence would be fine if it weren't for a slight niggle.

I like navigating the tmux windows using the combination of prefix+<window-number>. But this only works when the <window-number> is prefix free. I cannot navigate to window-17 this way, because before I can hit 7, tmux has captured the prefix+1 and taken me to window-1.

There is a simple fix to this. Run the tmux command move-window -r, short for move windows and renumber. For tmux newbies out there, you can type verbose commands by hitting prefix+:.

Check out the tmux manpage for more information.

1 Response
Add your response

Thanks for the tip.

over 1 year ago ·