Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Questions regarding _hosts completion extension
- X-seq: zsh-workers 50394
- From: Eric Cook <llua@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Questions regarding _hosts completion extension
- Date: Tue, 28 Jun 2022 00:53:08 -0400
- Archived-at: <https://zsh.org/workers/50394>
- In-reply-to: <CAE1zrSGtrMWYKWaeY_p5yT2XfPs=cL_1KiCL6RFJ0J==ToAoYQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author