mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-12 20:21:02 +01:00
perf(nvm): don't call nvm version
on every cd
Now we only call `nvm version` in case we changed directory and we are not anymore in a `.nvmrc` directory. See https://github.com/nvm-sh/nvm/pull/2874
This commit is contained in:
parent
94aa49c0b9
commit
fd01fd66ce
1 changed files with 2 additions and 5 deletions
|
@ -45,7 +45,6 @@ function _omz_setup_autoload {
|
||||||
# Autoload nvm when finding a .nvmrc file in the current directory
|
# Autoload nvm when finding a .nvmrc file in the current directory
|
||||||
# Adapted from: https://github.com/nvm-sh/nvm#zsh
|
# Adapted from: https://github.com/nvm-sh/nvm#zsh
|
||||||
function load-nvmrc {
|
function load-nvmrc {
|
||||||
local node_version="$(nvm version)"
|
|
||||||
local nvmrc_path="$(nvm_find_nvmrc)"
|
local nvmrc_path="$(nvm_find_nvmrc)"
|
||||||
local nvm_silent=""
|
local nvm_silent=""
|
||||||
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
|
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
|
||||||
|
@ -58,10 +57,8 @@ function _omz_setup_autoload {
|
||||||
elif [[ "$nvmrc_node_version" != "$node_version" ]]; then
|
elif [[ "$nvmrc_node_version" != "$node_version" ]]; then
|
||||||
nvm use $nvm_silent
|
nvm use $nvm_silent
|
||||||
fi
|
fi
|
||||||
elif [[ "$node_version" != "$(nvm version default)" ]]; then
|
elif [[ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ]] && [[ "$(nvm version)" != "$(nvm version default)" ]]; then
|
||||||
if [[ -z $nvm_silent ]]; then
|
[[ -z $nvm_silent ]] && echo "Reverting to nvm default version"
|
||||||
echo "Reverting to nvm default version"
|
|
||||||
fi
|
|
||||||
|
|
||||||
nvm use default $nvm_silent
|
nvm use default $nvm_silent
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue