Zsh Mailing List Archive
Messages sorted by:
- X-seq: zsh-users 19519
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: completion
- Date: Thu, 11 Dec 2014 01:34:42 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1418258083; bh=ES3+cQGfRSawlX8sQlexzXbKkGB1AiHCPUZhLfnetkA=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=m1vad9OX7gxQfcgZG7tuR7sb2knRS7Jy/7sI0AHce3jKjI2mdqAUW4nTCdI7+oN4JWlD7NTTszkxgw2nlMcZ9mJDeqzNzikUmulTrn4/zz4iO+BPzfpFVN2c6nHAM8+x4iqsqcpSD4aNkeGo8In8vxXtltDBPu3x1A5R6NPbCl209eChrH+RPq5pcxxtBOBk0DCR/pWRjTW/k/puSHzpk0YhEbV4qMb6TqXtk23SPGvetgTdwfDm5X77BQq5CXBHgkilHARFAicoC3fZYvhRBmp2xj1TqxYpj7HiYPmyNwpy9fBA+eDD4Iljo59Wap8WESgvp4/XE3Eu6R1iqKUG+Q==
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.co.uk; b=lrRsGpMFT20jg3MdtzCYc9jhUxRnq+6ak+/6se64NnbwG2nP/rCPssDrAiYZZxWiOa65ttCkNmyb7Es+gvKulqbZFE06kbn3KSdLrsAN9hP9wVL2T2A0auQ9IVnT7g4KhIaTxQeAaS/Ehdp2pmEDNedwoD6jevaIVOcmHJNURhsg2n8GZI8YR4MIIW4KYpD3T7JNg+bIQ3OtTvCI5LbT2wyYQgXHJwb6dIoQM+pTJs6ZsUEJDBo3KZl5U5fg8ViK0Jv/PFZmwNsV3MJUNQ+z56WqvYXp8v1pQ4MV01H4VdjMlMc+NlMryXs4GZ6FiSs2rORUAqeGIJXS3YWdu1xEIA==;
- In-reply-to: <5488D414.email@example.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <5488D414.firstname.lastname@example.org>
Ray Andrews wrote:
> In chapter 10 of 'the book', at one point you start doing this:
> zstyle ':completion:::::' completer _complete _approximate
> ... I missed any leading explanation of what those five colons
> are doing.
See the grey box on p237.
The part with the colons is the context. The context is decribed using
a colon-separated list of components. This allows for things to be
configured in a context-sensitive manner.
The "completer"s are sort of top-level drivers and are selected very
early while the context is still empty.
The five colons are included because they prevent the completer style
from matching in other contexts where you might want a different
> Playing with matcher-list, you have some good ideas there.
> I currently have all that completion/matcher stuff copied in
> from some website of sample .zshrc's and it was all taken on
> faith, since I hadn't the slightest clue how all that stuff works.
> Since I'm now trying to understand it, the current line I have
> contains this:
> zstyle ':completion:*' matcher-list ... 'r:|[._-]=* r:|=* l:|=*'
> ... at the risk of insanity, what is that incantation doing, and
> do I want it? Gentle generalities are fine.
Matching is the part of the completion system that decides which of the
possibilities match what you have typed on the command-line. By default,
this is just an exact string match of the prefix so given:
touch one two three
It sees that t is a prefix of two and three but not one.
The r:|[._-]=* is roughly saying put a wildcard (*) before . _ or -.
This allows something line w.z.o<tab> to complete to www.zsh.org
It's not unreasonable to use that style. You might want to further limit
the style, however. Matching control can make approximate completion too
aggressive so you might want ':completion:*:(^approximate):*'
Or you might want to restrict it to, e.g. filename completion.
Applicable matching controls are often defined in specific functions so
the one you quote is not that necessary.
Messages sorted by: