Created
January 11, 2021 22:56
-
-
Save thugcee/41d1ba786fa5e66167ed6ee45e4f6346 to your computer and use it in GitHub Desktop.
tmux and fzf: fuzzy tmux session/window/pane switcher (this version uses tmux new popup window)
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
#!/bin/bash | |
# customizable | |
LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}" | |
FZF_COMMAND="fzf-tmux -p --delimiter=: --with-nth 4 --color=hl:2" | |
# do not change | |
TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" | |
# select pane | |
LINE=$(tmux list-panes -a -F "$TARGET_SPEC $LIST_DATA" | $FZF_COMMAND) || exit 0 | |
# split the result | |
args=(${LINE//:/ }) | |
# activate session/window/pane | |
tmux select-pane -t ${args[2]} && tmux select-window -t ${args[1]} && tmux switch-client -t ${args[0]} |
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
bind-key ` run-shell -b tmux-switch-pane.sh |
very nice, thank u! Can you add preview to this too?
Thanks man!
It's still working today. Don't forget to make the script executable
chmod +x tmux-switch-pane.sh
This is too good! Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very nice script :D.