diff --git a/fake_home/.zshrc b/fake_home/.zshrc index eb7573c..4b78ba4 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -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"