Commit 0bceba95f5fd2251466aee98b662e31dcc642330

Authored by mj
1 parent e03f7bf878
Exists in master and in 2 other branches 02-merge, dev

oh-my-zsh.sh: env ZSH=$ZCFG/packages/oh-my-zsh

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