Skip to content

Instantly share code, notes, and snippets.

@aghuddleston
Forked from jusopi/check.sh
Last active April 4, 2017 17:36
Show Gist options
  • Save aghuddleston/043c0df47a95aa7679dc152ada981e95 to your computer and use it in GitHub Desktop.
Save aghuddleston/043c0df47a95aa7679dc152ada981e95 to your computer and use it in GitHub Desktop.
Set node version per project using .nvmrc file
cd() {
builtin cd "$1"
if [ -f ".nvmrc" ]; then
nvm use
fi
}
#!/bin/sh
enter_directory(){
if [ "$PWD" != "$PREV_PWD" ]; then
PREV_PWD="$PWD";
if [ -e ".nvmrc" ]; then
nvm use;
fi
fi
}
export PROMPT_COMMAND="$PROMPT_COMMAND enter_directory;"
@aghuddleston
Copy link
Author

builtin cd and PROMPT_COMMAND alternatives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment