From 2ca1709f621f0ded3f8d64956da469d516b00ac7 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Wed, 20 Apr 2016 13:20:03 -0400 Subject: [PATCH] add chpwd helper for nvm --- zshrc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zshrc b/zshrc index 2da05a3..8d3adee 100644 --- a/zshrc +++ b/zshrc @@ -39,16 +39,22 @@ alias stayawake="caffeinate -s -d -i" export PATH="/usr/local/heroku/bin:$PATH" # Setup RVM -export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting +export PATH="$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting export rvm_project_rvmrc=1 test -e ${HOME}/.rvm/scripts/rvm && source ${HOME}/.rvm/scripts/rvm # Check if dinghy is installed, and run shellinit if it exists -which dinghy 2>1 >/dev/null && eval $(dinghy shellinit) +which dinghy 2>&1 >/dev/null && eval $(dinghy shellinit) # Setup NVM export NVM_DIR=~/.nvm test -e $(brew --prefix nvm)/nvm.sh && source $(brew --prefix nvm)/nvm.sh +function chpwd() { + # If there is an `.nvmrc` file then run `nvm use` + if [ -r $PWD/.nvmrc ]; then + nvm use + fi +} # Setup iterm2 shell integration test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh