m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-19 00:53:42 -05:00

Example of using fzf to search tmux panes

George Brown
2015-02-12 16:34:26 -06:00
parent 82ee122577
commit 4448019fb1

@@ -172,6 +172,27 @@ fs() {
}
```
```sh
# ftpane - switch pane
ftpane () {
local panes current_window target target_window target_pane
panes=$(tmux list-panes -s -F '#I:#P - #{pane_current_path} #{pane_current_command}')
current_window=$(tmux display-message -p '#I')
target=$(echo $panes | fzf)
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
}
```
z
-