ys.zsh-theme 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Clean, simple, compatible and meaningful.
  2. # Tested on Linux, Unix and Windows under ANSI colors.
  3. # It is recommended to use with a dark background.
  4. # Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
  5. #
  6. # Mar 2013 Yad Smood
  7. # VCS
  8. YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} "
  9. YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}"
  10. YS_VCS_PROMPT_SUFFIX="%{$reset_color%}"
  11. YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x"
  12. YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o"
  13. # Git info
  14. local git_info='$(git_prompt_info)'
  15. ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}"
  16. ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX"
  17. ZSH_THEME_GIT_PROMPT_DIRTY="$YS_VCS_PROMPT_DIRTY"
  18. ZSH_THEME_GIT_PROMPT_CLEAN="$YS_VCS_PROMPT_CLEAN"
  19. # HG info
  20. local hg_info='$(ys_hg_prompt_info)'
  21. ys_hg_prompt_info() {
  22. # make sure this is a hg dir
  23. if [ -d '.hg' ]; then
  24. echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}"
  25. echo -n $(hg branch 2>/dev/null)
  26. if [ -n "$(hg status 2>/dev/null)" ]; then
  27. echo -n "$YS_VCS_PROMPT_DIRTY"
  28. else
  29. echo -n "$YS_VCS_PROMPT_CLEAN"
  30. fi
  31. echo -n "$YS_VCS_PROMPT_SUFFIX"
  32. fi
  33. }
  34. # Prompt format:
  35. #
  36. # PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] L:SHELL_LEVEL N:LINE_NUM
  37. # $ COMMAND
  38. #
  39. # For example:
  40. #
  41. # % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] tty:s000 L:1 N:12
  42. # $
  43. PROMPT="
  44. %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
  45. %(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \
  46. %{$fg[white]%}@ \
  47. %{$fg[green]%}%m \
  48. %{$fg[white]%}in \
  49. %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
  50. ${hg_info}\
  51. ${git_info} \
  52. %{$fg[white]%}[%*] tty:%l L:%L N:%i
  53. %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"