Skip to content

Instantly share code, notes, and snippets.

@gorgabal
Created January 12, 2017 20:31
Show Gist options
  • Save gorgabal/5a8af0b6d6a07aac3215c1f75c7be70e to your computer and use it in GitHub Desktop.
Save gorgabal/5a8af0b6d6a07aac3215c1f75c7be70e to your computer and use it in GitHub Desktop.
#if placed at the end of your .zshrc this wil automaticly start and attach tmux.
#When you attach from a new session, it wil close your previous terminal.
#start tmux defaultly
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (tmux a -d || tmux new-session)
fi
#exit if not in tmux anymore
if test -z ${TMUX}; then
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment