Browse code

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

set fpath correctly for custom plugins

Robby Russell authored on 15/12/2011 at 05:56:45
Showing 1 changed files
... ...
@@ -13,20 +13,27 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
13 13
 # TIP: Add files you don't want in git to .gitignore
14 14
 for config_file ($ZSH/lib/*.zsh) source $config_file
15 15
 
16
-# Add all defined plugins to fpath
16
+# Set ZSH_CUSTOM to the path where your custom config files
17
+# and plugins exists, or else we will use the default custom/
18
+if [[ -z "$ZSH_CUSTOM" ]]; then
19
+    ZSH_CUSTOM="$ZSH/custom"
20
+fi
21
+
22
+# Add all defined plugins to fpath. This must be done
23
+# before running compinit.
17 24
 plugin=${plugin:=()}
18
-for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
25
+for plugin ($plugins); do
26
+  if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
27
+    fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
28
+  elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
29
+    fpath=($ZSH/plugins/$plugin $fpath)
30
+  fi
31
+done
19 32
 
20 33
 # Load and run compinit
21 34
 autoload -U compinit
22 35
 compinit -i
23 36
 
24
-# Set ZSH_CUSTOM to the path where your custom config files
25
-# and plugins exists, or else we will use the default custom/
26
-if [ "$ZSH_CUSTOM" = ""  ]
27
-then
28
-    ZSH_CUSTOM="$ZSH/custom"
29
-fi
30 37
 
31 38
 # Load all of the plugins that were defined in ~/.zshrc
32 39
 for plugin ($plugins); do