Skip to content

Commit

Permalink
Merge pull request holman#66 from rcarver/source-path-first
Browse files Browse the repository at this point in the history
make sure $PATH is setup first
  • Loading branch information
holman committed Jan 19, 2013
2 parents 2cc1dfb + 167404e commit 6a470d8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.markdown
Expand Up @@ -60,6 +60,10 @@ There's a few special files in the hierarchy.
available everywhere.
- **topic/\*.zsh**: Any files ending in `.zsh` get loaded into your
environment.
- **topic/path.zsh**: Any file named `path.zsh` is loaded first and is
expected to setup `$PATH` or similar.
- **topic/completion.zsh**: Any file named `completion.zsh` is loaded
last and is expected to setup autocomplete.
- **topic/\*.symlink**: Any files ending in `*.symlink` get symlinked into
your `$HOME`. This is so you can keep all of those versioned in your dotfiles
but still keep those autoloaded files in your home directory. These get
Expand Down
24 changes: 21 additions & 3 deletions zsh/zshrc.symlink
Expand Up @@ -4,8 +4,21 @@ export ZSH=$HOME/.dotfiles
# your project folder that we can `c [tab]` to
export PROJECTS=~/Code

# source every .zsh file in this rep
for config_file ($ZSH/**/*.zsh) [[ "$(basename $config_file)" == "completion.zsh" ]] || source $config_file
# all of our zsh files
typeset -U config_files
config_files=($ZSH/**/*.zsh)

# load the path files
for file in ${(M)config_files:#*/path.zsh}
do
source $file
done

# load everything but the path and completion files
for file in ${${config_files:#*/path.zsh}:#*/completion.zsh}
do
source $file
done

# use .localrc for SUPER SECRET CRAP that you don't
# want in your public, versioned repo.
Expand All @@ -19,4 +32,9 @@ autoload -U compinit
compinit

# load every completion after autocomplete loads
for config_file ($ZSH/**/completion.zsh) source $config_file
for file in ${(M)config_files:#*/completion.zsh}
do
source $file
done

unset config_files

0 comments on commit 6a470d8

Please sign in to comment.