How to quickly switch to n.10+ windows in tmux?
Tmux by default comes with the following keybinding to quickly switch between windows numbered 0 to 9:
C-b + 0-9
With a couple of dozen different project folders, a few ssh sessions and other goodies in my tmux, I seem to always spill over the 10 windows I can quickly access, and I would love to figure out a quick way to switch to windows numbered 10 or higher. Right now I have to manually type out something along these lines in the tmux prompt:
swap-window -t 12
Which is quite time-consuming.
Has anyone figured out a solid shortcut that helps you quickly access windows 10 and higher? I know weechat solved this problem with the two shorcuts:
Alt + 0-9
Alt+j followed by \d{2}
Can anything along those lines be accomplished with tmux?
There are a few easy ways to do it.
Use
C-b '
to select the window index.Use
C-b w
to get an interactive index to choose from (0-9a-z).-
Add bindings to cycle through quickly in tmux.conf
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
The -r
in the last one lets you repeat the key without having to repeat C-b
. Typically the second one is the least number of keystrokes.