Skip to content

Instantly share code, notes, and snippets.

Avatar

Pierre Thibault Pierre-Thibault

View GitHub Profile
@sndrs
sndrs / auto_nvm_use.sh
Last active Apr 19, 2021 — forked from jusopi/check.sh
Automatically set node version per project using .nvmrc file
View auto_nvm_use.sh
# This will run `nvm use` everytime you change directory, if
# 1. an .nvmrc file is present
# 2. there is no .nvmrc but you're not using your default node
# Add it to your `.bash_profile` (or wherever else is suitable for your setup).
enter_directory(){
if [ "$PWD" != "$PREV_PWD" ]; then
PREV_PWD="$PWD";
if [ -e ".nvmrc" ]; then
nvm use;