Update nvm.plugin.zsh
This commit is contained in:
parent
f18b4aedf5
commit
bb29ba1359
@ -1,6 +1,21 @@
|
|||||||
|
# if homebrew installed
|
||||||
|
_homebrew-installed() {
|
||||||
|
type brew &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# if nvm from homebrew installed
|
||||||
|
_nvm-from-homebrew-installed() {
|
||||||
|
brew --prefix nvm &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
# 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"
|
||||||
|
|
||||||
# Load nvm if it exists
|
# Load nvm if it exists
|
||||||
[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
|
if [[ -f "$NVM_DIR/nvm.sh" ]] ; then
|
||||||
[[ -f "$(brew --prefix nvm)/nvm.sh" ]] && source "$(brew --prefix nvm)/nvm.sh"
|
source "$NVM_DIR/nvm.sh"
|
||||||
|
elif _homebrew-installed && _nvm-from-homebrew-installed ; then
|
||||||
|
source "$(brew --prefix nvm)/nvm.sh"
|
||||||
|
else
|
||||||
|
unset NVM_DIR
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user