When using this plugin (installed using antigen), and setting export NVM_COMPLETION=true, I don’t get proper completion when I type nvm <tab>. I get path based completion suggestions instead.
I dug around in the code, and found that when I run the _zsh_nvm_completion function manually from my prompt, completion works fine (click to watch below recording). What is weird is when I edited the file to check that function was running, and sourcing $NVM_DIR/bash_completion successfully, I could see that it was.
I took a look at $NVM_DIR/bash_completion to see what I could make out, and used set -x to get some debug. I can see that calling the function manually after opening a new shell seems to do a lot more. I’m not familiar enough with completion to understand where it’s going wrong. I can’t follow the complete:13 debug to see why nothing else runs. The call to complete on the last line of $NVM_DIR/bash_completion completes without error.
Here is the debug from opening a new shell:
```shell
+/Users/Mark.Crossfield/.nvm/bash_completion:6> command -v nvm
+/Users/Mark.Crossfield/.nvm/bash_completion:87> [[ -n 5.8 ]]
+/Users/Mark.Crossfield/.nvm/bash_completion:90> command -v compinit
+/Users/Mark.Crossfield/.nvm/bash_completion:97> autoload -U +X bashcompinit
+/Users/Mark.Crossfield/.nvm/bash_completion:97> bashcompinit
+bashcompinit:177> unfunction bashcompinit
+bashcompinit:178> autoload -Uz bashcompinit
+bashcompinit:179> return 0
+/Users/Mark.Crossfield/.nvm/bash_completion:100> complete -o default -F __nvm nvm
+complete:1> emulate -L zsh
+complete:2> local args void cmd print remove
+complete:3> args=( -o default -F __nvm nvm )
+complete:4> zparseopts -D -a void o: A: G: W: C: F: P: S: X: a b c d e f g j k u v 'p=print' 'r=remove'
+complete:6> [[ -n '' ]]
+complete:8> [[ -n '' ]]
+complete:13> compdef '_bash_complete -o default -F __nvm' nvm
```
And here’s the debug from calling the _zsh_nvm_completion function for comparison:
When using this plugin (installed using antigen), and setting
export NVM_COMPLETION=true
, I don’t get proper completion when I typenvm <tab>
. I get path based completion suggestions instead.Zsh version:
zsh 5.8 (x86_64-apple-darwin21.0)
MacOS version:12.0.1
Macbook M1 ProI dug around in the code, and found that when I run the
_zsh_nvm_completion
function manually from my prompt, completion works fine (click to watch below recording). What is weird is when I edited the file to check that function was running, and sourcing$NVM_DIR/bash_completion
successfully, I could see that it was.I took a look at
$NVM_DIR/bash_completion
to see what I could make out, and usedset -x
to get some debug. I can see that calling the function manually after opening a new shell seems to do a lot more. I’m not familiar enough with completion to understand where it’s going wrong. I can’t follow thecomplete:13
debug to see why nothing else runs. The call tocomplete
on the last line of$NVM_DIR/bash_completion
completes without error.Here is the debug from opening a new shell:
And here’s the debug from calling the
_zsh_nvm_completion
function for comparison: