nvm plugin only load nvm script if command doesn't already exist

This commit is contained in:
Sascha Bratton 2016-09-26 11:57:10 -04:00
parent 57fcee0f1c
commit 7b10c05fc1

View File

@ -1,5 +1,8 @@
# Set NVM_DIR if it isn't already defined # Set NVM_DIR if it isn't already defined
[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" [[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"
# Try to load nvm only if command not already available
if ! type "nvm" &> /dev/null; then
# Load nvm if it exists # Load nvm if it exists
[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" [[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
fi