From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2919 invoked by alias); 20 Jun 2017 21:43:03 -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: X-Seq: 22743 Received: (qmail 5056 invoked from network); 20 Jun 2017 21:43:03 -0000 X-Qmail-Scanner-Diagnostics: from mout.gmx.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(212.227.17.21):SA:0(-1.0/5.0):. Processed in 3.141271 secs); 20 Jun 2017 21:43:03 -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.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: dominik.vogt@gmx.de X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at gmx.de designates 212.227.17.21 as permitted sender) Date: Tue, 20 Jun 2017 22:42:49 +0100 From: Dominik Vogt To: zsh-users@zsh.org Subject: Re: Completions from file with zcompsys Message-ID: <20170620214249.GA15063@gmx.de> Reply-To: dominik.vogt@gmx.de Mail-Followup-To: zsh-users@zsh.org References: <20170620074605.GA3709@gmx.de> <170620102727.ZM5792@torch.brasslantern.com> <20170620180214.GA5281@gmx.de> <170620123215.ZM6430@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <170620123215.ZM6430@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Provags-ID: V03:K0:KaFCTNrltp82deo93bkkc7c+JWXa/GvFLmMT8mlCrvxOCCkirDK te7jkQuzLj2Mz/77JUloAjL6J8pEyOurGN9+jrrMy67zXQ+W/ji/x1Q8VMrAMrj00otF91W RaGH7G9h1HTit4TXPffjSiYT8YRyTZ8jkZrUgwPpoiZq9mA37ivPEeL4I9JcB/8f1KZ9XGS GLxDtbtlHRpl8KkhDa25A== X-UI-Out-Filterresults: notjunk:1;V01:K0:eLKZLyR/qO4=:+2TNr1/IvMHBCzMyYx+Ffm SVt9Zk2AIeSD4hMQBsp2K7M67ArwGjAxZCH6j5kxO+kE4Qu5Zd4qt0u4eAkcV3U/lHp0SOe7X zFRSYZrw56orsRmyHvJOqQpKscCl//eKjVZHXWoRDH1bMbIneKLnjd8hAQDEn8qgJZt96iLc0 zSsUm3+WFy8nf1tPOY6KdlPzDMVVLiXZhs8egwouz0J11HW4uKCqAHc2Jzr9UXjixU4KHn1FJ 6/9CV4Pin1yQW2JGD+6uryl5L/wQGmBLSzYrSI8vfhy7851WMPFpcwbKoizZDiqhGd28e3P5S GRqVXzNTfNG117jF+FKS2INpVQpQ5sPpuT54YDFCs95eX6qq7gBXvTg4GyEZrBdMTHJoV0s8V ANMOhLJJ1MX04Lls32CgWuMLZaPsJsYl3z/HkUba2zsT2idVTiiaVSrIe1Da0qKVduAy3Ar+o ck5RXpPq3nnEerEeoIJwJ8ZEKY+U0H+F+WRV9LmAaqxBmk2IF4Mgu+Y6ymVL2Iq/4HCD/c2tq bHyH8oguwLrFLvPfnmtqcP8EBMUI/xG/RBC/db0tXO1T0zeY41Dq9qEekWEVSbWCase88HFCZ nxdcEATWDKlTApW2GbHEpArtGvJvS/T5Y7zacku5/wL+tM58IOs/RcfwVc33jK0UnfsdFYcYL ZpOzl+9gSOnuPfq1BsIWMAb+T722BQoyMGqR8zAS5QSiLlY8w1obbC2jecuCDx9Arr59BemXz yLwCZ5zsiH9ZyjiORgtngxxswI8sA7CWPC96FdydskjibiwA5pWaahmk4E0= On Tue, Jun 20, 2017 at 12:32:15PM -0700, Bart Schaefer wrote: > On Jun 20, 7:02pm, Dominik Vogt wrote: > } Trying that there is a slight problem. The file has 9529 lines; > } now, when you type something like > } > } Chenopodium x > > OK, here you have two words but you haven't quoted them. So the match > is going to only be on "x" -- completion is tightly bound to the shell > parser idea of a "word". You need to start from > > $ foo 'Chenopodium x > > (in which case completion will supply the closing quote) or > > $ foo Chenopodium\ x That was really just a typo in the mail. On the command line, the space was quotred. > Or you need to use a different key binding that will back up and grab > both words before invoking completion. That youldn't help because a taxon can be one to four words, at least, possibly more. > } (where no such taxon exists in the file), zsh starts gobbling 100% > } cpu for about half a minute before completing an approximate > } match. > > Yeah, approximate isn't going to deal well with that much data, it has > to try multiple different substrings of the input word against every > word passed to compadd. Although in the example above the fact that > it is looking for every word that has something that might be mistaken > for an "x" may make it worse. Isn't there a way to switch it off for a specific command? Reading the examples I'd have guessed that zstyle ':completion:*' completer _complete _match _approximate zstyle ':completion:*:*:foo' completer _complete _match Would turn off the _approximate completer for the foo command, but it doesn't. > For this you might want to write a real function and run "agrep" or "fzf" > or something like those, to pre-filter the file contents before passing > to compadd. Well, keeping this in mind; the approximation stuff may not be that important anyway. > } zstyle ':completion:*' completer _complete _match _approximate > } zstyle ':completion:*:match:*' original only > } zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' > > There's a typo in that last line, there should be a space before the > word "numeric". Oops. Ciao Dominik ^_^ ^_^ -- Dominik Vogt