Skip to content

Instantly share code, notes, and snippets.

@x-zvf
Created January 10, 2025 16:10
Show Gist options
  • Save x-zvf/c15172d7fde43e16b39163d4150971f4 to your computer and use it in GitHub Desktop.
Save x-zvf/c15172d7fde43e16b39163d4150971f4 to your computer and use it in GitHub Desktop.
# place this at the end of your .(bash|zsh)rc
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
if tmux list-sessions > /dev/null; then
exec tmux attach
else
exec tmux
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment