zsh-workers
 help / color / mirror / code / Atom feed
From: Eric Cook <llua@gmx.com>
To: zsh-workers@zsh.org
Subject: Re: Questions regarding _hosts completion extension
Date: Tue, 28 Jun 2022 00:53:08 -0400	[thread overview]
Message-ID: <3744fd9f-67c7-4aee-df57-d9c0f151d046@gmx.com> (raw)
In-Reply-To: <CAE1zrSGtrMWYKWaeY_p5yT2XfPs=cL_1KiCL6RFJ0J==ToAoYQ@mail.gmail.com>

On 6/27/22 17:37, Mikhail f. Shiryaev wrote:
> Hello dear workers,
> I have some questions regarding a stock _hosts completion function.
>
> The original function, IMHO, has a few flaws that kind of difficult to address without a heavy development, in particular:
>
>   * It doesn't use cache features, so the shell instances don't share the state between them
>   * It fills up the _cache_hosts only once at the first completion, and the only way to refresh it is `unset _cache_hosts`. A bit obscured
Would be a useful improvement

>   * If one wants to extend the function with his values, then a way to go suggested on the Internet is defining a style `zstyle -e ':completion:*:hosts' hosts 'reply=(...)`. Unfortunately, it completely overrides the original function.

zstyle ':completion:*:hosts' fake foo bar # or use zstyle -e and do something dynamic. the fake-always style could also be used, see zshcompsys(1) about them.
even more fancy things can be accomplished when used with tag-order for a command. like grouping hosts by domain name or other arbitrary ways.

>   * If `reply` executes any function or binary under the hood, the terminal hangs after each <tab> pressing.
Assuming you are referring to the above zstyle -e example, it waits for the command to finish, it should only
"hang" if the command being executed does so. executing something that is slow is probably not a smart idea in
general if you are expecting fast results.


  reply	other threads:[~2022-06-28  4:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 21:37 Mikhail f. Shiryaev
2022-06-28  4:53 ` Eric Cook [this message]
2022-06-29  3:49 ` 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=3744fd9f-67c7-4aee-df57-d9c0f151d046@gmx.com \
    --to=llua@gmx.com \
    --cc=zsh-workers@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).