mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
Merge pull request #1903 from andschwa/tmux_iterm2
Tmux iTerm2 integration
This commit is contained in:
commit
1e625b42ff
1 changed files with 5 additions and 3 deletions
|
@ -14,6 +14,8 @@ if which tmux &> /dev/null
|
||||||
[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART
|
[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART
|
||||||
# Set term to screen or screen-256color based on current terminal support
|
# Set term to screen or screen-256color based on current terminal support
|
||||||
[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true
|
[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true
|
||||||
|
# Set '-CC' option for iTerm2 tmux integration
|
||||||
|
[[ -n "$$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false
|
||||||
# The TERM to use for non-256 color terminals.
|
# The TERM to use for non-256 color terminals.
|
||||||
# Tmux states this should be screen, but you may need to change it on
|
# Tmux states this should be screen, but you may need to change it on
|
||||||
# systems without the proper terminfo
|
# systems without the proper terminfo
|
||||||
|
@ -36,7 +38,7 @@ if which tmux &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the correct local config file to use.
|
# Set the correct local config file to use.
|
||||||
if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
|
if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && (( [[ -f $HOME/.tmux.conf ]] || -h $HOME/.tmux.conf ]] ))
|
||||||
then
|
then
|
||||||
#use this when they have a ~/.tmux.conf
|
#use this when they have a ~/.tmux.conf
|
||||||
export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf"
|
export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf"
|
||||||
|
@ -55,11 +57,11 @@ if which tmux &> /dev/null
|
||||||
# Try to connect to an existing session.
|
# Try to connect to an existing session.
|
||||||
elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
|
elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
|
||||||
then
|
then
|
||||||
\tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
|
\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
|
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
|
||||||
# Just run tmux, fixing the TERM variable if requested.
|
# Just run tmux, fixing the TERM variable if requested.
|
||||||
else
|
else
|
||||||
\tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
|
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
|
||||||
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
|
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue