my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.8 KiB

3 years ago
  1. # Yay! High voltage and arrows!
  2. function _virtualenv_prompt_info {
  3. if [[ -n "$(whence virtualenv_prompt_info)" ]]; then
  4. if [ -n "$(whence pyenv_prompt_info)" ]; then
  5. if [ "$1" = "inline" ]; then
  6. ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=%{$fg[blue]%}"::%{$fg[red]%}"
  7. ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX=""
  8. virtualenv_prompt_info
  9. fi
  10. [ "$(pyenv_prompt_info)" = "${PYENV_PROMPT_DEFAULT_VERSION}" ] && virtualenv_prompt_info
  11. else
  12. virtualenv_prompt_info
  13. fi
  14. fi
  15. }
  16. prompt_setup_pygmalion(){
  17. setopt localoptions extendedglob
  18. ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
  19. ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
  20. ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
  21. ZSH_THEME_GIT_PROMPT_CLEAN=""
  22. base_prompt='$(_virtualenv_prompt_info)%{$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%}'
  23. post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
  24. base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}}
  25. post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}}
  26. autoload -U add-zsh-hook
  27. add-zsh-hook precmd prompt_pygmalion_precmd
  28. }
  29. prompt_pygmalion_precmd(){
  30. setopt localoptions nopromptsubst extendedglob
  31. local gitinfo=$(git_prompt_info)
  32. local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
  33. local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")"
  34. local prompt_length=${#exp_nocolor}
  35. # add new line on prompt longer than 40 characters
  36. local nl=""
  37. if [[ $prompt_length -gt 40 ]]; then
  38. nl=$'\n%{\r%}'
  39. fi
  40. PROMPT="${base_prompt}\$(git_prompt_info)${nl}${post_prompt}"
  41. }
  42. prompt_setup_pygmalion