Skip to content

Commit

Permalink
Fix LP_OLD_PROMPT_COMMAND to work with zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
Panayiotis Kkolos authored and dolmen committed Jun 27, 2014
1 parent b493986 commit 81b080e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions liquidprompt
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,11 @@ _lp_set_prompt()
local IFS="$_LP_IFS"

# execute the old prompt
eval "$LP_OLD_PROMPT_COMMAND"
if $_LP_SHELL_bash; then
eval "$LP_OLD_PROMPT_COMMAND"
else # zsh
eval "${${LP_OLD_PROMPT_COMMAND#*$'\n'}%$'\n'*}"
fi

# left of main prompt: space at right
LP_JOBS="$(_lp_sr "$(_lp_jobcount_color)")"
Expand Down Expand Up @@ -1708,7 +1712,7 @@ prompt_on()
if $_LP_SHELL_bash; then
LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
else # zsh
LP_OLD_PROMPT_COMMAND="$precmd"
LP_OLD_PROMPT_COMMAND="$(whence -f precmd)"
fi
fi
if $_LP_SHELL_bash; then
Expand Down Expand Up @@ -1740,7 +1744,8 @@ prompt_off()
if $_LP_SHELL_bash; then
PROMPT_COMMAND="$LP_OLD_PROMPT_COMMAND"
else # zsh
precmd="$LP_OLD_PROMPT_COMMAND"
precmd() { : ; }
eval "$LP_OLD_PROMPT_COMMAND"
fi
}

Expand All @@ -1751,7 +1756,8 @@ prompt_OFF()
if $_LP_SHELL_bash; then
PROMPT_COMMAND="$LP_OLD_PROMPT_COMMAND"
else # zsh
precmd="$LP_OLD_PROMPT_COMMAND"
precmd() { : ; }
eval "$LP_OLD_PROMPT_COMMAND"
fi
}

Expand Down

0 comments on commit 81b080e

Please sign in to comment.