lukechilds / zsh-nvm

Zsh plugin for installing, updating and loading nvm
MIT License
2.22k stars 112 forks source link

Add NVM_COMPLETION option #63

Closed lusoalex closed 4 years ago

lusoalex commented 4 years ago

Hello,

This closes #57 for nvm completion.

Even if I would enable this by default, I introduced a new parameter NVM_COMPLETION to enable this feature, this way there are no breaking changes possible by default.

The completion is provided by the nvm core repository and enabled as mentioned in the core installation.

# Export nvm completion settings for zsh-nvm plugin
export NVM_COMPLETION=true

Will result in:

# Add provided nvm completion
[[ -r $NVM_DIR/bash_completion ]] && \. $NVM_DIR/bash_completion
lukechilds commented 4 years ago

I'm getting a strange issue with the completion where it gives me the nvm suggestion for the first three arguments and then falls back to the files in the current dir. Are you seeing that?

Kapture 2020-05-01 at 15 53 44

lusoalex commented 4 years ago

I'm getting a strange issue with the completion where it gives me the nvm suggestion for the first three arguments and then falls back to the files in the current dir. Are you seeing that?

Hello, no it seems ok on my side. nvm_completion

lukechilds commented 4 years ago

Hmmn, looks like you are getting the same issue, it shouldn't be recommending install again after you've typed nvm install.

But this seems like it's a bug in nvm, it's doing the same for me if I source it in bash so not related to zsh or nvm-zsh or this PR. Happy to merge this. Might be worth opening an issue on the nvm repo about the incorrect suggestions though.

Thanks for your help!

lusoalex commented 4 years ago

Hmmn, looks like you are getting the same issue, it shouldn't be recommending install again after you've typed nvm install.

But this seems like it's a bug in nvm, it's doing the same for me if I source it in bash so not related to zsh or nvm-zsh or this PR. Happy to merge this. Might be worth opening an issue on the nvm repo about the incorrect suggestions though.

Thanks for your help!

You are right, If I take the same value than your first example, I have the same result. Yes it come from nvm not zsh by the way, and my opinion here it's better to use their completion (and contribute to it) instead of having to maintain multiple solutions. 👍 Thanks for the approval 😃