Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Improvements to the gcc completion script



Does anyone know a way to prevent '--' from being split in 'partial word completion'?

Suppose a cmd accept --baz and -foo-bar as options, and match-spec
r:|-=* r:|=*
is in use. Then 'cmd --b<TAB>' will offer both options.

Is it possible to complete -foo-bar for -f-b<TAB> but only --baz for 'cmd --b<TAB>'?
(this is ralted with [2] below; [1] is cosmetic)

[1]
> 2021/03/22 11:28, Jacob Gelbman <gelbman@xxxxxxxxx> wrote:
> 
>> On Mar 18, 2021, at 11:51 PM, Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
>> 
>> I don't have any detailed knowledge of how Apple's command line tools work,
>> but probably it would better to use the output of 'xcrun --show-sdk-path' instead of 
>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk.
> 
> I would use use clang -Wl,-v but it could be a bit tricky to get it to cache correctly, so I left that one be for now.

On one of my Mac, in which Xcode.app is installed, 'xcrun --show-sdk-path' gives
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
and not only Xcode but also clang invoked from the command line uses this directory.

[2]
>>> I removed the matchspec "r:|[_-]=*" from the _arguments call because there were certain options where I would try to complete them, and they positioned the cursor elsewhere unexpectedly. for example, I wrote "clang --opt<tab>" and after it completed up until --optimiz, it positioned me on the second - when I expected to be at the end of the fully completed option, --optimize=. also it didn't fully complete, it left it at --optimiz.
>> 
>> I can't reproduce your problem.
>> The matcher 'r:|[_-]=*' is quite useful and better not to be removed since it allows
>> gcc -fd-s-l<TAB>
>> to be completed to
>> gcc -fdiagnostics-show-location=
>> 
> 
> I miswrote how to reproduce it. You type --opti<tab>, not --opt<tab>, then you'll see it position the cursor -<here>-optimiz. This sort of thing is especially annoying if you bind tab to expand-or-complete-prefix.

But hitting a few more TABs will give you --optimize.

It may be annoying for you, but I believe there are many users who are accustomed
to using 'partial word completion' and removing it is not a good idea.

Match-spec 'r:|[_-][^-]=* r:|=*' may work better but not perfect.






Messages sorted by: Reverse Date, Date, Thread, Author