Commit to nvm and tweak for Debian

This commit is contained in:
Josh Sherman 2022-08-15 14:46:13 -05:00
parent 2f370a1113
commit 880860d4c1
No known key found for this signature in database
GPG key ID: 55B058A80530EF22

View file

@ -91,31 +91,18 @@ PS1='
%F{blue}%~$(git_prompt) %F{blue}%~$(git_prompt)
%F{244}%# %F{reset}' %F{244}%# %F{reset}'
# No lazy loading on macOS
if [[ `uname` == Darwin ]]; then if [[ `uname` == Darwin ]]; then
# macOS
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
else elif command -v apt &> /dev/null; then
# Only autoload nvm on a specific machine, default to lazy loading # Debian
# TODO: Maybe drop the lazy loading entirely as I never use nvm outside of work? export NVM_DIR="$HOME/.nvm"
if [[ $(hostname) == "x1carbon.josh" ]]; then [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] \ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
&& printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" elif command -v pacman &> /dev/null; then
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # Arch
else export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] \
# Run `nvm` init script on demand to avoid constant slow downs && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
function nvm { [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
if [ -z ${NVM_DIR+x} ]; then
export NVM_DIR="$HOME/.nvm"
if [ -s "$NVM_DIR/nvm.sh" ]; then
source "$NVM_DIR/nvm.sh"
elif [ -s "/usr/share/nvm/init-nvm.sh" ]; then
source /usr/share/nvm/init-nvm.sh
fi
nvm "$@"
fi
}
fi
fi fi