Checking environment instead of local variable for fixing term in tmux plugin.

This commit is contained in:
Josh Matthews 2013-02-26 21:52:26 -05:00
parent 7b15627851
commit 43c50f03e3

View File

@ -23,8 +23,6 @@ fi
local fixed_config="" local fixed_config=""
# Set the correct local config file to use. # Set the correct local config file to use.
if [[ "$ZSH_TMUX_FIXTERM" == "true" ]]
then
if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
then then
#use this when they have a ~/.tmux.conf #use this when they have a ~/.tmux.conf
@ -33,7 +31,6 @@ then
#use this when they don't have a ~/.tmux.conf #use this when they don't have a ~/.tmux.conf
fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" fixed_config="$zsh_tmux_plugin_path/tmux.only.conf"
fi fi
fi
# Wrapper function for tmux. # Wrapper function for tmux.
function zsh_tmux_plugin_run() function zsh_tmux_plugin_run()
@ -45,11 +42,11 @@ function zsh_tmux_plugin_run()
# Try to connect to an existing session. # Try to connect to an existing session.
elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
then then
\tmux attach || \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` new-session \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` new-session
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
# Just run tmux, fixing the TERM variable if requested. # Just run tmux, fixing the TERM variable if requested.
else else
\tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config`
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
fi fi
} }