pygmalion.zsh-theme 1.1 KB

12345678910111213141516171819202122232425262728
  1. # Yay! High voltage and arrows!
  2. prompt_setup_pygmalion(){
  3. ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
  4. ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
  5. ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
  6. ZSH_THEME_GIT_PROMPT_CLEAN=""
  7. base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}'
  8. post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
  9. base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
  10. post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
  11. autoload -U add-zsh-hook
  12. add-zsh-hook precmd prompt_pygmalion_precmd
  13. }
  14. prompt_pygmalion_precmd(){
  15. local gitinfo=$(git_prompt_info)
  16. local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
  17. local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
  18. local prompt_length=${#exp_nocolor}
  19. PROMPT="${base_prompt}${gitinfo}${post_prompt}"
  20. }
  21. prompt_setup_pygmalion