lukechilds / zsh-nvm

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

NVM autocompletions #57

Closed Glennmen closed 4 years ago

Glennmen commented 5 years ago

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.

lukechilds commented 4 years ago

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.

Glennmen commented 4 years ago

@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.

memark commented 4 years ago

@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.)

lukechilds commented 4 years ago

@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: https://github.com/lukechilds/zsh-nvm/pull/58)

Glennmen commented 4 years ago

@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.

memark commented 4 years ago

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