Simply add to your ~/.bashrc
:
enter_directory() {
if [[ $PWD == $PREV_PWD ]]; then return; fi
PREV_PWD=$PWD
nodefile=.node-version
[[ -f "$nodefile" ]] && nvm use $(cat $nodefile)
}
export PROMPT_COMMAND=enter_directory
If you’re using ZSH, place in your ~/.zshrc
:
chpwd() {
if [[ $PWD == $PREV_PWD ]]; then return; fi
PREV_PWD=$PWD
nodefile=.node-version
[[ -a "$nodefile" ]] && nvm use $(cat $nodefile)
}
None
Comments
Empty! You must sign in to add comments.