ys.zsh-theme 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 and the font Inconsolata.
  4. # Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
  5. #
  6. # http://ysmood.org/wp/2013/03/my-ys-terminal-theme/
  7. # Mar 2013 ys
  8. # Machine name.
  9. function box_name {
  10. [ -f ~/.box-name ] && cat ~/.box-name || echo $HOST
  11. }
  12. # Directory info.
  13. local current_dir='${PWD/#$HOME/~}'
  14. # Git info.
  15. local git_info='$(git_prompt_info)'
  16. ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}on%{$reset_color%} git:%{$fg[cyan]%}"
  17. ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
  18. ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x"
  19. ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}o"
  20. # Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $
  21. PROMPT="
  22. %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
  23. %{$fg[cyan]%}%n \
  24. %{$fg[white]%}at \
  25. %{$fg[green]%}$(box_name) \
  26. %{$fg[white]%}in \
  27. %{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
  28. ${git_info} \
  29. %{$fg[white]%}[%*]
  30. %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
  31. if [[ "$USER" == "root" ]]; then
  32. PROMPT="
  33. %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
  34. %{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \
  35. %{$fg[white]%}at \
  36. %{$fg[green]%}$(box_name) \
  37. %{$fg[white]%}in \
  38. %{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
  39. ${git_info} \
  40. %{$fg[white]%}[%*]
  41. %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
  42. fi