Created
August 22, 2018 19:25
-
-
Save inorganik/5262b072fb88323ed403deadb3840a96 to your computer and use it in GitHub Desktop.
nvmrc hook for bash profile
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
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
enter_directory() { | |
if [[ $PWD == $PREV_PWD ]]; then | |
return | |
fi | |
PREV_PWD=$PWD | |
[[ -f ".nvmrc" ]] && nvm use | |
} | |
export PROMPT_COMMAND=enter_directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment