zsh-users
 help / color / mirror / code / Atom feed
From: Felix von Leitner <felix-zsh@fefe.de>
To: zsh-users@zsh.org
Subject: external completion command
Date: Mon, 19 Feb 2024 13:30:10 +0100	[thread overview]
Message-ID: <ZdNJ0gNILQxhwSR9@qarx.de> (raw)

Hello zsh-users,

I have not kept up to date with the zsh command line completion
functionality for more than ten years and decided to look at it again
recently, only to find it transformed beyond recognition.

I have written a few tools I use for my day job, that are based around
looking words up for example in a TAGS file, and I have also written a
search engine. I usually use these tools from inside my editor, but it
would be nice to have proper completion from the shell, too.

So, basically, what I want to do, is

  % s memc[TAB]
  memccpy
  memchr
  memcpy
  memcmp

However, since the database covers potentially gigabytes of source code,
I have written an optimized tool to list all the words that start with a
certain prefix. I want zsh to run that tool with the prefix I already
typed. I don't want to give zsh a list of all the words, because that
would be very inefficient. I would also like to tell zsh to abort after
reading 100 completions.

I also don't want zsh to cache anything, neither on disk nor in RAM. If
I type tab again, I want it to call the external command again.

To give you an idea about the numbers: for the zsh 5.9 source tree,
there are 76277 distinct words, but starting with memc there are 4.
I don't want zsh to waste time reading and discarding 76273 words.

Is this possible with the current completion system?

Thanks,

Felix


             reply	other threads:[~2024-02-19 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 12:30 Felix von Leitner [this message]
2024-02-19 19:14 ` Bart Schaefer
2024-02-19 20:44   ` Ray Andrews
2024-02-19 22:14     ` Bart Schaefer
2024-02-19 23:03       ` Ray Andrews
2024-02-19 23:24       ` Lawrence Velázquez
2024-02-20 22:01         ` Jim

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=ZdNJ0gNILQxhwSR9@qarx.de \
    --to=felix-zsh@fefe.de \
    --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).