Add section about "Deeper shell integration"

Also adds a snippet for zsh user to auto-issue `nvm use` when entering a
directory.
Tobias Witt 2016-03-08 18:30:14 +01:00
parent e76221fd15
commit ae70d558cb
No known key found for this signature in database
GPG Key ID: F4AB9D0041E48E7E
1 changed files with 22 additions and 0 deletions

View File

@ -157,6 +157,28 @@ To use a mirror of the iojs binaries, set `$NVM_IOJS_ORG_MIRROR`:
`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs. `nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs.
### Deeper Shell Integration
Those options are all optional and not supported. We are accepting pull requests for more examples.
#### Zsh
##### Calling `nvm use` automatically in a directory with a `.nvmrc` file
Put this into your `$HOME/.zshrc` to call `nvm use` automatically whenever you enter a directory that contains an
`.nvmrc` file with a string telling nvm which node to `use`:
```zsh
autoload -U add-zsh-hook
load-nvmrc() {
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
fi
}
add-zsh-hook chpwd load-nvmrc
```
## License ## License
nvm is released under the MIT license. nvm is released under the MIT license.