Merge pull request #1076 from ejinotti/master

[Docs] Improve zsh script in README
Jordan Harband 2016-05-06 10:24:07 -07:00
commit a551306275
1 changed files with 5 additions and 0 deletions

View File

@ -195,13 +195,18 @@ Put this into your `$HOME/.zshrc` to call `nvm use` automatically whenever you e
`.nvmrc` file with a string telling nvm which node to `use`:
```zsh
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
elif [[ $(nvm version) != $(nvm version default) ]]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
```
## License