mlh.zsh-theme 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. # colors
  40. USER_COLOR="%F{001}"
  41. DEVICE_COLOR="%F{033}"
  42. DIR_COLOR="%F{220}"
  43. BRANCH_COLOR="%F{001}"
  44. TIME_COLOR="%F{033}"
  45. username() {
  46. echo "$USER_COLOR%n%f"
  47. }
  48. # Prints device name
  49. device() {
  50. echo "$DEVICE_COLOR%m%f"
  51. }
  52. # Prints the current directory
  53. directory() {
  54. echo "$DIR_COLOR%1~%f"
  55. }
  56. # Prints current time
  57. current_time() {
  58. if [ "$MLH_PRINT_TIME" = true ]; then
  59. echo " $TIME_COLOR%*%f"
  60. fi
  61. }
  62. # Prints exit code of the last executed command
  63. exit_code() {
  64. if [ "$MLH_PRINT_EXIT_CODE" = true ]; then
  65. echo "%(?..%F{001}exit %?)%f"
  66. fi
  67. }
  68. prompt_end() {
  69. printf "\n$MLH_SHELL_SYMBOL"
  70. }
  71. # Set git_prompt_info text
  72. ZSH_THEME_GIT_PROMPT_PREFIX="${MLH_ON_SYMBOL}${BRANCH_COLOR}"
  73. ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
  74. ZSH_THEME_GIT_PROMPT_DIRTY=""
  75. ZSH_THEME_GIT_PROMPT_CLEAN=""
  76. # %B and %b make the text bold
  77. PROMPT='%b$(username)$MLH_AT_SYMBOL$(device)$MLH_IN_SYMBOL$(directory)$(git_prompt_info)%b$(prompt_end)'
  78. RPROMPT="$(exit_code)$(current_time)"