DRY up tmux invocation.
This commit is contained in:
parent
96e4e5dd03
commit
6fb82113d2
@ -58,6 +58,10 @@ if which tmux &> /dev/null
|
||||
# Wrapper function for tmux.
|
||||
function _zsh_tmux_plugin_run()
|
||||
{
|
||||
# Construct options.
|
||||
[[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_options+=("-CC")
|
||||
[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_options+=("-f" "$_ZSH_TMUX_FIXED_CONFIG")
|
||||
|
||||
# We have other arguments, just run them
|
||||
if [[ -n "$@" ]]
|
||||
then
|
||||
@ -65,11 +69,11 @@ if which tmux &> /dev/null
|
||||
# Try to connect to an existing session.
|
||||
elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
|
||||
then
|
||||
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach || \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
|
||||
\tmux $tmux_options attach || \tmux $tmux_options new-session
|
||||
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
|
||||
# Just run tmux, fixing the TERM variable if requested.
|
||||
else
|
||||
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
|
||||
\tmux $tmux_options
|
||||
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user