-
-
Save andrioid/b2f3b80e30c6fe4f35d64eec68aa2b85 to your computer and use it in GitHub Desktop.
Set node version per project using .nvmrc file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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