From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18925 invoked by alias); 31 Aug 2018 11:21:24 -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: List-Unsubscribe: X-Seq: 43356 Received: (qmail 823 invoked by uid 1010); 31 Aug 2018 11:21:24 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(-1.6/5.0):. Processed in 1.948405 secs); 31 Aug 2018 11:21:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=jHIi=LO=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1535713870; bh=Dn7VUtUD4sefbObNmVQ8kfVfLDy7z2jL62KbFBeSUM4=; h=From:References:To:Subject:Date:From:Subject; b=i6S5z4EFR6piJLjC0ElNWdBx8p0UY1/30QcOOdDJdfP2U9Oq6Jj3h3sdgtNFIvsT5McVICAVHNhLTG1oxSjmvw7odo7EimWgE9T/bZ6XuS+9skKx51HOMkZSoUIWM6hCyxYW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W_lZjvi0BtaGxwkM6nVfjeNl2eJQ0JbE_hHFk4lssA5EklWV YPgWn1Dbk0A5z_WbIi7r1hkXPNcdMHVnyN0Sos3F301L5ONiFx1E4WG2SXqnPzBwPGYr2h_g4ELF g36PN70SFMpC7DVzd.JhLuWLbldtE1Nkb0B.73r6UmyDVmBNb1ptd cc: zsh-workers@zsh.org In-reply-to: From: Oliver Kiddle References: To: Abhijeet Rastogi Subject: Re: String partial match from both left and right. MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23889.1535713868.1@hydra> Date: Fri, 31 Aug 2018 13:11:08 +0200 Message-ID: <23890-1535713868.126845@ueVC.nT4d.iPhW> Abhijeet Rastogi wrote: > function _hello { > _values -s ' ' 'dashboards' foo bar foo-bar > } > compdef _hello hello > > And what I want is, if I do:- > > $hello bar > > I want `foo-bar` to come in the completion menu. I figured that it has > something to do with mater-list but I can't seem to get it working. You're right that the matching control is the way to achieve this and in particular the 'l:|=*' specification. > zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'l:|=* r:|=*' That sets a global matcher to apply for all completions. It will first try case-insensitive matching and then try again with extra characters allowed at both the beginning (left) and end (right) of what has been typed. When you complete bar, the "bar" candidate will match when doing the initial case-insensitive match and is accepted. It then never gets to try the second matching rule. You need the l: spec in the first argument so it would work with either: zstyle ':completion:*' matcher-list 'l:|=*' or: zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*' That assumes you don't have any other matcher-list styles with a more specific context. Also, as I mentioned setting matcher-list is a fairly global setting. If you only want this for hello then the matcher style might be more appropriate: zstyle ':completion:*:hello:values:*' matcher 'l:|=*' Alternatively you might want to specify the matcher directly in the _hello function. For example: function _hello { _wanted dashboards expl 'dashboard' compadd -M 'l:|=*' foo bar foo-bar } There are other things you might try, for example r:|-=* allows f-b to match foo-bar. Oliver