lukechilds / zsh-nvm

Zsh plugin for installing, updating and loading nvm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NVM autocompletions

Glennmen opened this issue · comments

Would it be interesting to add autocompletion to zsh-nvm just like the default nvm plugin has? https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/nvm/_nvm

If interested I can try to make a PR for this.

A PR would be welcome for this :)

I will warn you though, my availability for OSS is not great right now so I can't promise I'll be able to review quickly.

@lukechilds I was thinking about copying it from the main nvm plugin so it should be a quick PR. Of course I will test it first before making a PR to be sure that it works with lazy loading.

@lukechilds @Glennmen Could we as an easy start just activate the out-of-the-box completions already provided by nvm-sh? They are in
https://github.com/nvm-sh/nvm/blob/master/bash_completion
(and work with Zsh as well).

For example
[[ -s $NVM_DIR/bash_completion ]] && \. $NVM_DIR/bash_completion
could be added to
zsh-nvm.plugin.zsh
with or without a separate environment variable flag like NVM_USE_COMPLETIONS.
(I would argue they should be active by default.)

@memark this is a good suggestion and also solves the problem of our hardcoded completions coming out of sync with the installed nvm version which would be pretty frustrating for users.

(btw incase you weren't aware there is already a PR in progress here: #58)

@memark @lukechilds The reason why I don't like the included bash nvm-sh completion compared to the custom ZSH nvm completion.

bash nvm-sh completion:
image

zsh nvm completion:
image

Zsh completion gives the option to add extra information to the commands, which can of course be very useful when you are looking for the correct command.

@Glennmen I totally understand. I guess it's a tradeoff between functionality and maintainability.