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:
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).
# Demo Video
Tmux Configuration
# 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
Timestamps
- 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
Reference Links
Are you doing this in your config? Let me know below.