diff --git a/.gitignore b/.gitignore index 79dc7e9..72d8542 100644 --- a/.gitignore +++ b/.gitignore @@ -283,3 +283,4 @@ sunshine/ clipse/ X11/xinit/xinitrc.d/* github-copilot +configstore/ diff --git a/shell/profile.d/nvm.sh b/shell/profile.d/nvm.sh index e552142..f5c2215 100644 --- a/shell/profile.d/nvm.sh +++ b/shell/profile.d/nvm.sh @@ -2,11 +2,30 @@ export NVM_DIR="$HOME/.config/nvm" -if [ -s "$NVM_DIR/nvm.sh" ]; then - # nvm.sh is a very large file that causes shell startup to slow - # down, this wrapper sources nvm.sh only after calling nvm. - nvm() { +_nvm_lazy_load() { + unset -f nvm npm npx node + + if [ -s "$NVM_DIR/nvm.sh" ]; then . "$NVM_DIR/nvm.sh" - nvm "$@" - } -fi + fi +} + +nvm() { + _nvm_lazy_load + nvm $@ +} + +npm() { + _nvm_lazy_load + npm $@ +} + +npx() { + _nvm_lazy_load + npx $@ +} + +node() { + _nvm_lazy_load + node $@ +}