Skip to content
Myr

[readme] bash shell integration: Amended example to call cd when booting a terminal (previously only called on cd).

Before adoption: this commit came in with the history the project adopted, so no landing records it.

It means that works with for example VS Code's integrated terminal.

authored by Matthieu Bosquet · committed by Jordan Harband · parent 7929190 · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:README.md+3 added-2 removed
461 unmodified lines
462463Put the following at the end of your `$HOME/.bashrc`:464465```bash466find-up () {466find-up() {467 path=$(pwd)468 while [[ "$path" != "" && ! -e "$path/$1" ]]; do469 path=${path%/*}470 done471 echo "$path"472}473474cdnvm(){474cdnvm() {475 cd "$@";476 nvm_path=$(find-up .nvmrc | tr -d '\n')477478 # If there are no .nvmrc file, use the default nvm version
34 unmodified lines
513 fi514 fi515}516alias cd='cdnvm'517cd $PWD518```519520This alias would search 'up' from your current directory in order to detect a `.nvmrc` file. If it finds it, it will switch to that version; if not, it will use the default version.521
305 unmodified lines