Merge pull request #114 from alexlafroscia/add-nvm-prompt-segment

Add nvm prompt segment
This commit is contained in:
Ben Hilburn 2015-10-17 20:12:38 -07:00
commit d459ec0983
2 changed files with 12 additions and 0 deletions

View file

@ -755,6 +755,17 @@ prompt_php_version() {
fi
}
# Node version from NVM
# Only prints the segment if different than the default value
prompt_nvm() {
local node_version=$(nvm current)
local nvm_default=$(cat $NVM_DIR/alias/default)
[[ -z "${node_version}" ]] && return
[[ "$node_version" =~ "$nvm_default" ]] && return
NODE_ICON=$'\u2B22' # ⬢
$1_prompt_segment "$0" "green" "011" "${node_version:1} $NODE_ICON"
}
# rbenv information
prompt_rbenv() {
if [[ -n "$RBENV_VERSION" ]]; then