11b47690854306ba095869714a1a6be8c9debc73

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #709 from docwhat/custom-plugin-fpath

set fpath correctly for custom plugins

Diff

 1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 2index 891e8d467335aa42409b6ae331e32aaa86bcbd2b..7ae41c33e63fa1a384881d69a06119192e374cbb 100644
 3--- a/oh-my-zsh.sh
 4+++ b/oh-my-zsh.sh
 5@@ -13,20 +13,27 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
 6 # TIP: Add files you don't want in git to .gitignore
 7 for config_file ($ZSH/lib/*.zsh) source $config_file
 8 
 9-# Add all defined plugins to fpath
10+# Set ZSH_CUSTOM to the path where your custom config files
11+# and plugins exists, or else we will use the default custom/
12+if [[ -z "$ZSH_CUSTOM" ]]; then
13+    ZSH_CUSTOM="$ZSH/custom"
14+fi
15+
16+# Add all defined plugins to fpath. This must be done
17+# before running compinit.
18 plugin=${plugin:=()}
19-for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
20+for plugin ($plugins); do
21+  if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
22+    fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
23+  elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
24+    fpath=($ZSH/plugins/$plugin $fpath)
25+  fi
26+done
27 
28 # Load and run compinit
29 autoload -U compinit
30 compinit -i
31 
32-# Set ZSH_CUSTOM to the path where your custom config files
33-# and plugins exists, or else we will use the default custom/
34-if [ "$ZSH_CUSTOM" = ""  ]
35-then
36-    ZSH_CUSTOM="$ZSH/custom"
37-fi
38 
39 # Load all of the plugins that were defined in ~/.zshrc
40 for plugin ($plugins); do