Adding watch for .nvmrc
In the event that .nvmrc is found in a directory, change to that version of node using NVM.
This commit is contained in:
parent
1c958e02a5
commit
49fe92d05b
@ -3,3 +3,15 @@
|
||||
|
||||
# Load nvm if it exists
|
||||
[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
|
||||
|
||||
# Look for .nvmrc in directories. If found, change to that version of node.
|
||||
autoload -Uz add-zsh-hook
|
||||
load-nvmrc() {
|
||||
if [[ -f .nvmrc && -r .nvmrc ]]; then
|
||||
nvm use --delete-prefix
|
||||
elif [[ -f package.json && -r package.json ]]; then
|
||||
nvm use --delete-prefix v6.11.1
|
||||
fi
|
||||
}
|
||||
add-zsh-hook chpwd load-nvmrc
|
||||
load-nvmrc
|
||||
|
Loading…
Reference in New Issue
Block a user