Skip to content

Instantly share code, notes, and snippets.

@muralisc
Created June 25, 2015 20:37
Show Gist options
  • Save muralisc/d1ed7226533ab23e4e1e to your computer and use it in GitHub Desktop.
Save muralisc/d1ed7226533ab23e4e1e to your computer and use it in GitHub Desktop.
#!/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