-
-
Save pokorson/a7f7529d1e463fd6464811e0a7831ec8 to your computer and use it in GitHub Desktop.
bash function for load .nvmrc automatically
This file contains 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