Guest User

Untitled

a guest
Feb 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. # NVM version shortcut
  2. # change title name of tab in terminal
  3. function title {
  4.     echo -ne "\033]0;"$*"\007"
  5. }
  6.  
  7. cd() {
  8.   builtin cd "$@" || return
  9.   #echo $PREV_PWD
  10.   if [ "$PWD" != "$PREV_PWD" ]; then
  11.     PREV_PWD="$PWD";
  12.     title $(echo ${PWD##*/}) $(node -v);
  13.     if [ -e ".nvmrc" ]; then
  14.       nvm use;
  15.       # set tab terminal name to be cwd and node version
  16.       title $(echo ${PWD##*/}) $(node -v);
  17.     else
  18.       nvm use default;
  19.     fi
  20.   fi
  21. }
Add Comment
Please, Sign In to add comment