af-magic.zsh-theme 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # af-magic.zsh-theme
  2. # Repo: https://github.com/andyfleming/oh-my-zsh
  3. # Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
  4. # settings
  5. typeset +H return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
  6. typeset +H my_gray="$FG[237]"
  7. typeset +H my_orange="$FG[214]"
  8. # separator dashes size
  9. function afmagic_dashes {
  10. local PYTHON_ENV="$VIRTUAL_ENV"
  11. [[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV"
  12. if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then
  13. echo $(( COLUMNS - ${#PYTHON_ENV} - 3 ))
  14. else
  15. echo $COLUMNS
  16. fi
  17. }
  18. # primary prompt
  19. PS1='$FG[237]${(l.$(afmagic_dashes)..-.)}%{$reset_color%}
  20. $FG[032]%~$(git_prompt_info)$(hg_prompt_info) $FG[105]%(!.#.»)%{$reset_color%} '
  21. PS2='%{$fg[red]%}\ %{$reset_color%}'
  22. RPS1='${return_code}'
  23. # right prompt
  24. (( $+functions[virtualenv_prompt_info] )) && RPS1+='$(virtualenv_prompt_info)'
  25. RPS1+=' $my_gray%n@%m%{$reset_color%}%'
  26. # git settings
  27. ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]"
  28. ZSH_THEME_GIT_PROMPT_CLEAN=""
  29. ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
  30. ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
  31. # hg settings
  32. ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]"
  33. ZSH_THEME_HG_PROMPT_CLEAN=""
  34. ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
  35. ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
  36. # virtualenv settings
  37. ZSH_THEME_VIRTUALENV_PREFIX=" $FG[075]["
  38. ZSH_THEME_VIRTUALENV_SUFFIX="]%{$reset_color%}"