summaryrefslogtreecommitdiff
path: root/tmuxsh/_tmux_switch_panes,--.search.and.jump.to.a.pane.in.the.current.session
diff options
context:
space:
mode:
Diffstat (limited to 'tmuxsh/_tmux_switch_panes,--.search.and.jump.to.a.pane.in.the.current.session')
-rwxr-xr-xtmuxsh/_tmux_switch_panes,--.search.and.jump.to.a.pane.in.the.current.session19
1 files changed, 19 insertions, 0 deletions
diff --git a/tmuxsh/_tmux_switch_panes,--.search.and.jump.to.a.pane.in.the.current.session b/tmuxsh/_tmux_switch_panes,--.search.and.jump.to.a.pane.in.the.current.session
new file mode 100755
index 0000000..12c5cfc
--- /dev/null
+++ b/tmuxsh/_tmux_switch_panes,--.search.and.jump.to.a.pane.in.the.current.session
@@ -0,0 +1,19 @@
+#!/usr/bin/env sh
+# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry|odysee)
+# https://www.youtube.com/user/gotbletu
+
+# tmux list-pane formating
+TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:"
+LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}"
+
+FZF_COMMAND() {
+ fzf -e -i --prompt="Select a pane (current session): " --info=default --layout=reverse --tiebreak=index
+}
+
+# select pane
+LINE="$(tmux list-panes -s -F "$TARGET_SPEC $LIST_DATA" | FZF_COMMAND)" || exit 0
+SESSION="$(echo "$LINE" | cut -d ':' -f1)"
+WINDOW_NUM="$(echo "$LINE" | cut -d ':' -f2)"
+PANE_NUM="$(echo "$LINE" | cut -d ':' -f3)"
+
+tmux select-pane -t "$PANE_NUM" && tmux select-window -t "$WINDOW_NUM" && tmux switch-client -t "$SESSION"