[readme] bash shell integration: Amended example to call cd when booting a terminal (previously only called on cd).
It means that works with for example VS Code's integrated terminal.
parent
7929190e6e
commit
344cc32ac3
|
@ -463,7 +463,7 @@ If you prefer a lighter-weight solution, the recipes below have been contributed
|
||||||
Put the following at the end of your `$HOME/.bashrc`:
|
Put the following at the end of your `$HOME/.bashrc`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
find-up () {
|
find-up() {
|
||||||
path=$(pwd)
|
path=$(pwd)
|
||||||
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
|
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
|
||||||
path=${path%/*}
|
path=${path%/*}
|
||||||
|
@ -471,7 +471,7 @@ find-up () {
|
||||||
echo "$path"
|
echo "$path"
|
||||||
}
|
}
|
||||||
|
|
||||||
cdnvm(){
|
cdnvm() {
|
||||||
cd "$@";
|
cd "$@";
|
||||||
nvm_path=$(find-up .nvmrc | tr -d '\n')
|
nvm_path=$(find-up .nvmrc | tr -d '\n')
|
||||||
|
|
||||||
|
@ -514,6 +514,7 @@ cdnvm(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
alias cd='cdnvm'
|
alias cd='cdnvm'
|
||||||
|
cd $PWD
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
Loading…
Reference in New Issue