From c236eee1c254f2408313a9d0be315f49780afeb5 Mon Sep 17 00:00:00 2001 From: Yue Xin Date: Tue, 18 Aug 2015 14:25:18 +0800 Subject: [PATCH] plugin/tmux improve add a shell variable to specify the name of the autostart tmux session --- plugins/tmux/tmux.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index bc32c890..e6fec53f 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -67,8 +67,13 @@ 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 + if [[ "$ZSH_TMUX_AUTOSTART_NAME" != "" ]] + then + \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach -t $ZSH_TMUX_AUTOSTART_NAME || \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session -s $ZSH_TMUX_AUTOSTART_NAME + else + \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 [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + fi # 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`