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=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 0c49eb4d for ; Tue, 14 Jan 2020 17:57:07 +0000 (UTC) Received: (qmail 17252 invoked by alias); 14 Jan 2020 17:56:59 -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: 24662 Received: (qmail 7086 invoked by uid 1010); 14 Jan 2020 17:56:59 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua1-f48.google.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(209.85.222.48):SA:0(-2.0/5.0):. Processed in 4.386146 secs); 14 Jan 2020 17:56:59 -0000 X-Envelope-From: pierpaolog@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.222.48 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ejmeTLdRlXJ4cdgyhPsjPvT8WDhmTaor8AIjfYfHU/Y=; b=RB5TcpOaFvHhog/yPyrm9PH1OwzlIzEtNFo1zdFSJ+CoHQ0hD0ccMVXH9y0zSKb9Mk oWc6i5AcGgu5wu7882Qg/xGgJYasF07Z0aZ6wsJv7/tjBerc9QuGdwCjYJiDieX/5o5L 8Bfu3QUBfGa/WmK6I08IOifrFCPdyZgHbDuFRglsgjFto+eNVzhO9xnigoKZyjYCgeLC 2U3FGETd+kJi5y5X8zGzR7I7gWnMJQFcxW7RKKZPCCotIkKVD/GW21KpkEsjbCg/aHLU DHCxLdovq00L06zmfbwStVa2UDG9WA/0HaEIkEXmXU7urG0gXqti6oG4dSrEf9Ywh39o b1DA== X-Gm-Message-State: APjAAAWwQgguQQeQHOvLyDO0fHH3q4vV+XIncY3XRf18FhQZd0gvDp0g HfU2Y/rK8r5PcACU2gv3Ah/5hWnisDYo0bVO00w= X-Google-Smtp-Source: APXvYqxxzu6RTl/Oo+GsrSevs73eUBcNjwSCRgNYVxvaVD+oXcR2wAtyyCzz82zfIRa6QVW+2YXiu61pGrfm86db8fE= X-Received: by 2002:ab0:7450:: with SMTP id p16mr14910007uaq.20.1579024580528; Tue, 14 Jan 2020 09:56:20 -0800 (PST) MIME-Version: 1.0 References: <20200113170630.GA8134@tarpaulin.shahaf.local2> <1d1c62f2-7d74-4b6c-a08e-78dfe7378fc6@www.fastmail.com> In-Reply-To: <1d1c62f2-7d74-4b6c-a08e-78dfe7378fc6@www.fastmail.com> From: Pier Paolo Grassi Date: Tue, 14 Jan 2020 18:55:43 +0100 Message-ID: Subject: Re: problem with context specification To: Daniel Shahaf Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="00000000000036d021059c1d4ff7" --00000000000036d021059c1d4ff7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable thanks, this is very helpful in putting together many bits of information. zsh has a very extensive documentation and sometimes it feels a bit overwhelming Pier Paolo Grassi linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217 founder: https://www.meetup.com/it-IT/Machine-Learning-TO Il giorno mar 14 gen 2020 alle ore 17:45 Daniel Shahaf < d.s@daniel.shahaf.name> ha scritto: > Pier Paolo Grassi wrote on Tue, 14 Jan 2020 15:59 +00:00: > > to answer Daniel: > > > > > I take it the documentation of zstyle didn't make this clear, so coul= d > you > > > suggest how to improve it? > > > > It's not clear to me what is the meaning of the various "sections"of th= e > > 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, > separated > by colons and with a leading colon before the first. Fields which > are > not yet known are left empty, but the surrounding colons appear > anyway. > The fields are always in the order > :completion:function:completer:command:argument:tag. These have t= he > 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 command= s > 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 > segment, > > 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=B9needl= e=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 > % > % zstyle -s foobar key REPLY > % typeset -p REPLY > typeset REPLY=3Dvalue > % > > For example, I set: > > zstyle ':completion:*:*:git-*:*:hosts' ignored-patterns localhost > ip6-localhost 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. > --00000000000036d021059c1d4ff7--