Start Your Tmux Window and Pane Index Count at 1 Instead of 0
We'll go over how to do the above as well as auto-remove index gaps after closing a window. Your index counts will always be in order.
Quick Jump: Demo Video
Being able to switch windows is typically much easier when your windows are arranged as
1, 2, 3 instead of
0, 1, 2 (the default). This is especially true if your Tmux prefix key is on the left side of your keyboard (mine is with the ` key).
# Start windows and panes index at 1, not 0. set -g base-index 1 setw -g pane-base-index 1 # Ensure window index numbers get reordered on delete. set-option -g renumber-windows on
- 0:09 – Starting off the window index at 1
- 0:48 – Starting off the pane index at 1
- 1:20 – Ensuring window index gaps get removed after deleting a window
- 2:11 – Taking a look at the 3 tmux config options to make all of this work
- 2:59 – Testing the window index value to start at 2, yep it works
Are you doing this in your config? Let me know below.