bash: save and set shell option promptvars
This commit is contained in:
parent
943144cd12
commit
62f0270888
@ -1721,11 +1721,13 @@ prompt_on()
|
|||||||
LP_OLD_PS1="$PS1"
|
LP_OLD_PS1="$PS1"
|
||||||
if $_LP_SHELL_bash; then
|
if $_LP_SHELL_bash; then
|
||||||
LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
|
LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
|
||||||
|
LP_OLD_SHOPT="$(shopt -p promptvars)"
|
||||||
else # zsh
|
else # zsh
|
||||||
LP_OLD_PROMPT_COMMAND="$(whence -f precmd)"
|
LP_OLD_PROMPT_COMMAND="$(whence -f precmd)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if $_LP_SHELL_bash; then
|
if $_LP_SHELL_bash; then
|
||||||
|
shopt -s promptvars
|
||||||
PROMPT_COMMAND=_lp_set_prompt
|
PROMPT_COMMAND=_lp_set_prompt
|
||||||
[[ "$LP_DEBUG_TIME" == 1 ]] && PROMPT_COMMAND="time $PROMPT_COMMAND"
|
[[ "$LP_DEBUG_TIME" == 1 ]] && PROMPT_COMMAND="time $PROMPT_COMMAND"
|
||||||
else # zsh
|
else # zsh
|
||||||
@ -1752,6 +1754,7 @@ prompt_off()
|
|||||||
{
|
{
|
||||||
PS1=$LP_OLD_PS1
|
PS1=$LP_OLD_PS1
|
||||||
if $_LP_SHELL_bash; then
|
if $_LP_SHELL_bash; then
|
||||||
|
eval "$LP_OLD_SHOPT"
|
||||||
PROMPT_COMMAND="$LP_OLD_PROMPT_COMMAND"
|
PROMPT_COMMAND="$LP_OLD_PROMPT_COMMAND"
|
||||||
else # zsh
|
else # zsh
|
||||||
precmd() { : ; }
|
precmd() { : ; }
|
||||||
@ -1764,6 +1767,7 @@ prompt_OFF()
|
|||||||
{
|
{
|
||||||
PS1="\$ "
|
PS1="\$ "
|
||||||
if $_LP_SHELL_bash; then
|
if $_LP_SHELL_bash; then
|
||||||
|
shopt -u promptvars
|
||||||
PROMPT_COMMAND="$LP_OLD_PROMPT_COMMAND"
|
PROMPT_COMMAND="$LP_OLD_PROMPT_COMMAND"
|
||||||
else # zsh
|
else # zsh
|
||||||
precmd() { : ; }
|
precmd() { : ; }
|
||||||
|
Loading…
Reference in New Issue
Block a user