Fix bug with counting existing sessions
This commit is contained in:
parent
d6ffbf1ffc
commit
ac2a4bb235
@ -70,6 +70,11 @@ if which tmux &> /dev/null
|
|||||||
[[ -n $INACTIVE_SESSIONS ]] && echo $INACTIVE_SESSIONS
|
[[ -n $INACTIVE_SESSIONS ]] && echo $INACTIVE_SESSIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _all_sessions {
|
||||||
|
ALL_SESSIONS=`tmux ls | grep "$ZSH_TMUX_SESSION_NAME_PREFIX" | cut -d: -f1`
|
||||||
|
[[ -n $ALL_SESSIONS ]] && echo $ALL_SESSIONS
|
||||||
|
}
|
||||||
|
|
||||||
# Wrapper function for tmux.
|
# Wrapper function for tmux.
|
||||||
function _zsh_tmux_plugin_run()
|
function _zsh_tmux_plugin_run()
|
||||||
{
|
{
|
||||||
@ -85,7 +90,7 @@ if which tmux &> /dev/null
|
|||||||
then
|
then
|
||||||
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach -t `_inactive_sessions | head -n1`
|
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach -t `_inactive_sessions | head -n1`
|
||||||
else
|
else
|
||||||
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session -s "$ZSH_TMUX_SESSION_NAME_PREFIX`_inactive_sessions | tail -n1 | cut -d- -f4 | _incr`"
|
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session -s "$ZSH_TMUX_SESSION_NAME_PREFIX`_incr $(_all_sessions | tail -n1 | cut -d- -f4)`"
|
||||||
fi
|
fi
|
||||||
[[ "$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.
|
||||||
|
Loading…
Reference in New Issue
Block a user