-
-
Save zdway10/5a8d5019124c3107531191cc50d5be84 to your computer and use it in GitHub Desktop.
bash function for load .nvmrc automatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for nvm | |
export NVM_DIR="$HOME/.nvm" | |
. "$(brew --prefix nvm)/nvm.sh" | |
load-nvmrc() { | |
if [[ -f .nvmrc && -r .nvmrc ]]; then | |
nvm use | |
elif [[ $(nvm version) != $(nvm version default) ]]; then | |
echo "Reverting to nvm default version" | |
nvm use default | |
fi | |
} | |
cd() { builtin cd "$@"; 'load-nvmrc'; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment