Skip to content

Instantly share code, notes, and snippets.

@mackelito
Last active December 17, 2021 09:35
Show Gist options
  • Save mackelito/a854b02f6ff1099208e128e782bea376 to your computer and use it in GitHub Desktop.
Save mackelito/a854b02f6ff1099208e128e782bea376 to your computer and use it in GitHub Desktop.
Automatic npm/npm swiching for zsh

open ~/.zshrc

add this to ~/.zshrc

chpwd_functions=(change_nvm_version)

function change_node_version { nvmrc="./.nvmrc" if [ -f "$nvmrc" ]; then version="$(cat "$nvmrc")" nvm use $version fi }

chpwd_functions=(change_node_version)

lastly do source ~/.zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment