From 6fb82113d2cc85fe09cd4f1bf1870d6347c4e1a9 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 21 Oct 2013 21:28:36 -0700 Subject: [PATCH] DRY up tmux invocation. --- plugins/tmux/tmux.plugin.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 626c41f3..25292b9d 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -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 }