#.zshrc
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
# alias nvm="unalias nvm; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"; nvm $@"
# Check if the current Node.js version matches the one specified in .nvmrc
check_and_use_nvm() {
local nvmrc_file=".nvmrc"
if [[ -f "$nvmrc_file" ]]; then
local node_version=$(<"$nvmrc_file")
local current_node_version=$(node --version)
if [[ "$current_node_version" != "$node_version" ]]; then
nvm use "$node_version"
fi
fi
}
# Call the function to check and use the specified Node.js version
check_and_use_nvm
Last active
February 7, 2024 18:24
-
-
Save theabhayprajapati/35a62596574be2c6765ad19e966b4796 to your computer and use it in GitHub Desktop.
Make zsh shell to load faster. if you have nvm install
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment