zsh-users
 help / color / mirror / code / Atom feed
* Explicit colons in zstyle
@ 2012-03-29 18:59 Jesper Nygårds
  2012-03-30 19:41 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Nygårds @ 2012-03-29 18:59 UTC (permalink / raw)
  To: zsh-users

Is there something special about how a style should be expressed when
it relates to "completer"?. I started noticing in some examples from
The Book, that completer is not treated exactly the same as other
styles.

Here's the well know most-recent-file example:

zstyle ':completion:most-recent-file::::' completer _menu _files _match
zstyle ':completion:most-recent-file:*' file-sort modification
zstyle ':completion:most-recent-file:*' hidden all
zstyle ':completion:most-recent-file:*' file-patterns '*(.):normal\ files'

Is there a reason why the first line contains so many colons? To me it
looks like it would be equivalent to the other lines, containing an
asterisk.

The same pattern in the next example:

zstyle ':completion:history-complete::::' completer _history
zstyle ':completion:history-complete:*' remove-all-dups true
zstyle ':completion:history-complete:*' sort true


Then, I saw this, also from The Book:

zstyle ':completion::*:::' completer _complete _prefix

The text says that the asterisk is necessary to make the _prefix
completer match, but I can't understand why the simpler "zstyle
':completion:*' completer _complete _prefix" wouldn't work.

I'm obviously missing something. Perhaps someone can enlighten me?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Explicit colons in zstyle
  2012-03-29 18:59 Explicit colons in zstyle Jesper Nygårds
@ 2012-03-30 19:41 ` Peter Stephenson
  2012-03-31 13:35   ` Jesper Nygårds
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2012-03-30 19:41 UTC (permalink / raw)
  To: zsh-users

On Thu, 29 Mar 2012 20:59:25 +0200
Jesper Nygårds <jesper.nygards@gmail.com> wrote:
> Is there something special about how a style should be expressed when
> it relates to "completer"?. I started noticing in some examples from
> The Book, that completer is not treated exactly the same as other
> styles.
> 
> Here's the well know most-recent-file example:
> 
> zstyle ':completion:most-recent-file::::' completer _menu _files _match
> zstyle ':completion:most-recent-file:*' file-sort modification
> zstyle ':completion:most-recent-file:*' hidden all
> zstyle ':completion:most-recent-file:*' file-patterns '*(.):normal\ files'
> 
> Is there a reason why the first line contains so many colons? To me it
> looks like it would be equivalent to the other lines, containing an
> asterisk.

I think the book (Oliver wrote that bit) is just making the point that
the completer style is always looked up with most of the fields empty.
By recognising the fact you can make it match many of the fields
exactly.

The only difference with replace the :::: with :* is that it becomes
according to the rules a less exact match, so that if you happened to
have both definitions the former would take precedence.  That's not
something you typically need to worry about.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Explicit colons in zstyle
  2012-03-30 19:41 ` Peter Stephenson
@ 2012-03-31 13:35   ` Jesper Nygårds
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Nygårds @ 2012-03-31 13:35 UTC (permalink / raw)
  To: zsh-users

On Fri, Mar 30, 2012 at 9:41 PM, Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
> I think the book (Oliver wrote that bit) is just making the point that
> the completer style is always looked up with most of the fields empty.
> By recognising the fact you can make it match many of the fields
> exactly.
>
> The only difference with replace the :::: with :* is that it becomes
> according to the rules a less exact match, so that if you happened to
> have both definitions the former would take precedence.  That's not
> something you typically need to worry about.

I see. Thank you for the explanation.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-31 14:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 18:59 Explicit colons in zstyle Jesper Nygårds
2012-03-30 19:41 ` Peter Stephenson
2012-03-31 13:35   ` Jesper Nygårds

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).