From 728c8e717435b31cb7db90168e1e7bd27b95e3f5 Mon Sep 17 00:00:00 2001 From: Sascha Bratton Date: Mon, 8 Apr 2019 11:58:27 -0400 Subject: [PATCH] nvm: load nvm script only if command doesn't already exist (#5454) Fixes #5453. --- plugins/nvm/nvm.plugin.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 9dde3a266..4bab8e9d7 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -1,5 +1,8 @@ # Set NVM_DIR if it isn't already defined [[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" -# Load nvm if it exists -[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" +# Try to load nvm only if command not already available +if ! type "nvm" &> /dev/null; then + # Load nvm if it exists + [[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" +fi