mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 22:31:51 +00:00
Merge 70954086e7
into a57fe846e8
This commit is contained in:
commit
3aedf3ff25
19
README.md
19
README.md
@ -21,7 +21,7 @@
|
||||
- [.nvmrc](#nvmrc)
|
||||
- [Deeper Shell Integration](#deeper-shell-integration)
|
||||
- [zsh](#zsh)
|
||||
- [Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file)
|
||||
- [bash](#bash)
|
||||
- [License](#license)
|
||||
- [Running tests](#running-tests)
|
||||
- [Bash completion](#bash-completion)
|
||||
@ -351,10 +351,8 @@ If you prefer a lighter-weight solution, the recipes below have been contributed
|
||||
|
||||
#### 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`:
|
||||
`.nvmrc` file with a string telling nvm which node to use:
|
||||
|
||||
```zsh
|
||||
# place this after nvm initialization!
|
||||
@ -380,6 +378,19 @@ add-zsh-hook chpwd load-nvmrc
|
||||
load-nvmrc
|
||||
```
|
||||
|
||||
#### bash
|
||||
|
||||
Put this into your `$HOME/.bashrc` to call `nvm use` automatically whenever you enter a directory that contains an
|
||||
`.nvmrc` file with a string telling nvm which node to use:
|
||||
|
||||
```bash
|
||||
# place this after nvm initialization!
|
||||
cd() {
|
||||
builtin cd "$1"
|
||||
[ -f ".nvmrc" ] && [ -s ".nvmrc" ] && nvm use
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
nvm is released under the MIT license.
|
||||
|
Loading…
Reference in New Issue
Block a user