Updated tmux config for prefix-S to switch sessions

This commit is contained in:
2023-10-03 08:34:06 -04:00
parent 5555c14327
commit 6cb0744e92
4 changed files with 17 additions and 16 deletions

View File

@@ -5,7 +5,7 @@
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(find ~/LocalProjects ~/ -mindepth 1 -maxdepth 1 -type d | fzf)
selected=$(find ~/projects ~/ -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then

View File

@@ -1,10 +1,13 @@
#!/bin/sh
session=${1}
if [ $# -eq 1 ]; then
session=${1}
else
session=$(tmux list-sessions -F \#S | gum filter --placeholder "Pick a session...")
fi
if [ -z "$session" ]; then
choice=$(tmux list-sessions -F \#S | gum filter --placeholder "Pick a session...")
tmux switch-client -t "$choice" || tmux attach -t "$choice"
else
tmux switch-client -t "$session" || tmux attach -t "$session"
exit 0
fi
tmux switch-client -t "$session" || tmux attach -t "$session"