Make tcsh check whether some variables are defined or empty

Makes it consistent with other shells
This commit is contained in:
ZyX 2014-08-23 04:30:22 +04:00
parent 8e77262f2d
commit 03c22e94a7
2 changed files with 12 additions and 6 deletions

View File

@ -145,9 +145,3 @@ tcsh you should set ``$POWERLINE_NO_TCSH_ABOVE`` or
If you do not want to see additional space which is added to the right prompt in If you do not want to see additional space which is added to the right prompt in
fish in order to support multiline prompt you should set fish in order to support multiline prompt you should set
``$POWERLINE_NO_FISH_ABOVE`` or ``$POWERLINE_NO_SHELL_ABOVE`` variables. ``$POWERLINE_NO_FISH_ABOVE`` or ``$POWERLINE_NO_SHELL_ABOVE`` variables.
.. note::
Most supported shells configuration scripts check for ``$POWERLINE_CONFIG``
and ``$POWERLINE_COMMAND`` configuration variables being empty. But tcsh
configuration script checks for variables being *defined*, not empty.

View File

@ -11,6 +11,14 @@ if ! $?POWERLINE_CONFIG then
else else
set POWERLINE_CONFIG="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config" set POWERLINE_CONFIG="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config"
endif endif
else
if "$POWERLINE_CONFIG" == "" then
if ( { which powerline-config > /dev/null } ) then
set POWERLINE_CONFIG="powerline-config"
else
set POWERLINE_CONFIG="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config"
endif
endif
endif endif
if ( { $POWERLINE_CONFIG shell --shell=tcsh uses tmux } ) then if ( { $POWERLINE_CONFIG shell --shell=tcsh uses tmux } ) then
alias _powerline_tmux_set_pwd 'if ( $?TMUX && { tmux refresh -S >&/dev/null } ) tmux setenv -g TMUX_PWD_`tmux display -p "#D" | tr -d %` $PWD:q ; if ( $?TMUX ) tmux refresh -S >&/dev/null' alias _powerline_tmux_set_pwd 'if ( $?TMUX && { tmux refresh -S >&/dev/null } ) tmux setenv -g TMUX_PWD_`tmux display -p "#D" | tr -d %` $PWD:q ; if ( $?TMUX ) tmux refresh -S >&/dev/null'
@ -19,6 +27,10 @@ endif
if ( { $POWERLINE_CONFIG shell --shell=tcsh uses prompt } ) then if ( { $POWERLINE_CONFIG shell --shell=tcsh uses prompt } ) then
if ! $?POWERLINE_COMMAND then if ! $?POWERLINE_COMMAND then
set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`" set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`"
else
if "$POWERLINE_COMMAND" == "" then
set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`"
endif
endif endif
if ( $?POWERLINE_NO_TCSH_ABOVE || $?POWERLINE_NO_SHELL_ABOVE ) then if ( $?POWERLINE_NO_TCSH_ABOVE || $?POWERLINE_NO_SHELL_ABOVE ) then