From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26122 invoked by alias); 14 Jan 2015 03:06:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34273 Received: (qmail 21280 invoked from network); 14 Jan 2015 03:06:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,FROM_12LTRDOM, RCVD_IN_DNSWL_NONE,T_MANY_HDRS_LCASE autolearn=no version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=b6gFOWC0 c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=nU6UooPyzhn7GzQoUB8A:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150113190652.ZM20492@torch.brasslantern.com> Date: Tue, 13 Jan 2015 19:06:52 -0800 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: PATCH: Update completion style pattern examples MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Despite my snarky response to Vincent on -users ... diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 2cdc57a..5890f17 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -677,7 +677,7 @@ completion for the tt(kill) builtin. If the style is set, the builtin lists full job texts and process command lines; otherwise it shows the bare job numbers and PIDs. To turn the style off for this use only: -example(zstyle ':completion:*:*:kill:*' verbose no) +example(zstyle ':completion:*:*:kill:*:*' verbose no) For even more control, the style can use one of the tags `tt(jobs)' or `tt(processes)'. To turn off verbose display only for jobs: @@ -704,10 +704,15 @@ as tt(menu) and tt(list-rows-first). Note that the order in which styles are em(defined) does not matter; the style mechanism uses the most specific possible match for a particular style to determine the set of values. More precisely, strings are -preferred over patterns (for example, `tt(:completion::complete:foo)' is -more specific than `tt(:completion::complete:*')), and longer patterns are +preferred over patterns (for example, `tt(:completion::complete:::foo)' is +more specific than `tt(:completion::complete:::*')), and longer patterns are preferred over shorter patterns. +A good rule of thumb is that any completion style pattern that needs to +include more than one wildcard (tt(*)) and that does not end in a tag +name, should include all six colons (tt(:)), possibly surrounding +additional wildcards. + Style names like those of tags are arbitrary and depend on the completion function. However, the following two sections list some of the most common tags and styles. @@ -1507,7 +1512,7 @@ For example, to make the tt(rm) command first complete only names of object files and then the names of all files if there is no matching object file: -example(zstyle ':completion:*:*:rm:*' file-patterns \ +example(zstyle ':completion:*:*:rm:*:*' file-patterns \ '*.o:object-files' '%p:all-files') To alter the default behaviour of file completion DASH()- offer files @@ -1659,7 +1664,7 @@ For example, to have names of builtin commands, shell functions and external commands appear in that order when completing in command position: -example(zstyle ':completion:*:*:-command-:*' group-order \ +example(zstyle ':completion:*:*:-command-:*:*' group-order \ builtins functions commands) ) kindex(groups, completion style) @@ -2045,7 +2050,7 @@ use the completers tt(_complete) and tt(_prefix) but allow case-insensitive completion only with tt(_complete): example(zstyle ':completion:*' completer _complete _prefix -zstyle ':completion:*:complete:*' matcher-list \ +zstyle ':completion:*:complete:*:*:*' matcher-list \ '' 'm:{a-zA-Z}={A-Za-z}') User-defined names, as explained for the tt(completer) style, are @@ -2056,9 +2061,9 @@ with case-insensitive matching, then correction, and finally partial-word completion: example(zstyle ':completion:*' completer _complete _correct _complete:foo -zstyle ':completion:*:complete:*' matcher-list \ +zstyle ':completion:*:complete:*:*:*' matcher-list \ '' 'm:{a-zA-Z}={A-Za-z}' -zstyle ':completion:*:foo:*' matcher-list \ +zstyle ':completion:*:foo:*:*:*' matcher-list \ 'm:{a-zA-Z}={A-Za-z} r:|[-_./]=* r:|=*') If the style is unset in any context no match specification is applied. @@ -2581,7 +2586,7 @@ an exception to this behavior.) For example: -example(zstyle ':completion:*:complete:-command-:*' tag-order \ +example(zstyle ':completion:*:complete:-command-:*:*' tag-order \ 'commands functions') specifies that completion in command position first offers @@ -2640,7 +2645,7 @@ repeat them all. For example, to make completion of function names in command position ignore all the completion functions starting with an underscore the first time completion is tried: -example(zstyle ':completion:*:*:-command-:*' tag-order \ +example(zstyle ':completion:*:*:-command-:*:*' tag-order \ 'functions:-non-comp *' functions zstyle ':completion:*:functions-non-comp' ignored-patterns '_*') @@ -2676,7 +2681,7 @@ try normal completion without any match specification and, if that generates no matches, try again with case-insensitive matching, restricting the effect to arguments of the command tt(foo): -example(zstyle ':completion:*:*:foo:*' tag-order '*' '*:-case' +example(zstyle ':completion:*:*:foo:*:*' tag-order '*' '*:-case' zstyle ':completion:*-case' matcher 'm:{a-z}={A-Z}') First, all the tags offered when completing after tt(foo) are tried using -- Barton E. Schaefer