Created
June 25, 2015 20:37
-
-
Save muralisc/d1ed7226533ab23e4e1e to your computer and use it in GitHub Desktop.
ftpane script adapted from https://github.com/junegunn/fzf/wiki/examples
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 | |
# ftpane - switch tmux pane | |
panes=$(tmux list-panes -s -F '#I:#P #W #{pane_current_path} #{pane_current_command} #{pane_title}') | |
current_window=$(tmux display-message -p '#I') | |
target=$(echo "$panes" | fzf) || return | |
target_window=$(echo $target | awk 'BEGIN{FS=":|-"} {print$1}') | |
target_pane=$(echo $target | awk 'BEGIN{FS=":|-"} {print$2}' | cut -c 1) | |
if [[ $current_window -eq $target_window ]]; then | |
tmux select-pane -t ${target_window}.${target_pane} | |
else | |
tmux select-pane -t ${target_window}.${target_pane} && | |
tmux select-window -t $target_window | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment