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

Re: [bug] Completion functions _files/_path_files -F filter on escaped file names



Took me a while to get back to this, went on vacation and veered to other topics.

On Sat, Jun 24, 2023 at 12:55 PM Johan Grande <nahoj@xxxxxxxxx> wrote:

After looking at your suggestion and other, existing completions such as
_git, I get the impression that I shouldn't use _files but rather mimic
its basic behavior with _multi_parts [...]
If you have any tips or a good example to study, I'll be grateful.

The shortest possible example would be something like

local expl # set by _wanted
local tree=(**/*)
_wanted files expl 'files in tree' _multi_parts "$@" -f - / tree

The stuff you describe here ...
 
- complete will all files under a path filtered with a regex or an
arbitrary command
- contrary to _git, I won't have a root dir so if I'm working in a
directory with >10k files under it, I might want to suggest only
immediate children in the first instance rather than browse everything
at once.

... all goes into how you populate the "tree" array before calling _multi_parts.


Messages sorted by: Reverse Date, Date, Thread, Author