Last active
August 4, 2026 15:21
-
-
Save joechrysler/f9da812dd2bc62c7db80bf07f14711a5 to your computer and use it in GitHub Desktop.
tmux-palette — Cmd+P-style fuzzy switcher for tmux sessions/windows, with live pane preview (fzf + display-popup)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| # Command-palette style fuzzy switcher for tmux, in the spirit of Cmd+P. | |
| # Lists every window in every session as one flat list, fuzzy-filters it, and | |
| # previews the live pane contents of whatever is highlighted. | |
| # | |
| # Meant to be run inside a popup. | |
| # Enable it in your .tmux.conf like this: | |
| # | |
| # Bind to lowercase w, because it's conceptually kinda replacing what | |
| # choose-tree does. Stock choose-tree moves up to capital W. | |
| # unbind w | |
| # bind w display-popup -E -w 100% -h 100% "tmux-palette" | |
| # bind W choose-tree -Zw | |
| # Tab-separated so window names can contain spaces: | |
| # field 1 = switch target (session:index), field 2 = what you see. | |
| entries() { | |
| tmux list-windows -a -F '#{session_name}:#{window_index} #{session_name}›#{window_name}' | |
| } | |
| selection="$(entries | fzf \ | |
| --delimiter=$'\t' \ | |
| --with-nth=2 \ | |
| --no-multi \ | |
| --reverse \ | |
| --prompt=' ' \ | |
| --pointer='▸' \ | |
| --info=inline \ | |
| --preview='tmux capture-pane -ep -t {1}' \ | |
| --preview-window='down,50%,wrap')" | |
| # Escape / no match — leave the client exactly where it was. | |
| [[ -z "$selection" ]] && exit 0 | |
| target="${selection%%$'\t'*}" | |
| tmux switch-client -t "${target%%:*}" | |
| tmux select-window -t "$target" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment