Load nvm lazily

This commit is contained in:
Sage Vaillancourt 2024-01-24 21:33:45 -05:00
parent 20c81522e4
commit 90972c478f
1 changed files with 16 additions and 3 deletions

View File

@ -94,9 +94,22 @@ if test -d "$DOT_DIR" && [[ "$current_date" != "$(cat "$last_get_file")" ]] &> /
getdot
fi
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=false
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 "$HOME/.asdf/asdf.sh" && . "$HOME/.asdf/asdf.sh"