From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id a5fee490 for ; Tue, 14 Jan 2020 16:46:18 +0000 (UTC) Received: (qmail 15771 invoked by alias); 14 Jan 2020 16:46:11 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24661 Received: (qmail 1657 invoked by uid 1010); 14 Jan 2020 16:46:11 -0000 X-Qmail-Scanner-Diagnostics: from out3-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25691. spamassassin: 3.4.2. Clear:RC:0(66.111.4.27):SA:0(-2.6/5.0):. Processed in 4.478581 secs); 14 Jan 2020 16:46:11 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrtddtgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdffrghn ihgvlhcuufhhrghhrghffdcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg eqnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghf rdhnrghmvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-754-g09d1619-fmstable-20200113v1 Mime-Version: 1.0 Message-Id: <1d1c62f2-7d74-4b6c-a08e-78dfe7378fc6@www.fastmail.com> In-Reply-To: References: <20200113170630.GA8134@tarpaulin.shahaf.local2> Date: Tue, 14 Jan 2020 16:45:12 +0000 From: "Daniel Shahaf" To: "Pier Paolo Grassi" Cc: "Zsh-Users List" Subject: Re: problem with context specification Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Pier Paolo Grassi wrote on Tue, 14 Jan 2020 15:59 +00:00: > to answer Daniel: >=20 > > I take it the documentation of zstyle didn't make this clear, so cou= ld you > > suggest how to improve it? >=20 > It's not clear to me what is the meaning of the various "sections"of t= he > pattern (the segments delimited by the colons) This, too, is explained in the manual (see zshcompsys(1), or online): The context string always consists of a fixed set of fields, sepa= rated by colons and with a leading colon before the first. Fields whic= h are not yet known are left empty, but the surrounding colons appear a= nyway. The fields are always in the order :completion:function:completer:command:argument:tag. These have = the following meaning: > what should I put in the first section? ":completion:", literally. That's hard-coded. See the patch I posted for another example, and Misc/vcs_info-examples in the source distribution. > is there a list of possible values and relative meaning? The manual does list the available completers and many tags and styles (= the style is, e.g., "matcher-list" in your example), but it's possible some comman= ds use custom ones. Ctrl+X h is the standard recommendation for discovering these. > and so on for each section > why the number of sections is not the same for every pattern? Because asterisks can match colons. The number of sections in the context _that is looked up_ (with zstyle -s/-t/-T/-b/-a) is always the same. There's an example in the patch I posted. > How can I know how many pattern I should put in? One pattern per zstyle command in your zshrc. If you mean how many colon-separated parts, that's up to you. It's basically a matter of coding style unless you set the same style in multiple contexts, in which case the colons directly affect precedence, as explained in the portion of the docs I quoted in my first answer (though in retrospect I'm not sure now if that was what you were asking about then). > I assume the stars are for matching every possible value for that segm= ent, No. An asterisk matches zero or more characters, _including colons_. (My patch said that explicitly.) > are there other globbing operators available? Yes, anything that works in =C2=ABcase $haystack in =E2=80=B9needle=E2=80= =BA) =E2=80=A6;; esac=C2=BB, or equivalently in =C2=AB[[ =E2=80=B9haystack=E2=80=BA =3D=3D =E2=80=B9need= le=E2=80=BA ]]=C2=BB, can be used in zstyle settings. > can I use them for prefix/suffix matching? (eg someth* for > something etc) Yes, you could: % zstyle 'foob*' key value % =20 % zstyle -s foobar key REPLY=20 % typeset -p REPLY typeset REPLY=3Dvalue %=20 For example, I set: zstyle ':completion:*:*:git-*:*:hosts' ignored-patterns localhost ip6-lo= calhost ip6-loopback and the style applies to git-push(1), git-pull(1), git-ls-remote(1), etc= .. > Not that I think it would be particularly useful, but the question > came to mind I assume also that the stars don't match multiple > segments, but this doesn't seem to be stated in the docs. See above.