summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2017-05-23 04:32:41 +0300
committerGitHub <noreply@github.com>2017-05-23 04:32:41 +0300
commit6f7e88474d3990ad296652274469bcc8735378c1 (patch)
tree97dc6c5b4c94ae2ae4b5c808309d98bbdf643bc2 /powerlevel9k.zsh-theme
parent325e01b9f265e78c8c88ad88bc6342aa07302dcc (diff)
parent38d5f4d056027984290f97ea60ede9cc74494f3e (diff)
Merge pull request #526 from docwhat/pr/nvm-current
nvm: improve default detection
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme13
1 files changed, 8 insertions, 5 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 291439ef..2f2a682d 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -906,13 +906,16 @@ prompt_node_version() {
# Node version from NVM
# Only prints the segment if different than the default value
prompt_nvm() {
- [[ ! $(type nvm) =~ 'nvm is a shell function'* ]] && return
- local node_version=$(nvm current)
- [[ -z "${node_version}" ]] || [[ ${node_version} = "none" ]] && return
- local nvm_default=$(cat $NVM_DIR/alias/default)
+ local node_version nvm_default
+ (( $+functions[nvm_version] )) || return
+
+ node_version=$(nvm_version current)
+ [[ -z "${node_version}" || ${node_version} == "none" ]] && return
+
+ nvm_default=$(nvm_version default)
[[ "$node_version" =~ "$nvm_default" ]] && return
- $1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON'
+ $1_prompt_segment "$0" "$2" "magenta" "black" "${node_version:1}" 'NODE_ICON'
}
# NodeEnv Prompt