Open squarism opened 9 years ago
Awesome! Thanks! I'll get some ppl from IRC to put eyeballs on this.
I switched to Bash but didn't have the env variable in either one. What is it normally?
zsh code of interest:
% _mycompleter() { read -l; local cl="$REPLY"; read -ln; local cp="$REPLY"; reply=(`COMP_SHELL=zsh COMP_LINE="$cl" COMP_POINT="$cp" mycompleter`) }
% compctl -K _mycompleter someprog
vs bash:
complete -C mycompleter someprog
where mycompleter
is an external command in bash, but can't be in zsh.
Yeah, that sites pre tags have hidden overflows, so fair warning.
COMPLINE gets evaluated when you hit <TAB><TAB>
in bash. You can see it if you just puts
it in the minitest/complete.rb
For example, it's probably `minitest -n test` if you follow the (bash) README. I think a port (like the _mycompleter function you mention up there) would work if you could get bash compatibility to work. I tried a few different ways but couldn't get the COMP_LINE to show up anywhere.
So then I switched to trying to get a zsh plugin (specifically oh-my-zsh) to work. But I've never written one so it's trial-by-fire. :fire: :smile:
Unassigning so people might be encouraged to help on this more.
I saw the note about making a PR to confirm that it works for zsh users. I couldn't get it to work so I'm opening an issue to help document and assist. :)
I think the problem is that zsh doesn't have COMP_LINE. So an exception is thrown on a nil value. Manually setting COMP_LINE fixes it but the actual value obviously needs to be dynamic for it to be useful.
I then tried to get the bash compatibility options to work with zsh but my initial attempts have failed. This is in the context of oh-my-zsh. So maybe a vanilla zsh user would have more luck with their .zshrc config. I think a good solution would be to write a oh-my-zsh plugin and change minitest/complete.rb to handle whatever environment differences are between the two shells. But I haven't figured this out yet. I took at stab at a zsh plugin but I need to work on it some more.
I switched to bash temporarily to get the happy path working and developed against that state. Of course it works. :) So, this is definitely zsh related. I'm hoping I can contribute something more substantial.