142c03dbd223683fd2d99f878b68f0f075cf33fb

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

Message

Merge pull request #359 from theunraveler/master

Rewrite of plugin override

Diff

 1diff --git a/.gitignore b/.gitignore
 2index 4b555067e1fc5501b0ffccd0c21de1604845f3ae..8fdfae28646a98adc039755bd9bed94b628e7eea 100644
 3--- a/.gitignore
 4+++ b/.gitignore
 5@@ -2,5 +2,6 @@ locals.zsh
 6 log/.zsh_history
 7 projects.zsh
 8 custom/*
 9+!custom/example
10 !custom/example.zsh
11 cache
12diff --git a/README.textile b/README.textile
13index d01c3310a425d4a31017c2d22006575e6176c408..2dbfbe5a658d8bba2d387bbab272e189ab9e8fca 100644
14--- a/README.textile
15+++ b/README.textile
16@@ -48,7 +48,9 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo
17 h3. Customization
18 
19 If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
20-If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin.
21+If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
22+If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
23+
24 
25 h3. Uninstalling
26 
27@@ -68,4 +70,4 @@ This project wouldn't exist without all of our awesome users and contributors.
28 
29 * "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
30 
31-Thank you so much!
32+Thank you so much!
33diff --git a/custom/example/example.plugin.zsh b/custom/example/example.plugin.zsh
34new file mode 100644
35index 0000000000000000000000000000000000000000..406f27445b76feced2ff33e2d09b079f6739eca3
36--- /dev/null
37+++ b/custom/example/example.plugin.zsh
38@@ -0,0 +1,2 @@
39+# Add your own custom plugins in the custom/plugins directory. Plugins placed
40+# here will override ones with the same name in the main plugins directory.
41diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
42index c8f1a33b80f198fc94dbfa42c835f1a85640968a..dbff1ced9685d00d328b8543852c0ce0219f6c14 100644
43--- a/oh-my-zsh.sh
44+++ b/oh-my-zsh.sh
45@@ -17,7 +17,9 @@ compinit -i
46 
47 # Load all of the plugins that were defined in ~/.zshrc
48 for plugin ($plugins); do
49-  if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
50+  if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then
51+    source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh
52+  elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
53     source $ZSH/plugins/$plugin/$plugin.plugin.zsh
54   fi
55 done