zsh-users
 help / color / mirror / code / Atom feed
From: Yuri D'Elia <wavexx@thregr.org>
To: zsh-users@zsh.org
Subject: Re: show-ambiguity style
Date: Sun, 12 Apr 2015 14:40:44 +0200	[thread overview]
Message-ID: <552A67CC.7030206@thregr.org> (raw)
In-Reply-To: <150411130249.ZM27498@torch.brasslantern.com>

On 04/11/2015 10:02 PM, Bart Schaefer wrote:
> Completion gets screwed up if show-ambiguity is not an ANSI term color
> attribute or one of the "true" strings (which by the way means you can't
> use boldface because "1" means "true" and is therefore replaced with "4"
> for underlining, but you can use e.g. "1;7" for "bold reverse video").

I mentioned it in the page (and now that I look again, you actually
responded to my first implementation ;)).

show_ambiguity is bolted on list-colors. I started approaching it just
as completer widget.

Since it just accepts a pattern to be fed to list colors, my setting is
actually more interesting(tm):

zstyle ':completion:*' show-ambiguity "1;4:=*=0"

I use bold-underline (not shown in the video), and the extra =*=0
pattern is used as a fallback match to clear any coloring. That is, if
there is no match, I don't want any color.

> Anyway, the point is there could be more internal sanity checking that
> the string that is output is going to make sense, but there currently is
> not, so use caution.

The way the match is constructed (a nested glob expression - a great
idea of Oliver Kiddle) is the neatest and weakest part IMHO. It makes
the highlight work even with complete_in_word, but surely is not as
efficient as post-processing the result *after* list coloring.

It would make sense to decouple show-ambiguity from file coloring. This
would enable to have both on, and avoid keeping extra state.

But again, show_ambiguity is not very well known. After seeing it in
emacs, I *had* to have it on zsh.



  parent reply	other threads:[~2015-04-12 12:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 21:36 Yuri D'Elia
2015-04-11  2:21 ` lilydjwg
2015-04-11 16:33 ` Vadim Zeitlin
2015-04-11 20:02   ` Bart Schaefer
2015-04-12 12:40     ` Yuri D'Elia
2015-04-12 18:58       ` Bart Schaefer
2015-04-12 21:03         ` Yuri D'Elia
2015-04-13 11:00           ` Jesper Nygårds
2015-04-13 15:25             ` Bart Schaefer
2015-04-13 19:20               ` Jesper Nygårds
2015-04-12 12:40     ` Yuri D'Elia [this message]
2015-04-13 20:57     ` Daniel Shahaf
2015-04-13 20:21 ` zzapper
2015-04-15 19:56   ` Yuri D'Elia
2015-04-20 21:51     ` zzapper

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=552A67CC.7030206@thregr.org \
    --to=wavexx@thregr.org \
    --cc=zsh-users@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).