check for nvmrc and switch node version
if a .nvmrc file exists in a directory, read it to change node to the correct version Also ignore this file globally from git repos
This commit is contained in:
@@ -18,3 +18,6 @@ Icon
|
||||
|
||||
# typescript command garbage
|
||||
tscommand*.txt
|
||||
|
||||
# nvm - the Node Version Manager
|
||||
.nvmrc
|
||||
|
||||
@@ -21,7 +21,7 @@ fi
|
||||
|
||||
|
||||
# initialize autocomplete
|
||||
autoload -U compinit
|
||||
autoload -U compinit add-zsh-hook
|
||||
compinit
|
||||
|
||||
for config ($ZSH/**/*completion.sh) source $config
|
||||
@@ -63,6 +63,13 @@ fi
|
||||
# source nvm
|
||||
export NVM_DIR=~/.nvm
|
||||
|
||||
load-nvmrc() {
|
||||
if [[ -f .nvmrc && -r .nvmrc ]]; then
|
||||
nvm use
|
||||
fi
|
||||
}
|
||||
add-zsh-hook chpwd load-nvmrc
|
||||
|
||||
if hash brew 2>/dev/null; then
|
||||
source $(brew --prefix nvm)/nvm.sh
|
||||
source `brew --prefix`/etc/profile.d/z.sh
|
||||
|
||||
Reference in New Issue
Block a user