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

Getting context sensitive glob expansions using new completion


I currently use styles including the following:

        :completion:* _expand _complete _ignored _approximate _prefix
        :completion:*:expand:* 1
        :completion:*:expand:* all-expansions expansions original

I also have menu completion switched off at all times (apart from

So then when I type eg.
     ls *<tab>
the * is expanded immediately into a full list of files (by _expand, tab
being mapped to complete-word).

This is what I want for ls. However, in general I would like the *
expansion to be the list of things valid at the point rather than always a
list of files, which is what I currently get.

     functions *<tab>
should expand to a list of functions.

So to achieve this I tried the following:

To add the list of all expansions I added _all_matches, and to get a list
of valid expansions using globbing I added _match. I added _match before
_complete because I want globbing to be expanded first, as in:
     zstyle ':completion:*' completer _all_matches _expand _match _complete _ignored _approximate _prefix

In order to prevent _match from affecting anything entered which is not a
pattern I did:
     zstyle ':completion:*' match-original only

In order that the all expansions list contains only those generated by
globbing I did this:
     zstyle ':completion:*' avoid-completer _expand _complete _ignored _approximate _prefix

And in order to stop expand from getting there first I did this:
     zstyle ':completion:*:expand:*' glob false

Now everything nearly works. I seem to get a list of all expansions when I
want it (ie. when a glob pattern is present), containing the matches I want
(ie. context dependant). However, I also get the list of individual
matches, and it launches into menu completion at the first available
opportunity. So I though maybe one of these might help:
     zstyle ':completion:*:all-matches:*' tag-order all-matches
     zstyle ':completion:*:match:*' tag-order all-matches

But unfortunately neither of them seemed to do anything. (even when I
changed it to ':completion:*' and deleted all my other tag-orders.)

Any suggestions on how to get the last step of inserting the all-matches
list straight way?



This e-mail message is CONFIDENTIAL and may contain legally privileged
information.  If you are not the intended recipient you should not  read,
copy, distribute, disclose or otherwise use the information in this e-mail.
Please also telephone or fax us immediately and delete the message from
your system.  E-mail may be susceptible to data corruption, interception
and unauthorised amendment, and we do not accept liability for any such
corruption, interception or amendment or the consequences thereof.

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