From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17987 invoked by alias); 2 Sep 2018 04:40:42 -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: 43362 Received: (qmail 8008 invoked by uid 1010); 2 Sep 2018 04:40:42 -0000 X-Qmail-Scanner-Diagnostics: from 209.85.167.48 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(209.85.167.48):SA:0(-0.8/5.0):. Processed in 30.221095 secs); 02 Sep 2018 04:40:42 -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=-0.8 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RDNS_NONE, T_DKIM_INVALID,T_SPF_HELO_TEMPERROR,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: abhijeet.1989@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0nXQikJUn2GUc5tj1jGU7pIA9OKOYhH6TcYUJ+ums88=; b=MTkcr8vpOYgU4rNpeEbognBl2wzzb6qR98pRmaxFOgDcrYyzM0CagQNsXuge07L2b6 A3S7HS/C6Fc1cO0gIO39yHZ4fXQkGproirx2mlTanC5EjESZ/PY+fTiflwwO6VToxU6T skfsDZwbHFEH3MGV+VIoRoFHB/iCaSl7YHOL4GaVqzwQL2PRVkS3hd0RZW18b7n04oXw C+wvI3LHTyCBn3S3Joz5ZJjn47CLALvbsyX+DywqOywR2N23NAOjvFOiQYBu/mf8HxQl 4W1HxrZ7EPphYF3jWAKOF//qEwpRlLZHhEjVRFzCAbBm7nTcbPuoxWShNjqjsOEu2glG 9HrA== 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=0nXQikJUn2GUc5tj1jGU7pIA9OKOYhH6TcYUJ+ums88=; b=p/TxmqXDzlNSYWbByuvOwmCrST78cG5yM+Or6kqUZHu/RG8hc7vOOmYE+WO+yA33iy 9bl+iAn0v8sVQWzTUO0W5t4MpXyCP9YkMDoYoqZq4AN5ffjwBWRZe6191AOTVatUJfGk 8gT7rkBYgam5fzXTmoriWIpeq/gazvajZo68x4Cqd96jd8RxXJkZk8yb9BQ6YfL1hEBg PF/AayY2wmXrate1TADXoEGo6gMBSinTcHTqBUEiKSUgJpCOCUdniZBgsj0NzVwXaL+y 5M0suqTIaqXLVEylPHD4S+gkAHueWuuxgtwAwz4+Z11RuDlqerLEV6zkyUIQRBp5Rme/ C99Q== X-Gm-Message-State: APzg51D3bvCQLOFeTmcDhtcdySzFVDlDb66cyw1PGodO5xUumDBs0fvL qpGXE+9cmbxw32w52pRcilbAvcCv+PrZny/PEAM= X-Google-Smtp-Source: ANB0VdZOJAUEzqW7w5zvF90WFL50pryV2PS4W1awEQFaEYK39JRNh5g8pLki9MvF+Wh+i9kNUEkgYIPQ0bXs94vGCxM= X-Received: by 2002:a19:655d:: with SMTP id c29-v6mr2531836lfj.138.1535863089310; Sat, 01 Sep 2018 21:38:09 -0700 (PDT) MIME-Version: 1.0 References: <23890-1535713868.126845@ueVC.nT4d.iPhW> In-Reply-To: <23890-1535713868.126845@ueVC.nT4d.iPhW> From: Abhijeet Rastogi Date: Sun, 2 Sep 2018 10:07:32 +0530 Message-ID: Subject: Re: String partial match from both left and right. To: okiddle@yahoo.co.uk Cc: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary="000000000000dcb0b70574dbfd47" --000000000000dcb0b70574dbfd47 Content-Type: text/plain; charset="UTF-8" Hi, Thanks, Peter. And special thanks to Oliver for the excellent explanation so I could up on what you gave me. I ended up using your approach. On Fri, Aug 31, 2018 at 4:41 PM Oliver Kiddle wrote: > 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 > -- Cheers, Abhijeet Rastogi (shadyabhi) --000000000000dcb0b70574dbfd47--