aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tmux/.local/bin/tmux-sessions
diff options
context:
space:
mode:
Diffstat (limited to 'tmux/.local/bin/tmux-sessions')
-rwxr-xr-xtmux/.local/bin/tmux-sessions8
1 files changed, 8 insertions, 0 deletions
diff --git a/tmux/.local/bin/tmux-sessions b/tmux/.local/bin/tmux-sessions
new file mode 100755
index 0000000..68fec47
--- /dev/null
+++ b/tmux/.local/bin/tmux-sessions
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session"
+
+session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null |
+ fzf-tmux -p -- --reverse --exit-0 --preview='tmux-tree {} | bat --style plain') &&
+ tmux $change -t "$session" || exit 0
+