pygmalion.zsh-theme 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. # Yay! High voltage and arrows!
  2. prompt_setup_pygmalion(){
  3. setopt localoptions extendedglob
  4. ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
  5. ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
  6. ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
  7. ZSH_THEME_GIT_PROMPT_CLEAN=""
  8. 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%}'
  9. post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
  10. base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}}
  11. post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}}
  12. autoload -U add-zsh-hook
  13. add-zsh-hook precmd prompt_pygmalion_precmd
  14. }
  15. prompt_pygmalion_precmd(){
  16. setopt localoptions nopromptsubst extendedglob
  17. local gitinfo=$(git_prompt_info)
  18. local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
  19. local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")"
  20. local prompt_length=${#exp_nocolor}
  21. PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}"
  22. }
  23. prompt_setup_pygmalion