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.sh38
1 files changed, 28 insertions, 10 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index 891e8d467..732a403b7 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -13,20 +13,33 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
# TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh) source $config_file
-# Add all defined plugins to fpath
-plugin=${plugin:=()}
-for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
+# 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
+
+
+is_plugin() {
+ local base_dir=$1
+ local name=$2
+ test -f $base_dir/plugins/$name/$name.plugin.zsh \
+ || test -f $base_dir/plugins/$name/_$name
+}
+# Add all defined plugins to fpath. This must be done
+# before running compinit.
+for plugin ($plugins); do
+ if is_plugin $ZSH_CUSTOM $plugin; then
+ fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
+ elif is_plugin $ZSH $plugin; then
+ fpath=($ZSH/plugins/$plugin $fpath)
+ fi
+done
# Load and run compinit
autoload -U compinit
compinit -i
-# Set ZSH_CUSTOM to the path where your custom config files
-# and plugins exists, or else we will use the default custom/
-if [ "$ZSH_CUSTOM" = "" ]
-then
- ZSH_CUSTOM="$ZSH/custom"
-fi
# Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do
@@ -52,7 +65,12 @@ then
else
if [ ! "$ZSH_THEME" = "" ]
then
- source "$ZSH/themes/$ZSH_THEME.zsh-theme"
+ if [ -f "$ZSH/custom/$ZSH_THEME.zsh-theme" ]
+ then
+ source "$ZSH/custom/$ZSH_THEME.zsh-theme"
+ else
+ source "$ZSH/themes/$ZSH_THEME.zsh-theme"
+ fi
fi
fi