Added RPS1 for ZSH prompts

This commit is contained in:
Austen Adler 2015-01-05 16:48:47 -05:00
parent 899dbe2727
commit c82958bc83

View File

@ -273,6 +273,7 @@ _lp_source_config()
LP_USER_ALWAYS=${LP_USER_ALWAYS:-1} LP_USER_ALWAYS=${LP_USER_ALWAYS:-1}
LP_PERCENTS_ALWAYS=${LP_PERCENTS_ALWAYS:-1} LP_PERCENTS_ALWAYS=${LP_PERCENTS_ALWAYS:-1}
LP_PS1=${LP_PS1:-""} LP_PS1=${LP_PS1:-""}
LP_RPS1=${LP_RPS1:-""}
LP_PS1_PREFIX=${LP_PS1_PREFIX:-""} LP_PS1_PREFIX=${LP_PS1_PREFIX:-""}
LP_PS1_POSTFIX=${LP_PS1_POSTFIX:-""} LP_PS1_POSTFIX=${LP_PS1_POSTFIX:-""}
LP_TITLE_OPEN=${LP_TITLE_OPEN:-"\e]0;"} LP_TITLE_OPEN=${LP_TITLE_OPEN:-"\e]0;"}
@ -1670,6 +1671,39 @@ _lp_set_prompt()
source "$LP_PS1_FILE" source "$LP_PS1_FILE"
fi fi
if $_LP_SHELL_zsh; then
# If ZSH, use PS1 and RPS1
if [[ -z "$LP_PS1" ]] ; then
# add title, host, and permissions colon
PS1="${LP_PS1_PREFIX}${LP_JOBS}${LP_BRACKET_OPEN}${LP_USER}${LP_HOST}${LP_PERM}"
# Add current directory, software collections, virtual enviornment, and proxy
PS1="${PS1}${LP_PWD}${LP_BRACKET_CLOSE}${LP_SCLS}${LP_VENV}${LP_PROXY}"
# Add VCS infos
# If root, the info has not been collected unless LP_ENABLE_VCS_ROOT
# is set.
PS1="${PS1}${LP_VCS}"
# add return code and prompt mark
PS1="${PS1}${LP_RUNTIME}${LP_ERR}${LP_MARK_PREFIX}${LP_MARK}${LP_PS1_POSTFIX}"
# "invisible" parts
# Get the current prompt on the fly and make it a title
LP_TITLE="$(_lp_title "$PS1")"
# Insert it in the prompt
PS1="${LP_TITLE}${PS1}"
else
PS1=$LP_PS1
fi
if [[ -z "$LP_RPS1" ]] ; then
RPS1="${LP_TIME}${LP_LOAD}${LP_TEMP}${LP_BATT}"
else
RPS1=$LP_RPS1
fi
else
# If not ZSH, use only PS1
if [[ -z "$LP_PS1" ]] ; then if [[ -z "$LP_PS1" ]] ; then
# add title escape time, jobs, load and battery # add title escape time, jobs, load and battery
PS1="${LP_PS1_PREFIX}${LP_TIME}${LP_BATT}${LP_LOAD}${LP_TEMP}${LP_JOBS}" PS1="${LP_PS1_PREFIX}${LP_TIME}${LP_BATT}${LP_LOAD}${LP_TEMP}${LP_JOBS}"
@ -1700,6 +1734,7 @@ _lp_set_prompt()
else else
PS1=$LP_PS1 PS1=$LP_PS1
fi fi
fi
} }
prompt_tag() prompt_tag()