Skip to content

Instantly share code, notes, and snippets.

@andrioid
Forked from jusopi/check.sh
Created October 4, 2017 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrioid/b2f3b80e30c6fe4f35d64eec68aa2b85 to your computer and use it in GitHub Desktop.
Save andrioid/b2f3b80e30c6fe4f35d64eec68aa2b85 to your computer and use it in GitHub Desktop.
Set node version per project using .nvmrc file
# change title name of tab in terminal
function title {
echo -ne "\033]0;"$*"\007"
}
enter_directory(){
if [ "$PWD" != "$PREV_PWD" ]; then
PREV_PWD="$PWD";
title $(echo ${PWD##*/}) $(node -v);
if [ -e ".nvmrc" ]; then
nvm use;
# set tab terminal name to be cwd and node version
title $(echo ${PWD##*/}) $(node -v);
fi
fi
}
export PROMPT_COMMAND=enter_directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment