Merge branch 'fix-tmux-support' into develop

Ref #672
This commit is contained in:
ZyX 2014-03-21 19:33:40 +04:00
commit f9764b9c98
4 changed files with 17 additions and 17 deletions

View File

@ -10,8 +10,7 @@ if test -z "${POWERLINE_COMMAND}" ; then
fi fi
_powerline_init_tmux_support() { _powerline_init_tmux_support() {
# Note: `test -w ""` returns false, so first condition may be removed if test -n "$TMUX" && tmux source-file /dev/null &>/dev/null ; then
if test -n "$TMUX" && test -w "$TMUX" ; then
# TMUX variable may be unset to create new tmux session inside this one # TMUX variable may be unset to create new tmux session inside this one
_POWERLINE_TMUX="$TMUX" _POWERLINE_TMUX="$TMUX"

View File

@ -20,7 +20,8 @@ function powerline-setup
" "
end end
_powerline_update _powerline_update
if test -w "$TMUX" if test -n "$TMUX"
if tmux source-file /dev/null ^/dev/null
function _powerline_tmux_setenv function _powerline_tmux_setenv
tmux setenv -g TMUX_$argv[1]_(tmux display -p "#D" | tr -d "%") "$argv[2]" tmux setenv -g TMUX_$argv[1]_(tmux display -p "#D" | tr -d "%") "$argv[2]"
tmux refresh -S tmux refresh -S
@ -35,3 +36,4 @@ function powerline-setup
_powerline_tmux_set_pwd _powerline_tmux_set_pwd
end end
end end
end

View File

@ -14,7 +14,7 @@ if ! $?POWERLINE_COMMAND then
setenv POWERLINE_COMMAND $POWERLINE_SOURCED:h:h:h:h:q/scripts/powerline setenv POWERLINE_COMMAND $POWERLINE_SOURCED:h:h:h:h:q/scripts/powerline
endif endif
endif endif
alias _powerline_tmux_set_pwd 'if ( $?TMUX && { test -w $TMUX:q } ) tmux setenv -g TMUX_PWD_`tmux display -p "#D" | tr -d %` $PWD:q ; if ( $?TMUX && { test -w $TMUX:q } ) tmux refresh -S' alias _powerline_tmux_set_pwd 'if ( $?TMUX && { tmux source-file /dev/null >&/dev/null } ) tmux setenv -g TMUX_PWD_`tmux display -p "#D" | tr -d %` $PWD:q ; if ( $?TMUX && { tmux source-file /dev/null >&/dev/null } ) tmux refresh -S'
alias _powerline_set_prompt 'set prompt="`$POWERLINE_COMMAND shell left -r tcsh_prompt --last_exit_code=$?`"' alias _powerline_set_prompt 'set prompt="`$POWERLINE_COMMAND shell left -r tcsh_prompt --last_exit_code=$?`"'
alias _powerline_set_rprompt 'set rprompt="`$POWERLINE_COMMAND shell right -r tcsh_prompt --last_exit_code=$?` "' alias _powerline_set_rprompt 'set rprompt="`$POWERLINE_COMMAND shell right -r tcsh_prompt --last_exit_code=$?` "'
alias cwdcmd "`alias cwdcmd` ; _powerline_tmux_set_pwd" alias cwdcmd "`alias cwdcmd` ; _powerline_tmux_set_pwd"

View File

@ -12,8 +12,7 @@ integer _POWERLINE_JOBNUM
_powerline_init_tmux_support() { _powerline_init_tmux_support() {
emulate -L zsh emulate -L zsh
# Note: `test -w ""` returns false, so first condition may be removed if test -n "$TMUX" && tmux source-file /dev/null &>/dev/null ; then
if test -n "$TMUX" && test -w "$TMUX" ; then
# TMUX variable may be unset to create new tmux session inside this one # TMUX variable may be unset to create new tmux session inside this one
typeset -g _POWERLINE_TMUX="$TMUX" typeset -g _POWERLINE_TMUX="$TMUX"