brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: set -g base-index 1 makes window numbers match the keyboard row

Tmux
~/tips/tip-tmux-base-index

set -g base-index 1

Starts numbering tmux windows at 1, so the first window sits under the 1 key.

Window zero sits at the far end of the number row, which is a small daily annoyance.

set -g base-index 1
setw -g pane-base-index 1

Windows now start at 1 and Ctrl-b 1 is the first one. The second line does the same for panes.

A keyboard has 1 on the left and 0 at the right end of the number row, so window zero is the hardest one to reach. Starting at 1 means the first window is the closest key. It is a small change, and you notice it every time you jump between windows with Ctrl-b and a digit.

Pair it with pane-base-index so panes start at 1 too, and the numbers in Ctrl-b q match the windows. The two settings are independent, which is why they need two lines. Check them with tmux show -gv base-index, which prints the number you set.

The option only applies to windows created after it is set, so a fresh session shows it straight away and an old one keeps its numbers.

Try it in a throwaway session: tmux new -s scratch, and close it afterwards with tmux kill-session -t scratch.

Further reading: tmux manual page (OpenBSD, official), tmux wiki: Getting Started (official), On this site: set -g renumber-windows on closes the gap when you close a window, On this site: Ctrl-b l jumps back to the window you were just in

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link