Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Statistics and completions
On Sat, Dec 5, 2020 at 5:22 AM A. Wik <awik32@xxxxxxxxx> wrote:
>
> I am wondering how hard it would be to implement the collection of
> statistics [...]
> to guide the priority of listed completions.
I would approach that as follows:
Require the zsh/db/gdbm module to be available (incidentally there is
a generic API for database modules if anybody wants to work on other
backends).
In the database, store a mapping from zstyle contexts to group-order
lists. How to populate that mapping is up to you; it could probably
be updated via comppostfuncs. I don't have any good ideas how to
prepopulate it from a history file (particularly if one uses
histignorealldups, as that would skew the frequencies).
At shell startup, evaluate a set of zstyle commands constructed from
the keys of the database, using "zstyle -e" to dynamically fetch the
latest value from the entry whenever the style is looked up. One
generic style might be devised to create new keys for previously
unused contexts.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author