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

Re: File completion with **/ (with solution)



Bart Schaefer wrote on Tue, Sep 20, 2016 at 17:56:23 -0700:
>   _glob_expand() { reply=( $~1* ) }
>   zstyle :completion::user-expand:: user-expand _glob_expand
>   zstyle :completion::user-expand:: tag-order expansions all-expansions
>   zstyle ':completion:*' completer _expand _complete _match _user_expand
> 
> Daniel, this might be the "better answer" to your _match question, too.

Right: I could use _user_expand instead of _expand in my completer
style, and implement a policy such as
.
    1. Try _expand if $condition
    2. Try _match
    3. Try _expand if not $condition
.
with $condition being the *[*][*]* pattern from the _match thread.

> The other thing it might be useful to call out in the doc is to note that
> because _user_expand is called AS a completer, it has access to more of
> the zstyle $context when it is called than when the "completer" style is
> looked up.  This could be handy when deciding what to assign to $reply.

I don't see that additional context: if I define _f as a completer
function, then it's called with curcontext=:f::.

Thanks again for all the investigations.  I've switched to your 'zstyle
-e' solution since this way I don't have to munge $curcontext in my
wrapper function.

Cheers,

Daniel



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