summaryrefslogtreecommitdiff
path: root/oh-my-zsh.sh
diff options
context:
space:
mode:
Diffstat (limited to 'oh-my-zsh.sh')
-rw-r--r--oh-my-zsh.sh33
1 files changed, 22 insertions, 11 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index 3c0f4f8f5..bc7a8e496 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -1,6 +1,6 @@
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
- /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
+ env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
fi
# Initializes Oh My Zsh
@@ -8,18 +8,27 @@ fi
# add a function path
fpath=($ZSH/functions $ZSH/completions $fpath)
-# Load all of the config files in ~/oh-my-zsh that end in .zsh
-# TIP: Add files you don't want in git to .gitignore
-for config_file ($ZSH/lib/*.zsh); do
- source $config_file
-done
-
# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom"
fi
+# Set ZSH_CACHE_DIR to the path where cache files sould be created
+# or else we will use the default cache/
+if [[ -z "$ZSH_CACHE_DIR" ]]; then
+ ZSH_CACHE_DIR="$ZSH/cache/"
+fi
+
+
+# Load all of the config files in ~/oh-my-zsh that end in .zsh
+# TIP: Add files you don't want in git to .gitignore
+for config_file ($ZSH/lib/*.zsh); do
+ custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
+ [ -f "${custom_config_file}" ] && config_file=${custom_config_file}
+ source $config_file
+done
+
is_plugin() {
local base_dir=$1
@@ -38,15 +47,17 @@ for plugin ($plugins); do
done
# Figure out the SHORT hostname
-if [ -n "$commands[scutil]" ]; then
- # OS X
- SHORT_HOST=$(scutil --get ComputerName)
+if [[ "$OSTYPE" = darwin* ]]; then
+ # OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
+ SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
else
SHORT_HOST=${HOST/.*/}
fi
# Save the location of the current completion dump file.
-ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
+if [ -z "$ZSH_COMPDUMP" ]; then
+ ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
+fi
# Load and run compinit
autoload -U compinit