[readme] bash .nvmrc auto-switching: don't bypass another cd function

`cdnvm` calls `command cd`,
which skips any `cd` function defined by another tool,
like the one `rvm` uses to switch ruby versions.

Salvaged from #1066, which predates the README's `cdnvm` snippet.

Co-authored-by: Mike Milkman <mik356ua@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
This commit is contained in:
Mike MilkmanandJordan Harband authored and Jordan Harband committed 2016-04-19 15:56:45 +03:00
1 parent adf35d7697
commit a858cc3e2f
1 file changed
+4
+4
View File
@@ -850,6 +850,10 @@ cdnvm "$PWD" || exit
This 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.
If something else already defines a `cd` function, `command cd` skips it.
For example, [`rvm`](https://rvm.io) does this to switch ruby versions;
to keep that working, replace `command cd "$@"` with `__zsh_like_cd cd "$@"`.
##### zsh
This shell function will install (if needed) and `nvm use` the specified Node version when an `.nvmrc` is found, and `nvm use default` otherwise.