oh-my-zsh.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # Add all defined plugins to fpath
  13. plugin=${plugin:=()}
  14. for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
  15. # Load and run compinit
  16. autoload -U compinit
  17. compinit -i
  18. # Set ZSH_CUSTOM to the path where your custom config files
  19. # and plugins exists, or else we will use the default custom/
  20. if [ "$ZSH_CUSTOM" = "" ]
  21. then
  22. ZSH_CUSTOM="$ZSH/custom"
  23. fi
  24. # Load all of the plugins that were defined in ~/.zshrc
  25. for plugin ($plugins); do
  26. if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
  27. source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
  28. elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
  29. source $ZSH/plugins/$plugin/$plugin.plugin.zsh
  30. fi
  31. done
  32. # Load all of your custom configurations from custom/
  33. for config_file ($ZSH_CUSTOM/*.zsh) source $config_file
  34. # Load the theme
  35. if [ "$ZSH_THEME" = "random" ]
  36. then
  37. themes=($ZSH/themes/*zsh-theme)
  38. N=${#themes[@]}
  39. ((N=(RANDOM%N)+1))
  40. RANDOM_THEME=${themes[$N]}
  41. source "$RANDOM_THEME"
  42. echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
  43. else
  44. if [ ! "$ZSH_THEME" = "" ]
  45. then
  46. source "$ZSH/themes/$ZSH_THEME.zsh-theme"
  47. fi
  48. fi