Skip to content

Commit

Permalink
Rewriting tmux plugin functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmatth committed Oct 2, 2013
1 parent cb1c4e3 commit 1448fe3
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions modules/tmux/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,12 @@ if [[ -z "$TMUX" ]] && ( \
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
); then
tmux_session='#Prezto'

if ! tmux has-session -t "$tmux_session" 2> /dev/null; then
# Ensure that tmux server is started.
tmux start-server

# Disable the destruction of unattached sessions globally.
tmux set-option -g destroy-unattached off &> /dev/null

# Create a new session.
tmux new-session -d -s "$tmux_session"

# Disable the destruction of the new, unattached session.
tmux set-option -t "$tmux_session" destroy-unattached off &> /dev/null

# Enable the destruction of unattached sessions globally to prevent
# an abundance of open, detached sessions.
tmux set-option -g destroy-unattached on &> /dev/null
# Attach if previous sessions exist, otherwise make a new one
if tmux list-session &> /dev/null; then
exec tmux attach-session
else
exec tmux new-session
fi

exec tmux new-session -t "$tmux_session"
fi

#
Expand Down

0 comments on commit 1448fe3

Please sign in to comment.