2019-03-24 17:25:26 +01:00
|
|
|
# Yay! High voltage and arrows!
|
|
|
|
|
|
|
|
|
|
|
|
function _virtualenv_prompt_info {
|
|
|
|
if [[ -n "$(whence virtualenv_prompt_info)" ]]; then
|
|
|
|
if [ -n "$(whence pyenv_prompt_info)" ]; then
|
|
|
|
if [ "$1" = "inline" ]; then
|
2019-12-19 03:07:30 +01:00
|
|
|
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=%F{blue}"::%F{red}"
|
2019-03-24 17:25:26 +01:00
|
|
|
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX=""
|
|
|
|
virtualenv_prompt_info
|
|
|
|
fi
|
|
|
|
[ "$(pyenv_prompt_info)" = "${PYENV_PROMPT_DEFAULT_VERSION}" ] && virtualenv_prompt_info
|
|
|
|
else
|
|
|
|
virtualenv_prompt_info
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
prompt_setup_pygmalion(){
|
2019-12-19 03:07:30 +01:00
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="%f%F{green}"
|
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%f "
|
|
|
|
ZSH_THEME_GIT_PROMPT_DIRTY="%F{yellow}⚡%f"
|
2019-03-24 17:25:26 +01:00
|
|
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
|
|
|
|
2019-12-19 03:07:30 +01:00
|
|
|
base_prompt='$(_virtualenv_prompt_info)%F{magenta}%n%f%F{cyan}@%f%F{yellow}%m%f%F{red}:%f%F{cyan}%0~%f%F{red}|%f'
|
|
|
|
post_prompt='%F{cyan}⇒%f '
|
2019-03-24 17:25:26 +01:00
|
|
|
|
|
|
|
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
|
|
|
|
post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
|
|
|
|
|
2019-11-19 18:47:12 +01:00
|
|
|
autoload -U add-zsh-hook
|
|
|
|
add-zsh-hook precmd prompt_pygmalion_precmd
|
2019-03-24 17:25:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
prompt_pygmalion_precmd(){
|
|
|
|
local gitinfo=$(git_prompt_info)
|
|
|
|
local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
|
|
|
|
local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
|
|
|
|
local prompt_length=${#exp_nocolor}
|
|
|
|
|
|
|
|
local nl=""
|
|
|
|
|
|
|
|
if [[ $prompt_length -gt 40 ]]; then
|
|
|
|
nl=$'\n%{\r%}';
|
|
|
|
fi
|
|
|
|
PROMPT="$base_prompt$gitinfo$nl$post_prompt"
|
|
|
|
}
|
|
|
|
|
|
|
|
prompt_setup_pygmalion
|