diff options
Diffstat (limited to 'tmux/.local/bin/tm')
-rwxr-xr-x | tmux/.local/bin/tm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tmux/.local/bin/tm b/tmux/.local/bin/tm new file mode 100755 index 0000000..5c976d3 --- /dev/null +++ b/tmux/.local/bin/tm @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session" +session=$( + tmux list-sessions -F "#{session_name}" 2>/dev/null | + sed "/^$(tmux display-message -p '#S' 2>/dev/null)$/d" | + fzf --query="$1" --select-1 --exit-0 +) && + tmux $change -t "$session" || + ( + tmux new-session -d -s $session && + tmux $change -t "$session" + ) |