mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
Fixing iTerm Tmux integration (branch off upstream/master)
This commit is contained in:
parent
d485044169
commit
dee0ac0129
1 changed files with 25 additions and 7 deletions
|
|
@ -31,7 +31,7 @@ if which tmux &> /dev/null
|
||||||
# The TERM to use for 256 color terminals.
|
# The TERM to use for 256 color terminals.
|
||||||
# Tmux states this should be screen-256color, but you may need to change it on
|
# Tmux states this should be screen-256color, but you may need to change it on
|
||||||
# systems without the proper terminfo
|
# systems without the proper terminfo
|
||||||
[[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color"
|
[[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="xterm-256color"
|
||||||
|
|
||||||
|
|
||||||
# Get the absolute path to the current directory
|
# Get the absolute path to the current directory
|
||||||
|
|
@ -46,7 +46,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 [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
|
if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -e "$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"
|
||||||
|
|
@ -58,19 +58,37 @@ if which tmux &> /dev/null
|
||||||
# Wrapper function for tmux.
|
# Wrapper function for tmux.
|
||||||
function _zsh_tmux_plugin_run()
|
function _zsh_tmux_plugin_run()
|
||||||
{
|
{
|
||||||
|
if [[ "$ZSH_TMUX_ITERM2" == "true" ]]
|
||||||
|
then _fix='-CC'
|
||||||
|
else _fix=''
|
||||||
|
fi
|
||||||
|
if [[ "$ZSH_TMUX_FIXTERM" == "true" && "$ZSH_TMUX_ITERM2" == "false" ]]
|
||||||
|
then _file="-f $_ZSH_TMUX_FIXED_CONFIG"
|
||||||
|
else _file='' # Can't use -f with -CC
|
||||||
|
fi
|
||||||
|
if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]
|
||||||
|
then _exit='exit'
|
||||||
|
else _exit=''
|
||||||
|
fi
|
||||||
# We have other arguments, just run them
|
# We have other arguments, just run them
|
||||||
if [[ -n "$@" ]]
|
if [[ -n "$@" ]]
|
||||||
then
|
then
|
||||||
\tmux $@
|
\tmux "$@"
|
||||||
# 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 `[[ "$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 (tmux has)
|
||||||
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
|
then
|
||||||
|
\tmux $_fix attach
|
||||||
|
$_exit
|
||||||
|
else
|
||||||
|
\tmux $_fix $_file new
|
||||||
|
$_exit
|
||||||
|
fi
|
||||||
# Just run tmux, fixing the TERM variable if requested.
|
# Just run tmux, fixing the TERM variable if requested.
|
||||||
else
|
else
|
||||||
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
|
\tmux $_fix $_file new
|
||||||
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
|
$_exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue