Skip to content

Instantly share code, notes, and snippets.

@vjo
Created November 15, 2024 16:01
Show Gist options
  • Save vjo/682ffa1058d883a7a6e29f9e53b38ae5 to your computer and use it in GitHub Desktop.
Save vjo/682ffa1058d883a7a6e29f9e53b38ae5 to your computer and use it in GitHub Desktop.
Automate `nvm use` when changing directory
##
# Add the following to your `~/.zshrc` after nvm is initialized
##
# switch to the right node version automatically
function chpwd() {
# Executed whenever the current working directory is changed
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
fi
}
@vjo
Copy link
Author

vjo commented Nov 15, 2024

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