diff options
author | Robert Jorgenson <rjorgenson@gmail.com> | 2016-01-15 02:16:27 +0300 |
---|---|---|
committer | Robert Jorgenson <rjorgenson@gmail.com> | 2016-01-15 02:16:27 +0300 |
commit | 446f46473b2620bbe416488b68dd099be27f695a (patch) | |
tree | bc4aed47b56bbe194ef31745a4d8c71fef0b3b99 | |
parent | 2fa7b1d08f55e71397f13f4e943491426b0e98c0 (diff) |
reworked nvm check
Now the prompt segment just returns without doing anything if nvm is not present.
-rwxr-xr-x | powerlevel9k.zsh-theme | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 23e53221..95849e99 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -531,14 +531,13 @@ prompt_node_version() { # Node version from NVM # Only prints the segment if different than the default value prompt_nvm() { - if [[ $(type nvm) =~ 'nvm is a shell function'* ]]; then - local node_version=$(nvm current) - local nvm_default=$(cat $NVM_DIR/alias/default) - [[ -z "${node_version}" ]] && return - [[ "$node_version" =~ "$nvm_default" ]] && return - fi + [[ $(type nvm) =~ 'nvm is a shell function'* ]] && return + local node_version=$(nvm current) + local nvm_default=$(cat $NVM_DIR/alias/default) + [[ -z "${node_version}" ]] && return + [[ "$node_version" =~ "$nvm_default" ]] && return - [[ -n "${node_version}" ]] && $1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON' + $1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON' } # print a little OS icon |