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.

72 lines
2.1 KiB

3 years ago
  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=" %{$reset_color%}on%{$fg[blue]%} "
  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 [[ "$(hg config oh-my-zsh.hide-dirty 2>/dev/null)" != "1" ]]; then
  27. if [ -n "$(hg status 2>/dev/null)" ]; then
  28. echo -n "$YS_VCS_PROMPT_DIRTY"
  29. else
  30. echo -n "$YS_VCS_PROMPT_CLEAN"
  31. fi
  32. fi
  33. echo -n "$YS_VCS_PROMPT_SUFFIX"
  34. fi
  35. }
  36. # Virtualenv
  37. local venv_info='$(virtenv_prompt)'
  38. YS_THEME_VIRTUALENV_PROMPT_PREFIX=" %{$fg[green]%}"
  39. YS_THEME_VIRTUALENV_PROMPT_SUFFIX=" %{$reset_color%}%"
  40. virtenv_prompt() {
  41. [[ -n ${VIRTUAL_ENV} ]] || return
  42. echo "${YS_THEME_VIRTUALENV_PROMPT_PREFIX}${VIRTUAL_ENV:t}${YS_THEME_VIRTUALENV_PROMPT_SUFFIX}"
  43. }
  44. local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
  45. # Prompt format:
  46. #
  47. # PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] C:LAST_EXIT_CODE
  48. # $ COMMAND
  49. #
  50. # For example:
  51. #
  52. # % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] C:0
  53. # $
  54. PROMPT="
  55. %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
  56. %(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \
  57. %{$reset_color%}@ \
  58. %{$fg[green]%}%m \
  59. %{$reset_color%}in \
  60. %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
  61. ${hg_info}\
  62. ${git_info}\
  63. ${venv_info}\
  64. \
  65. [%*] $exit_code
  66. %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"