zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "A. Wik" <awik32@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Statistics and completions
Date: Sat, 5 Dec 2020 13:20:45 -0800	[thread overview]
Message-ID: <CAH+w=7Yytf4gVfEuK5jmz9=zZNe8qCDxbdA=qtNSmVcJhdbQJA@mail.gmail.com> (raw)
In-Reply-To: <CALPW7mSbyexy3ECyd_hL4m8UYK+Sx3XAcTLaL8tHgbcdXw1pKQ@mail.gmail.com>

On Sat, Dec 5, 2020 at 5:22 AM A. Wik <awik32@gmail.com> 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.


  reply	other threads:[~2020-12-05 21:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-05 13:21 A. Wik
2020-12-05 21:20 ` Bart Schaefer [this message]
2020-12-05 23:16   ` Felipe Contreras
2020-12-06  1:58     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Yytf4gVfEuK5jmz9=zZNe8qCDxbdA=qtNSmVcJhdbQJA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=awik32@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).