Create a default tmux session only when none defined in tmux.conf

Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
This commit is contained in:
Xavier Cambar 2014-03-12 16:59:00 +01:00 committed by Sorin Ionescu
parent fedad8e9cf
commit ff0dfa424d

View File

@ -21,12 +21,12 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) || ( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \ ( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
); then ); then
tmux_session='prezto' tmux start-server
# Create a first 'prezto' session if tmux is starting. # Create a 'prezto' session if no session has been defined in tmux.conf.
if ! tmux has-session 2> /dev/null; then if ! tmux has-session 2> /dev/null; then
tmux_session='prezto'
tmux \ tmux \
start-server \; \
new-session -d -s "$tmux_session" \; \ new-session -d -s "$tmux_session" \; \
set-option -t "$tmux_session" destroy-unattached off &> /dev/null set-option -t "$tmux_session" destroy-unattached off &> /dev/null
fi fi