-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
speed up when change directory in zsh #1264
Conversation
current=`pwd` | ||
count=`echo $current | grep -o '/' | wc -l` | ||
matchStatus='miss' | ||
while [[ $count -ge 0 ]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code can get a lot simpler if you use nvm_find_nvmrc
which will print out the first .nvmrc
it finds - it's the same code nvm uses internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have updated my code by your suggestion
local nvmrc_path="$(nvm_find_nvmrc)" | ||
|
||
if [ -n "$nvmrc_path" ]; then | ||
if [ "v$(cat $nvmrc_path)" != "$nodeversion" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't work because the .nvmrc
file could contain 1
or v1.0
or v1.0.0
or foo
(where "foo" is an alias) - you'd need $(nvm version "$(cat "${nvmrc_path}")")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! mind rebasing this down to a commit?
@ljharb , thanks for your review |
This pull request resolve two questions: