Diff
1diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
2index 465f5b053696789317b2854c20764d585f337424..049ceb30f8982e601c311b1fb2683e1d9480acca 100644
3--- a/plugins/tmux/tmux.plugin.zsh
4+++ b/plugins/tmux/tmux.plugin.zsh
5@@ -14,6 +14,8 @@ if which tmux &> /dev/null
6 [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART
7 # Set term to screen or screen-256color based on current terminal support
8 [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true
9+ # Set '-CC' option for iTerm2 tmux integration
10+ [[ -n "$$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false
11 # The TERM to use for non-256 color terminals.
12 # Tmux states this should be screen, but you may need to change it on
13 # systems without the proper terminfo
14@@ -36,7 +38,7 @@ if which tmux &> /dev/null
15 fi
16
17 # Set the correct local config file to use.
18- if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
19+ if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && (( [[ -f $HOME/.tmux.conf ]] || -h $HOME/.tmux.conf ]] ))
20 then
21 #use this when they have a ~/.tmux.conf
22 export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf"
23@@ -55,11 +57,11 @@ if which tmux &> /dev/null
24 # Try to connect to an existing session.
25 elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
26 then
27- \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
28+ \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
29 [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
30 # Just run tmux, fixing the TERM variable if requested.
31 else
32- \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
33+ \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
34 [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
35 fi
36 }