Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. # Location: .oh-my-zsh/custom/themes/pygmalion.zsh-theme
  2.  
  3. # Yay! High voltage and arrows!
  4.  
  5. prompt_setup_pygmalion(){
  6. ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
  7. ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
  8. ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✘%{$reset_color%}"
  9. ZSH_THEME_GIT_PROMPT_CLEAN="✔"
  10.  
  11. base_prompt='%{$fg[blue]%}%*%{$fg[green]%} %{%(1j. [%1j] .)%} %{$fg[cyan]%}%n%{$fg[magenta]%} @ %{$fg[yellow]%}%m%{$fg[black]%} %{$fg[cyan]%}%0~%{$fg[red]%} %{$fg[red]%}%{%(?.. [%?] )%} %{$reset_color%}'
  12. post_prompt='%{$fg[cyan]%}Your wish is my command%{$fg[blue]%} ➜ %{$reset_color%}'
  13.  
  14. base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
  15. post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
  16.  
  17. precmd_functions+=(prompt_pygmalion_precmd)
  18. }
  19.  
  20. prompt_pygmalion_precmd(){
  21. local gitinfo=$(git_prompt_info)
  22. local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
  23. local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
  24. local prompt_length=${#exp_nocolor}
  25.  
  26. local nl=""
  27.  
  28. if [[ $prompt_length -gt 1 ]]; then
  29. nl=$'\n%{\r%}';
  30. fi
  31. PROMPT="$base_prompt$gitinfo$nl$post_prompt"
  32. }
  33.  
  34. prompt_setup_pygmalion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement