Load nvm lazily
This commit is contained in:
parent
20c81522e4
commit
90972c478f
|
@ -94,9 +94,22 @@ if test -d "$DOT_DIR" && [[ "$current_date" != "$(cat "$last_get_file")" ]] &> /
|
||||||
getdot
|
getdot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export nvm_loaded=false
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
alias nvm="load_nvm; nvm"
|
||||||
|
alias node="load_nvm; node"
|
||||||
|
|
||||||
|
function load_nvm {
|
||||||
|
if $nvm_loaded; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
unalias nvm
|
||||||
|
unalias node
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
export nvm_loaded=true
|
||||||
|
}
|
||||||
|
|
||||||
test -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh && source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
test -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh && source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
test -f "$HOME/.asdf/asdf.sh" && . "$HOME/.asdf/asdf.sh"
|
test -f "$HOME/.asdf/asdf.sh" && . "$HOME/.asdf/asdf.sh"
|
||||||
|
|
Loading…
Reference in New Issue