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
Copy file name to clipboardExpand all lines: README.md
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -599,8 +599,9 @@ cdnvm() {
599
599
fi
600
600
fi
601
601
}
602
+
602
603
alias cd='cdnvm'
603
-
cd"$PWD"
604
+
cdnvm"$PWD"||exit
604
605
```
605
606
606
607
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.
@@ -615,11 +616,14 @@ Put this into your `$HOME/.zshrc` to call `nvm use` automatically whenever you e
615
616
```zsh
616
617
# place this after nvm initialization!
617
618
autoload -U add-zsh-hook
619
+
618
620
load-nvmrc() {
619
-
local nvmrc_path="$(nvm_find_nvmrc)"
621
+
local nvmrc_path
622
+
nvmrc_path="$(nvm_find_nvmrc)"
620
623
621
624
if [ -n"$nvmrc_path" ];then
622
-
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
625
+
local nvmrc_node_version
626
+
nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
0 commit comments