Load zsh customizations from custom/zsh/before/* and custom/zsh/after/* instead of filename globbing [Close #79]

* File pattern globbing was too brittle. If you had plugins incorrectly
   named, or had only a before or after directory, things would break in
   nonobvious ways.
This commit is contained in:
yan 2012-04-05 11:49:43 -07:00
parent fbcdf9aa0c
commit b292a7a33f
4 changed files with 6 additions and 6 deletions

View File

@ -165,7 +165,7 @@ mnemonic aliases. Please feel free to edit them:
### How To Customize ZSH
YADR allows you to completely customize your ZSH without having to fork and maintain the project. Here's how it works: YADR will
source (include) any files matching the pattern `*.before.zsh` or `*.after.zsh` in the `custom/zsh` directory. `before` files are
source (include) any files in `.yadr/custom/zsh/before/*` or `.yadr/custom/zsh/after/*`. The `before` files are
useful for setting the theme and plugins. `after` files allow you to override options set by YADR, define your own aliases, etc.
To make your life easier, create a `zsh` folder in your Dropbox (or as a git repo) and symlink it into `~/.yadr/custom`. Do it like this:

View File

@ -19,11 +19,11 @@ if [[ -d $HOME/.oh-my-zsh ]]; then
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(vi-mode git rvm ruby rails autojump bundler gem gnu-utils heroku rake redis-cli zsh-syntax-highlighting history-substring-search)
plugins=(vi-mode git rvm ruby rails autojump bundler gem gnu-utils heroku rake redis-cli zsh-syntax-highlighting history-substring-search ssh-agent)
# source every zsh file in user's custom/zsh/before. This is useful for setting theme and plugins.
if [[ -d $yadr/custom/zsh/ ]]; then
for config_file ($yadr/custom/zsh/**/*.before.zsh) source $config_file
if [[ -d $yadr/custom/zsh/before ]]; then
for config_file ($yadr/custom/zsh/before/*) source $config_file
fi
# Source oh-my-zsh
@ -55,8 +55,8 @@ fi
# zsh/after
# ==================
# source every zsh file in user's custom/zsh/after.
if [[ -d $yadr/custom/zsh/ ]]; then
for config_file ($yadr/custom/zsh/**/*.after.zsh) source $config_file
if [[ -d $yadr/custom/zsh/after ]]; then
for config_file ($yadr/custom/zsh/after/*) source $config_file
fi
# Put secret configuration settings in ~/.secrets