From ac7e0a8dee44cd9ce3657dca1c8b37c80ae8b3d0 Mon Sep 17 00:00:00 2001 From: Mike Milkman Date: Thu, 21 Apr 2016 21:40:19 +0300 Subject: [PATCH] Use .nvmrc file to to switch node version --- README.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 9cff97c..0b58ded 100644 --- a/README.markdown +++ b/README.markdown @@ -195,13 +195,13 @@ add-zsh-hook chpwd load-nvmrc ##### Automatic version switching for `.bashrc` with fallback to `nvm use default` Put this into your `$HOME/.bashrc` to enable automatic version swithing whenever you enter a directory than contains an -`.node-version` file with a string telling nvm which node to `use`: +`.nvmrc` file with a string telling nvm which node to `use`: ```bash cd() { builtin cd "$@" - if [[ -f .node-version && -r .node-version ]]; then - nvm use "`cat .node-version`" + if [[ -f .nvmrc && -r .nvmrc ]]; then + nvm use elif [[ `nvm current` != `nvm version default` ]]; then nvm use default fi @@ -216,8 +216,8 @@ For example, on Ubuntu it should be placed into `$HOME/.bash_profile`: ```bash cd() { __zsh_like_cd cd "$@" - if [[ -f .node-version && -r .node-version ]]; then - nvm use "`cat .node-version`" + if [[ -f .nvmrc && -r .nvmrc ]]; then + nvm use elif [[ `nvm current` != `nvm version default` ]]; then nvm use default fi