I have 22 tmux sessions open right now. That's not unusual — each project, each side-quest, each "let me just poke at this for a minute" gets its own session and never quite leaves. The only way that scales is if jumping between them is faster than thinking about it.
So the centerpiece of this config is a pair of fzf-driven popups:
C-s s to hunt an existing session or window, and C-s f
to spin up a new one from any directory under ~. Everything else
— the Tokyo Night theme, the rainbow window tabs, the system stats
in the status bar — is decoration around those two bindings.
The config has no plugins for these. Just a small shell script each, ~50 and ~100 lines. The rest is plain tmux.
If you copy this verbatim: prefix is
C-s(notC-b), you'll needfzf+fd+ a Nerd Font, and the rainbow window tabs only light up if your terminal does true colour.
Like choose-tree but with fzf underneath, so fuzzy filter works
out of the box. Three things that are not obvious from the
screenshot:
- Tab expands or collapses a session to reveal its windows.
The state is tracked in
/tmp/tmux-tree-statefor the duration of the picker, then thrown away. - Alt+0-9 and Alt+a-z jump to a row by position. With 20+ sessions the keyboard shortcut beats scrolling.
- The current session is pinned at the top of the list on open
(
load:pos(N)+unbind(load)) and marked with a*. After that fzf sorts normally by match score.
Source: session-tree.sh — wired up in
tmux.conf as:
bind-key s display-popup -w 90% -h 75% -E "~/.config/tmux/session-tree.sh"Pick a directory under ~, get a session for it. If one already
exists for that directory (matched by basename), switch to it
instead of creating a duplicate. Tab drills into a subdirectory,
Shift-Tab pops up to the parent — so this works as a lightweight
file-tree-shaped session launcher.
Two opinions baked in:
- Basenames as session names, with dots replaced by
underscores (tmux dislikes dots in
-ttargets). That means~/Projects/my.toolbecomes sessionmy_tool. - No "fuzzy across all directories". Started from
~and drilled with Tab. Recursive fd across~finds too many build/.gitdirectories and the results stop being useful.
Source: sessionizer.sh.
Top-positioned, Tokyo Night palette, pill-shaped session badge on the left, CPU/RAM/disk/host/clock on the right, rainbow window tabs in the middle. The icons are Nerd Font symbols rendered with the colour of each window's index.
C-s B toggles between this full bar and a one-character minimal
bar — useful when sharing the screen or recording.
- Prefix is
C-s. I've used it for years;C-bcollides with emacsbackward-charandC-awith shell line-start.C-sis emacs isearch — which I do use constantly — butC-s C-sis bound tosend-prefix, so the prefix forwards through to the inner program. Same trick works forC-sin the shell. - Vim-style pane navigation (
h/j/k/l) under prefix, no repeat. I prefer the explicit re-prefix to fighting with timers. (/)cycle sessions in creation order. Repeatable (-r), soC-s ) ) )walks forward three sessions. Faster than the picker when you know the target is "one or two over".renumber-windows on+base-index 0— when I close a window, the others compact. The rainbow colours are keyed off index, so things stay visually stable.mode-keys emacs— copy mode withC-spaceto mark,M-w/Enterto copy. Vim-mode users, sorry.
| Thing | Why |
|---|---|
tmux 3.3+ |
display-popup and pos() in fzf bindings |
fzf 0.44+ |
transform-header, pos(), --cycle, --no-separator |
fd |
the sessionizer uses it to list directories |
| A Nerd Font | status bar icons, expand/collapse glyphs |
| True-colour terminal | the rainbow tabs need 24-bit colour |
| TPM | plugin manager |
Plugins (installed by TPM, see tmux.conf):
tmux-plugins/tmux-sensible— boring sane defaultsomerxx/tmux-sessionx— alternative session picker, kept around for comparison; the homegrownsession-tree.shis what's bound toC-s stmux-plugins/tmux-cpu— CPU percentage helper for the status bar
# TPM
git clone https://github.com/tmux-plugins/tpm \
~/.config/tmux/plugins/tpm
# Drop these files in
mkdir -p ~/.config/tmux
cp tmux.conf ~/.config/tmux/tmux.conf
cp *.sh ~/.config/tmux/
chmod +x ~/.config/tmux/*.sh
# Start tmux, then install plugins with C-s I (capital I)
tmux| Key | Action |
|---|---|
C-s |
Prefix |
C-s C-s |
Send literal C-s |
C-s r |
Reload config |
C-s s |
fzf session/window tree |
C-s f |
fzf sessionizer (new session from dir) |
C-s S |
Built-in choose-tree (fallback) |
C-s h/j/k/l |
Move between panes |
C-s | / C-s - |
Split horizontal / vertical |
C-s n / C-s p |
Next / previous window (repeatable) |
C-s ( / C-s ) |
Previous / next session (repeatable) |
C-s N |
New session, prompts for name |
C-s X |
Kill current session, switch away first |
C-s B |
Toggle full / minimal status bar |
C-s M |
Toggle mouse mode (for iPad selection) |
C-s [ |
Copy mode (Emacs keys) |