oh-my-zsh.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Check for updates on initial load...
  2. if [ "$DISABLE_AUTO_UPDATE" != "true" ]
  3. then
  4. /usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh
  5. fi
  6. # Initializes Oh My Zsh
  7. # add a function path
  8. fpath=($ZSH/functions $ZSH/completions $fpath)
  9. # Load all of the config files in ~/oh-my-zsh that end in .zsh
  10. # TIP: Add files you don't want in git to .gitignore
  11. for config_file ($ZSH/lib/*.zsh) source $config_file
  12. # Set ZSH_CUSTOM to the path where your custom config files
  13. # and plugins exists, or else we will use the default custom/
  14. if [[ -z "$ZSH_CUSTOM" ]]; then
  15. ZSH_CUSTOM="$ZSH/custom"
  16. fi
  17. # Add all defined plugins to fpath. This must be done
  18. # before running compinit.
  19. plugin=${plugin:=()}
  20. for plugin ($plugins); do
  21. if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
  22. fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
  23. elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
  24. fpath=($ZSH/plugins/$plugin $fpath)
  25. fi
  26. done
  27. # Load and run compinit
  28. autoload -U compinit
  29. compinit -i
  30. # Load all of the plugins that were defined in ~/.zshrc
  31. for plugin ($plugins); do
  32. if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
  33. source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
  34. elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
  35. source $ZSH/plugins/$plugin/$plugin.plugin.zsh
  36. fi
  37. done
  38. # Load all of your custom configurations from custom/
  39. for config_file ($ZSH_CUSTOM/*.zsh) source $config_file
  40. # Load the theme
  41. if [ "$ZSH_THEME" = "random" ]
  42. then
  43. themes=($ZSH/themes/*zsh-theme)
  44. N=${#themes[@]}
  45. ((N=(RANDOM%N)+1))
  46. RANDOM_THEME=${themes[$N]}
  47. source "$RANDOM_THEME"
  48. echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
  49. else
  50. if [ ! "$ZSH_THEME" = "" ]
  51. then
  52. if [ -f "$ZSH/custom/$ZSH_THEME.zsh-theme" ]
  53. then
  54. source "$ZSH/custom/$ZSH_THEME.zsh-theme"
  55. else
  56. source "$ZSH/themes/$ZSH_THEME.zsh-theme"
  57. fi
  58. fi
  59. fi