Prioritize nvm via env-var over bre-prefix

As the `brew --prefix nvm` takes up to 2.5s on my machine, 
we should favor finding the `nvm.sh` using the `$NVM_DIR` 
over using `brew --prefix` option.
pull/1707/head
Johannes Edmeier 2020-11-08 12:42:06 +01:00 committed by GitHub
parent bcc3f4080b
commit c6b10cd3c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -9,13 +9,17 @@ about-plugin 'node version manager configuration'
export NVM_DIR=${NVM_DIR:-$HOME/.nvm}
# This loads nvm
if command -v brew &>/dev/null && [ -s $(brew --prefix nvm)/nvm.sh ]
if [ -s "$NVM_DIR/nvm.sh" ]
then
. $(brew --prefix nvm)/nvm.sh
source "$NVM_DIR/nvm.sh"
else
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
if command -v brew &>/dev/null && [ -s $(brew --prefix nvm)/nvm.sh ]
then
source $(brew --prefix nvm)/nvm.sh
fi
fi
if ! command -v nvm &>/dev/null
then
function nvm() {