Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Questions regarding _hosts completion extension



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