From 26fe2d094475f1410378645f63be7c7241f39811 Mon Sep 17 00:00:00 2001 From: Ben Withem Date: Sat, 7 Mar 2015 20:21:24 -0500 Subject: [PATCH] Added automatic detection of OSX/iTerm2, fixed the wrapper to append -CC (iTerm2) to commands with arguments. --- plugins/tmux/tmux.plugin.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index bc32c890..9d6b5097 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -13,6 +13,16 @@ if which tmux &> /dev/null then # Configuration variables # + # Check if OSX + if [[ "$(uname)" == "Darwin" ]] + then + # Check if terminal app is iTerm2 + if [[ "$TERM_PROGRAM" == "iTerm.app" ]] + then + # Set '-CC' option for iTerm2 tmux integration + [[ -n "$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=true + fi + fi # Automatically start tmux [[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false # Only autostart once. If set to false, tmux will attempt to @@ -63,7 +73,7 @@ if which tmux &> /dev/null # We have other arguments, just run them if [[ -n "$@" ]] then - \tmux $@ + \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` $@ || $@ # Try to connect to an existing session. elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then