-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftpane.sh
executable file
·26 lines (20 loc) · 903 Bytes
/
ftpane.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
# ftpane - switch pane (@george-b)
ftpane() {
local panes current_window current_pane target target_window target_pane
#panes=$(tmux list-panes -s -F '#I:#P - #{window_name} @ #{pane_current_command}')
panes=$(tmux list-panes -s -F '#I:#P - #{window_name} @ #{pane_current_command} @\e[37m #{pane_title}')
#panes=$(ftpane2.sh)
current_pane=$(tmux display-message -p '#I:#P')
current_window=$(tmux display-message -p '#I')
target=$(echo "$panes" | grep -v "$current_pane" | fzf +m --reverse) || 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
}
ftpane