From 03c22e94a7833c352be89c916fcacd6cb565e682 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 23 Aug 2014 04:30:22 +0400 Subject: [PATCH] Make tcsh check whether some variables are defined or empty Makes it consistent with other shells --- docs/source/configuration/local.rst | 6 ------ powerline/bindings/tcsh/powerline.tcsh | 12 ++++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/source/configuration/local.rst b/docs/source/configuration/local.rst index 316e83c6..c66b5c78 100644 --- a/docs/source/configuration/local.rst +++ b/docs/source/configuration/local.rst @@ -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 fish in order to support multiline prompt you should set ``$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. diff --git a/powerline/bindings/tcsh/powerline.tcsh b/powerline/bindings/tcsh/powerline.tcsh index ac93341b..fafdb39b 100644 --- a/powerline/bindings/tcsh/powerline.tcsh +++ b/powerline/bindings/tcsh/powerline.tcsh @@ -11,6 +11,14 @@ if ! $?POWERLINE_CONFIG then else set POWERLINE_CONFIG="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config" 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 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' @@ -19,6 +27,10 @@ endif if ( { $POWERLINE_CONFIG shell --shell=tcsh uses prompt } ) then if ! $?POWERLINE_COMMAND then set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`" + else + if "$POWERLINE_COMMAND" == "" then + set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`" + endif endif if ( $?POWERLINE_NO_TCSH_ABOVE || $?POWERLINE_NO_SHELL_ABOVE ) then