From 0381fb68e03d1c7d89afcb6a10eeb3377aeec559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Thu, 13 Jun 2013 02:13:17 +0200 Subject: [PATCH] Optimize _lp_smart_mark Remove one _LP_SHELL_zsh test from runtime. Introduce _LP_MARK_SYMBOL. --- liquidprompt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/liquidprompt b/liquidprompt index 4edbfa5..ba8d509 100755 --- a/liquidprompt +++ b/liquidprompt @@ -63,6 +63,7 @@ if test -n "$BASH_VERSION" -a -n "$PS1" -a -n "$TERM" ; then _LP_USER_SYMBOL="\u" _LP_HOST_SYMBOL="\h" _LP_TIME_SYMBOL="\t" + _LP_MARK_SYMBOL='\$' _LP_FIRST_INDEX=0 elif test -n "$ZSH_VERSION" ; then _LP_SHELL_bash=false @@ -72,6 +73,7 @@ elif test -n "$ZSH_VERSION" ; then _LP_USER_SYMBOL="%n" _LP_HOST_SYMBOL="%m" _LP_TIME_SYMBOL="%*" + _LP_MARK_SYMBOL='%(!.#.%%)' _LP_FIRST_INDEX=1 else echo "liquidprompt: shell not supported" >&2 @@ -1309,10 +1311,8 @@ _lp_smart_mark() local mark if [[ -n "$LP_MARK_DEFAULT" ]]; then mark=$LP_MARK_DEFAULT - elif $_LP_SHELL_zsh; then - mark="%(!.#.%%)" else - mark="\\\$" + mark="$_LP_MARK_SYMBOL" fi if [[ "$1" == "git" ]]; then mark=$LP_MARK_GIT