Improve zsh script to revert to default node version when exiting a .nvmrc directory.
parent
eb329ae7a9
commit
05a2d986a4
|
@ -199,6 +199,9 @@ autoload -U add-zsh-hook
|
||||||
load-nvmrc() {
|
load-nvmrc() {
|
||||||
if [[ -f .nvmrc && -r .nvmrc ]]; then
|
if [[ -f .nvmrc && -r .nvmrc ]]; then
|
||||||
nvm use
|
nvm use
|
||||||
|
elif [[ $(nvm version) != $(nvm version default) ]]; then
|
||||||
|
echo "Reverting to nvm default version"
|
||||||
|
nvm use default
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
add-zsh-hook chpwd load-nvmrc
|
add-zsh-hook chpwd load-nvmrc
|
||||||
|
|
Loading…
Reference in New Issue