Zsh Mailing List Archive
Messages sorted by:
Re: Completions from file with zcompsys
- X-seq: zsh-users 22742
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Completions from file with zcompsys
- Date: Tue, 20 Jun 2017 12:32:15 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=VAenNxZFNKsYNK6QJPXNvZUKZpj7fAh0kMCvEjHT/HA=; b=U+sgMwvXyOg/lg2v4R0G1QdLByapJJx/dMgLDoAwokCL/0K4XyMJzf3Z6bYIFytDtU vaebCYWht/nRCceq2TVu6wEEHTSDtCpM5Fs9JNkWhso6T3UfSYJC4f2JlXo8BY6l/e66 /MCwuc83ZZbZxBvARV0mm3Ehv5xRaDhsDVL1Kz4u6UT2zKFVKqexSs15DAXLBj3lWOZi p7N9j+hITcjWCQbxsLVfp5i2ZI+Inh8ROXbLNqSOLEXmL1y9mGU3SrU7XUwIECkn1r5w /Hv6bCZHEIeafUygWQJMXciKE+ei2z47zOuOHSr+2obSPcDIFAm7qlr8oqOKE4XUZUEV kRnw==
- In-reply-to: <20170620180214.GA5281@gmx.de>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20170620074605.GA3709@gmx.de> <170620102727.ZM5792@torch.brasslantern.com> <20170620180214.GA5281@gmx.de>
On Jun 20, 7:02pm, Dominik Vogt wrote:
} If a different "globbing" character would be easier to implement
No, that would not be easier.
} or a completely different way to allow partial searches in both
} words of the plant name at the same time
I can't think of anything that wouldn't require you to restructure the
file e.g. with colons instead of spaces.
} Trying that there is a slight problem. The file has 9529 lines;
} now, when you type something like
} Chenopodium x<TAB>
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<TAB>
(in which case completion will supply the closing quote) or
$ foo Chenopodium\ x<TAB>
Or you need to use a different key binding that will back up and grab
both words before invoking completion.
} (where no such taxon exists in the file), zsh starts gobbling 100%
} cpu for about half a minute before completing an approximate
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.
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
} 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
Messages sorted by: