135

I was able to make GNU Screen start counting windows with the number 1 instead of the default 0 with this code in my .screenrc:

# Get rid of screen 0
bind c screen 1
bind ^c screen 1
bind 0 select 10

When I created windows in .screenrc I used screen 1 so that it would first try 1 and then count up if that window number was taken.

hekevintran
  • 3,633
  • 3
  • 14
  • 9

1 Answers1

212

The solution is to modify ~/.tmux.conf to:

# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1

Edit: unlike base-index, pane-base-index is a window option, so setw should be used, as @Jogusa pointed out.

hekevintran
  • 3,633
  • 3
  • 14
  • 9
  • 58
    I wish they made this default, its really inconvenient as 0 as at the other side of the keyboard. – Sam Stoelinga Oct 30 '12 at 06:26
  • 5
    According to my tmux book it shoud be setw in the pane setting: setw -g pane-base-index 1 See the .tmux.conf from book: http://media.pragprog.com/titles/bhtmux/code/config/tmux.conf – Jogusa Sep 26 '14 at 11:43
  • 1
    What's the significance of setw vs set? – hekevintran Sep 26 '14 at 19:48
  • 4
    setw is alias for set-window-option or set -w. Altering pane-base-index is a window option. See tmux manpage -> http://manpages.ubuntu.com/manpages/precise/man1/tmux.1.html – Jogusa Sep 27 '14 at 10:21
  • 2
    This doesn't seem to change window numbering in interactive window chooser (C-b w). Bug report – matt Oct 22 '17 at 21:01
  • 6
    i still have no idea, up till this day, why numbers on the keyboard start from 1 instead of 0. what kind of ordering is that? – Gerald Aug 08 '18 at 04:28
  • I'm annoyed it took me so many months to think to search for this answer – New Alexandria Sep 08 '19 at 16:20
  • 6
    Note that tmux has to restart for windows to start at 1. In contrast, panes will start at 1 just by doing <prefix> :source-file ~/.tmux.conf. – llf Jan 02 '20 at 21:02
  • 1
    @Gerald: https://ux.stackexchange.com/questions/76446/why-is-the-0-next-to-9-not-next-to-1 – musiphil Jan 15 '20 at 01:12
  • I turned this into a TPM plugin if anyone finds that to be more convenient. It's a pretty straightforward config, admittedly, but if I can figure out a way to also renumber sessions I'll add that to the plugin as well: https://github.com/openjck/tmux-one – John Karahalis Jul 12 '20 at 02:21
  • I had to do tmux source-file ~/.tmux.conf before this worked. – equant Dec 01 '22 at 20:22