Add RPS1 support to fresh prompt theme
* Python virtualenv name * Docker machine name
This commit is contained in:
parent
e58b9ba032
commit
85d5d549a5
@ -19,7 +19,7 @@ prompt_fresh_setup() {
|
||||
PS1="«$user» "
|
||||
PS2="${(l:$length + 1:: :)}» "
|
||||
|
||||
# TODO: RPS1
|
||||
RPS1='$(fresh_rprompt)'
|
||||
|
||||
prompt_opts=(cr percent sp subst)
|
||||
}
|
||||
@ -104,6 +104,17 @@ fresh_precmd() {
|
||||
fi
|
||||
}
|
||||
|
||||
fresh_rprompt() {
|
||||
rprompt=""
|
||||
if [[ ! -z "$DOCKER_MACHINE_NAME" ]]; then
|
||||
rprompt="$rprompt %{%F{3}%}$DOCKER_MACHINE_NAME%{%f%}"
|
||||
fi
|
||||
if [[ ! -z "$VIRTUAL_ENV" ]]; then
|
||||
rprompt="$rprompt %{%F{3}%}$(basename $VIRTUAL_ENV)%{%f%}"
|
||||
fi
|
||||
echo $rprompt
|
||||
}
|
||||
|
||||
visible_length() {
|
||||
echo $(( ${#${(S%%)1//(\%(KF1]|)\{*\}|\%[Bbkf])}} ))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user