This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Defer initialization of nvm until nvm, node or a node-dependent command is | |
# run. Ensure this block is only run once if .bashrc gets sourced multiple times | |
# by checking whether __init_nvm is a function. | |
if [ -s "$HOME/.nvm/nvm.sh" ] && [ ! "$(type -t __init_nvm)" = function ]; then | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" | |
declare -a __node_commands=('nvm' 'node' 'npm' 'yarn' 'gulp' 'grunt' 'webpack') | |
function __init_nvm() { | |
for i in "${__node_commands[@]}"; do unalias $i; done | |
. "$NVM_DIR"/nvm.sh |