Commit e31a5664bd7ba1c50ec94ae14e577f3b0a15c561
1 parent
0bceba95f5
Exists in
master
and in
2 other branches
oh-my-zsh.sh: env ZSH=$ZCFG/packages/oh-my-zsh
Showing 1 changed file with 1 additions and 1 deletions Inline Diff
repos/robbyrussell/oh-my-zsh/oh-my-zsh.sh
1 | # Check for updates on initial load... | 1 | # Check for updates on initial load... |
2 | if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then | 2 | if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then |
3 | env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh | 3 | env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh |
4 | fi | 4 | fi |
5 | 5 | ||
6 | env ZSH=$ZCFG/packages/oh-my-zsh | 6 | export ZSH=$ZCFG/packages/oh-my-zsh |
7 | 7 | ||
8 | # Initializes Oh My Zsh | 8 | # Initializes Oh My Zsh |
9 | 9 | ||
10 | # add a function path | 10 | # add a function path |
11 | fpath=($ZSH/functions $ZSH/completions $fpath) | 11 | fpath=($ZSH/functions $ZSH/completions $fpath) |
12 | 12 | ||
13 | # Set ZSH_CUSTOM to the path where your custom config files | 13 | # Set ZSH_CUSTOM to the path where your custom config files |
14 | # and plugins exists, or else we will use the default custom/ | 14 | # and plugins exists, or else we will use the default custom/ |
15 | if [[ -z "$ZSH_CUSTOM" ]]; then | 15 | if [[ -z "$ZSH_CUSTOM" ]]; then |
16 | ZSH_CUSTOM="$ZSH/custom" | 16 | ZSH_CUSTOM="$ZSH/custom" |
17 | fi | 17 | fi |
18 | 18 | ||
19 | # Set ZSH_CACHE_DIR to the path where cache files sould be created | 19 | # Set ZSH_CACHE_DIR to the path where cache files sould be created |
20 | # or else we will use the default cache/ | 20 | # or else we will use the default cache/ |
21 | if [[ -z "$ZSH_CACHE_DIR" ]]; then | 21 | if [[ -z "$ZSH_CACHE_DIR" ]]; then |
22 | ZSH_CACHE_DIR="$ZSH/cache/" | 22 | ZSH_CACHE_DIR="$ZSH/cache/" |
23 | fi | 23 | fi |
24 | 24 | ||
25 | 25 | ||
26 | # Load all of the config files in ~/oh-my-zsh that end in .zsh | 26 | # Load all of the config files in ~/oh-my-zsh that end in .zsh |
27 | # TIP: Add files you don't want in git to .gitignore | 27 | # TIP: Add files you don't want in git to .gitignore |
28 | for config_file ($ZSH/lib/*.zsh); do | 28 | for config_file ($ZSH/lib/*.zsh); do |
29 | custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}" | 29 | custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}" |
30 | [ -f "${custom_config_file}" ] && config_file=${custom_config_file} | 30 | [ -f "${custom_config_file}" ] && config_file=${custom_config_file} |
31 | source $config_file | 31 | source $config_file |
32 | done | 32 | done |
33 | 33 | ||
34 | 34 | ||
35 | is_plugin() { | 35 | is_plugin() { |
36 | local base_dir=$1 | 36 | local base_dir=$1 |
37 | local name=$2 | 37 | local name=$2 |
38 | test -f $base_dir/plugins/$name/$name.plugin.zsh \ | 38 | test -f $base_dir/plugins/$name/$name.plugin.zsh \ |
39 | || test -f $base_dir/plugins/$name/_$name | 39 | || test -f $base_dir/plugins/$name/_$name |
40 | } | 40 | } |
41 | # Add all defined plugins to fpath. This must be done | 41 | # Add all defined plugins to fpath. This must be done |
42 | # before running compinit. | 42 | # before running compinit. |
43 | for plugin ($plugins); do | 43 | for plugin ($plugins); do |
44 | if is_plugin $ZSH_CUSTOM $plugin; then | 44 | if is_plugin $ZSH_CUSTOM $plugin; then |
45 | fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) | 45 | fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) |
46 | elif is_plugin $ZSH $plugin; then | 46 | elif is_plugin $ZSH $plugin; then |
47 | fpath=($ZSH/plugins/$plugin $fpath) | 47 | fpath=($ZSH/plugins/$plugin $fpath) |
48 | fi | 48 | fi |
49 | done | 49 | done |
50 | 50 | ||
51 | # Figure out the SHORT hostname | 51 | # Figure out the SHORT hostname |
52 | if [[ "$OSTYPE" = darwin* ]]; then | 52 | if [[ "$OSTYPE" = darwin* ]]; then |
53 | # OS X's $HOST changes with dhcp, etc. Use ComputerName if possible. | 53 | # OS X's $HOST changes with dhcp, etc. Use ComputerName if possible. |
54 | SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/} | 54 | SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/} |
55 | else | 55 | else |
56 | SHORT_HOST=${HOST/.*/} | 56 | SHORT_HOST=${HOST/.*/} |
57 | fi | 57 | fi |
58 | 58 | ||
59 | # Save the location of the current completion dump file. | 59 | # Save the location of the current completion dump file. |
60 | if [ -z "$ZSH_COMPDUMP" ]; then | 60 | if [ -z "$ZSH_COMPDUMP" ]; then |
61 | ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" | 61 | ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" |
62 | fi | 62 | fi |
63 | 63 | ||
64 | # Load and run compinit | 64 | # Load and run compinit |
65 | autoload -U compinit | 65 | autoload -U compinit |
66 | compinit -i -d "${ZSH_COMPDUMP}" | 66 | compinit -i -d "${ZSH_COMPDUMP}" |
67 | 67 | ||
68 | # Load all of the plugins that were defined in ~/.zshrc | 68 | # Load all of the plugins that were defined in ~/.zshrc |
69 | for plugin ($plugins); do | 69 | for plugin ($plugins); do |
70 | if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then | 70 | if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then |
71 | source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh | 71 | source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh |
72 | elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then | 72 | elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then |
73 | source $ZSH/plugins/$plugin/$plugin.plugin.zsh | 73 | source $ZSH/plugins/$plugin/$plugin.plugin.zsh |
74 | fi | 74 | fi |
75 | done | 75 | done |
76 | 76 | ||
77 | # Load all of your custom configurations from custom/ | 77 | # Load all of your custom configurations from custom/ |
78 | for config_file ($ZSH_CUSTOM/*.zsh(N)); do | 78 | for config_file ($ZSH_CUSTOM/*.zsh(N)); do |
79 | source $config_file | 79 | source $config_file |
80 | done | 80 | done |
81 | unset config_file | 81 | unset config_file |
82 | 82 | ||
83 | # Load the theme | 83 | # Load the theme |
84 | if [ "$ZSH_THEME" = "random" ]; then | 84 | if [ "$ZSH_THEME" = "random" ]; then |
85 | themes=($ZSH/themes/*zsh-theme) | 85 | themes=($ZSH/themes/*zsh-theme) |
86 | N=${#themes[@]} | 86 | N=${#themes[@]} |
87 | ((N=(RANDOM%N)+1)) | 87 | ((N=(RANDOM%N)+1)) |
88 | RANDOM_THEME=${themes[$N]} | 88 | RANDOM_THEME=${themes[$N]} |
89 | source "$RANDOM_THEME" | 89 | source "$RANDOM_THEME" |
90 | echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." | 90 | echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." |
91 | else | 91 | else |
92 | if [ ! "$ZSH_THEME" = "" ]; then | 92 | if [ ! "$ZSH_THEME" = "" ]; then |
93 | if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then | 93 | if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then |
94 | source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" | 94 | source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" |
95 | elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then | 95 | elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then |
96 | source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" | 96 | source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" |
97 | else | 97 | else |
98 | source "$ZSH/themes/$ZSH_THEME.zsh-theme" | 98 | source "$ZSH/themes/$ZSH_THEME.zsh-theme" |
99 | fi | 99 | fi |
100 | fi | 100 | fi |
101 | fi | 101 | fi |
102 | 102 |