Skip to content

Instantly share code, notes, and snippets.

@HariantoAtWork
Forked from jusopi/check.sh
Last active October 10, 2022 10:58
Show Gist options
  • Select an option

  • Save HariantoAtWork/368af0901e1268681426ed91a871c977 to your computer and use it in GitHub Desktop.

Select an option

Save HariantoAtWork/368af0901e1268681426ed91a871c977 to your computer and use it in GitHub Desktop.
Set node version per project using .nvmrc file
#!/bin/sh
enter_directory(){
if [ "$PWD" != "$PREV_PWD" ]; then
PREV_PWD="$PWD";
if [ -e ".nvmrc" ]; then
nvm use;
fi
fi
}
export PROMPT_COMMAND="$PROMP_COMMAND enter_directory;"
# for .zshrc
# precmd() { eval "$PROMPT_COMMAND enter_directory;" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment