Adds NVM support

[Closes #3]
This commit is contained in:
Caio Gondim
2014-07-12 19:33:05 +02:00
parent 0713e187d9
commit 6ef64892eb
2 changed files with 17 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ simplicity, showing information only when it's relevant.
It currently shows: It currently shows:
- Current Python virtualenv - Current Python virtualenv
- Current Ruby version and gemset, through RVM - Current Ruby version and gemset, through RVM
- Current Node.js version, through NVM
- Git status - Git status
- Timestamp - Timestamp
- Current directory - Current directory

View File

@@ -18,13 +18,17 @@ VIRTUAL_ENV_DISABLE_PROMPT=true
BULLETTRAIN_STATUS_BG=black BULLETTRAIN_STATUS_BG=black
BULLETTRAIN_STATUS_FG=default BULLETTRAIN_STATUS_FG=default
BULLETTRAIN_TIME_BG=green BULLETTRAIN_TIME_BG=cyan
BULLETTRAIN_TIME_FG=white BULLETTRAIN_TIME_FG=white
BULLETRTAIN_VIRTUALENV_BG=yellow BULLETRTAIN_VIRTUALENV_BG=yellow
BULLETRTAIN_VIRTUALENV_FG=white BULLETRTAIN_VIRTUALENV_FG=white
BULLETRTAIN_VIRTUALENV_SYMBOL=🐍 BULLETRTAIN_VIRTUALENV_SYMBOL=🐍
BULLETTRAIN_NVM_PREFIX="⬡ "
BULLETTRAIN_NVM_BG=green
BULLETTRAIN_NVM_FG=white
BULLETTRAIN_RVM_BG=magenta BULLETTRAIN_RVM_BG=magenta
BULLETTRAIN_RVM_FG=white BULLETTRAIN_RVM_FG=white
BULLETTRAIN_RVM_SYMBOL=♦️ BULLETTRAIN_RVM_SYMBOL=♦️
@@ -171,6 +175,16 @@ prompt_virtualenv() {
fi fi
} }
# NVM: Node version manager
prompt_nvm() {
[[ `which nvm` != "nvm not found" ]] || return
local nvm_prompt
nvm_prompt=$(node -v 2>/dev/null)
[[ "${nvm_prompt}x" == "x" ]] && return
nvm_prompt=${nvm_prompt:1}
prompt_segment $BULLETTRAIN_NVM_BG $BULLETTRAIN_NVM_FG $BULLETTRAIN_NVM_PREFIX$nvm_prompt
}
prompt_time() { prompt_time() {
prompt_segment $BULLETTRAIN_TIME_BG $BULLETTRAIN_TIME_FG %D{%H:%M:%S} prompt_segment $BULLETTRAIN_TIME_BG $BULLETTRAIN_TIME_FG %D{%H:%M:%S}
} }
@@ -200,6 +214,7 @@ build_prompt() {
prompt_time prompt_time
prompt_rvm prompt_rvm
prompt_virtualenv prompt_virtualenv
prompt_nvm
# prompt_context # prompt_context
prompt_dir prompt_dir
prompt_git prompt_git