Skip to content

Instantly share code, notes, and snippets.

@Pelirrojo
Forked from gfguthrie/.zshrc
Last active September 20, 2020 15:36
Show Gist options
  • Save Pelirrojo/bd05f024d485a16d88471809482554e8 to your computer and use it in GitHub Desktop.
Save Pelirrojo/bd05f024d485a16d88471809482554e8 to your computer and use it in GitHub Desktop.
Lazy Load Homebrew NVM but still have default aliased Node in PATH
# Based on https://gist.github.com/gfguthrie/9f9e3908745694c81330c01111a9d642#gistcomment-3143229
(...)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
DEFAULT_NODE_VER='default';
while [ -s "$NVM_DIR/alias/$DEFAULT_NODE_VER" ]; do
DEFAULT_NODE_VER="$(<$NVM_DIR/alias/$DEFAULT_NODE_VER)"
done;
export PATH="$NVM_DIR/versions/node/v${DEFAULT_NODE_VER#v}/bin:$PATH"
alias nvm='unalias nvm; [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use; nvm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment