zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: Improvements to the gcc completion script
Date: Tue, 23 Mar 2021 00:18:40 +0900	[thread overview]
Message-ID: <DFACBC1A-8CFA-4E52-B300-C2BD2AC1901C@kba.biglobe.ne.jp> (raw)
In-Reply-To: <476D5028-52A7-4850-98E7-95ADFA69367A@gmail.com>

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@gmail.com> wrote:
> 
>> On Mar 18, 2021, at 11:51 PM, Jun T <takimoto-j@kba.biglobe.ne.jp> 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.




  parent reply	other threads:[~2021-03-22 15:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  4:07 Jacob Gelbman
2021-03-19  3:51 ` Jun T
2021-03-22  2:28   ` Jacob Gelbman
2021-03-22  2:29     ` Jacob Gelbman
2021-03-22 15:18     ` Jun. T [this message]
2021-03-31 12:31       ` Oliver Kiddle
2021-03-31 14:53         ` Jun. T
2021-03-31 15:06           ` Jun. T
2021-03-31 18:37             ` two anchor forms of matching control (was Re: Improvements to the gcc completion script) Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DFACBC1A-8CFA-4E52-B300-C2BD2AC1901C@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).