diff options
author | rjorgenson <rjorgenson@gmail.com> | 2016-01-14 21:05:26 +0300 |
---|---|---|
committer | rjorgenson <rjorgenson@gmail.com> | 2016-01-14 21:05:26 +0300 |
commit | 9aeff8d43bd8ad95d913b21e68a5aa64036eda45 (patch) | |
tree | c824f0cfe6f633c4e56ad178bbedaccbdc749c47 | |
parent | 0639e1132ce89c6d1c96fc4f7eb6b5c960ca0086 (diff) |
added check for nvm command before running
-rwxr-xr-x | powerlevel9k.zsh-theme | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c01c9a9d..ab942d5b 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -531,10 +531,12 @@ prompt_node_version() { # 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 + 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 $1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON' } |