lukechilds / zsh-nvm

Zsh plugin for installing, updating and loading nvm
MIT License
2.24k stars 113 forks source link

Add the ability to exclude specific cases from NVM_AUTO_USE #62

Open henderea opened 4 years ago

henderea commented 4 years ago

A git repo I have checked out locally recently added a .nvmrc with version 13.8.0. I don't have that version installed, so every time I enter that directory, it starts trying to install 13.8.0, which I have to quickly cancel every time since there's no reason to install 13.8.0 when it is outdated but not LTS.

This PR adds support for the array environment variables NVM_AUTO_USE_IGNORE_VERSION and NVM_AUTO_USE_IGNORE_PATH. These are used to ignore specific values from .nvmrc and to ignore the .nvmrc in specific directories.

Examples (in ~/.zshrc):

export NVM_AUTO_USE_IGNORE_VERSION=("v13.8.0" "lts/boron")

Auto-use will be skipped if the .nvmrc file it finds contains the values v13.8.0 or lts/boron.

export NVM_AUTO_USE_IGNORE_PATH=("$HOME/projects/annoying-external-repo")

Auto-use will be skipped if the .nvmrc file it finds is $HOME/projects/annoying-external-repo/.nvmrc.