mlh.zsh-theme 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # The Official Theme of Major League Hacking
  2. ## ## ## ## ##
  3. ### ### ## ## ##
  4. #### #### ## ## ##
  5. ## ### ## ## #########
  6. ## ## ## ## ##
  7. ## ## ## ## ##
  8. ## ## ######## ## ##
  9. # # # # # # # # # # # # # # # # # #
  10. # # # Feel free to customize! # # #
  11. # # # # # # # # # # # # # # # # # #
  12. # To customize symbols (e.g MLH_AT_SYMBOL), simply set them as environment variables
  13. # for example in your ~/.zshrc file, like this:
  14. # MLH_AT_SYMBOL=" at "
  15. #
  16. # Settings *must* be set before sourcing oh-my-zsh.sh the .zshrc file.
  17. #
  18. # To easily discover colors and their codes, type `spectrum_ls` in the terminal
  19. # right prompt default settings
  20. if [ -z "$MLH_PRINT_EXIT_CODE" ]; then
  21. MLH_PRINT_EXIT_CODE=true
  22. fi
  23. if [ -z "$MLH_PRINT_TIME" ]; then
  24. MLH_PRINT_TIME=false
  25. fi
  26. # left prompt symbols default settings
  27. if [ -z "$MLH_AT_SYMBOL" ]; then
  28. MLH_AT_SYMBOL="@"
  29. fi
  30. if [ -z "$MLH_IN_SYMBOL" ]; then
  31. MLH_IN_SYMBOL=" in "
  32. fi
  33. if [ -z "$MLH_ON_SYMBOL" ]; then
  34. MLH_ON_SYMBOL=" on "
  35. fi
  36. if [ -z "$MLH_SHELL_SYMBOL" ]; then
  37. MLH_SHELL_SYMBOL="$ "
  38. fi
  39. if [ -z "$MLH_SHELL_SYMBOL_ROOT" ]; then
  40. MLH_SHELL_SYMBOL_ROOT="# "
  41. fi
  42. # colors
  43. USER_COLOR="%F{001}"
  44. DEVICE_COLOR="%F{033}"
  45. DIR_COLOR="%F{220}"
  46. BRANCH_COLOR="%F{001}"
  47. TIME_COLOR="%F{033}"
  48. username() {
  49. echo "$USER_COLOR%n%f"
  50. }
  51. # Prints device name
  52. device() {
  53. echo "$DEVICE_COLOR%m%f"
  54. }
  55. # Prints the current directory
  56. directory() {
  57. echo "$DIR_COLOR%1~%f"
  58. }
  59. # Prints current time
  60. current_time() {
  61. if [ "$MLH_PRINT_TIME" = true ]; then
  62. echo " $TIME_COLOR%*%f"
  63. fi
  64. }
  65. # Prints exit code of the last executed command
  66. exit_code() {
  67. if [ "$MLH_PRINT_EXIT_CODE" = true ]; then
  68. echo "%(?..%F{001}exit %?)%f"
  69. fi
  70. }
  71. prompt_end() {
  72. if [ "$UID" -eq 0 ]; then
  73. printf "\n$MLH_SHELL_SYMBOL_ROOT"
  74. else
  75. printf "\n$MLH_SHELL_SYMBOL"
  76. fi
  77. }
  78. # Set git_prompt_info text
  79. ZSH_THEME_GIT_PROMPT_PREFIX="${MLH_ON_SYMBOL}${BRANCH_COLOR}"
  80. ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
  81. ZSH_THEME_GIT_PROMPT_DIRTY=""
  82. ZSH_THEME_GIT_PROMPT_CLEAN=""
  83. # %B and %b make the text bold
  84. PROMPT='%b$(username)$MLH_AT_SYMBOL$(device)$MLH_IN_SYMBOL$(directory)$(git_prompt_info)%b$(prompt_end)'
  85. RPROMPT="$(exit_code)$(current_time)"