You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file)
48
-
-[fish](#fish)
49
-
-[Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file-1)
44
+
-[Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file)
45
+
-[bash](#bash)
46
+
-[zsh](#zsh)
47
+
-[fish](#fish)
50
48
-[Running Tests](#running-tests)
51
49
-[Environment variables](#environment-variables)
52
50
-[Bash Completion](#bash-completion)
@@ -575,52 +573,53 @@ You can also use [`nvshim`](https://github.com/iamogbz/nvshim) to shim the `node
575
573
576
574
If you prefer a lighter-weight solution, the recipes below have been contributed by `nvm` users. They are **not** supported by the `nvm` maintainers. We are, however, accepting pull requests for more examples.
577
575
578
-
#### bash
576
+
#### Calling `nvm use` automatically in a directory with a `.nvmrc` file
579
577
580
-
##### Automatically call `nvm use`
578
+
In your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`), add the following to `nvm use` whenever you enter a new directory:
579
+
580
+
##### bash
581
581
582
582
Put the following at the end of your `$HOME/.bashrc`:
This alias would search 'up' from your current directory in order to detect a `.nvmrc` file. If it finds it, it will switch to that version;if not, it will use the default version.
633
632
634
-
#### zsh
633
+
##### zsh
635
634
636
-
##### Calling `nvm use` automatically in a directory with a `.nvmrc` file
635
+
This shell functionwill install (if needed) and `nvm use`the specified Node version when an`.nvmrc`is found, and `nvm use default` otherwise.
637
636
638
637
Put this into your `$HOME/.zshrc` to call `nvm use` automatically whenever you enter a directory that contains an
639
638
`.nvmrc` file with a string telling nvm which node to `use`:
@@ -665,9 +664,8 @@ add-zsh-hook chpwd load-nvmrc
665
664
load-nvmrc
666
665
```
667
666
668
-
#### fish
667
+
##### fish
669
668
670
-
##### Calling `nvm use` automatically in a directory with a `.nvmrc` file
671
669
This requires that you have [bass](https://github.com/edc/bass) installed.
0 commit comments