zsh-users
 help / color / mirror / code / Atom feed
* RE: Getting context sensitive glob expansions using new completion
@ 2001-08-13 10:31 martin.ebourne
  0 siblings, 0 replies; 3+ messages in thread
From: martin.ebourne @ 2001-08-13 10:31 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-users



> Borsenkow Andrej wrote:

> Alternatively one can make _all_matches insert a pseudo-match for all
> results from _match, if any:

>   zstyle ':completion:*' completer _complete _all_matches _match
>   zstyle ':completion:*:match:*' group-order all-matches

Thanks, that nearly does what I want. However, I think that tag-order
should do exactly what I want. As in the line I tried previously:

  zstyle ':completion:*:match:*' tag-order all-matches

However, this seems to have no effect. Why is that?

> But the question is: do you really want that?  The consens on this
> list seems to be now that _all_matches is most useful as a separate
> widget.  I.e. you set up completion as you like, without thinking
> about the possibility to insert all matches.  Then you add a new
> binding as described in the manual for _all_matches:
>   zle -C all-matches complete-word _generic
>   bindkey '^Xa' all-matches
>   zstyle ':completion:all-matches:*' old-matches only
>   zstyle ':completion:all-matches:*' completer _all_matches
> And voila, now you can use normal completion until you have the set
> matches you want to insert in the line and then hit ^Xa to do that.

Well I guess its just what I'm used to. Currently I tab to expand the line
and if I don't like it I just undo (ctrl-/), which has always been how Zsh
used to do it. Having said that I like the sound of what you suggest here
so I'll try that out. Some habits are worth changing. ;)

As an aside, the completion system is extremely powerful and not a little
bit difficult to understand and configure when completely new to it.
There's also lots of these little nuggets of information which can help
configure it how you like. Some of them are in various places in the
manual, some on this list, and most are probably still 'secret'. What I
think would be really useful is a hints & tips section in the manual. Kind
of 'if you want this - do this'.

Cheers,

Martin.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Getting context sensitive glob expansions using new completion
  2001-08-10 14:11 martin.ebourne
@ 2001-08-10 14:40 ` Borsenkow Andrej
  0 siblings, 0 replies; 3+ messages in thread
From: Borsenkow Andrej @ 2001-08-10 14:40 UTC (permalink / raw)
  To: martin.ebourne, zsh-users

> 
> completer
>         :completion:* _expand _complete _ignored _approximate _prefix
> glob
>         :completion:*:expand:* 1
> tag-order
>         :completion:*:expand:* all-expansions expansions original
> 
> I also have menu completion switched off at all times (apart from
> _approximate).
> 
> 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.
> 

That is what _match is for. I personally find unconditional _expand on
every TAB bad idea - you always have ^Xe (or ^XE) for that. 

zstyle ':completion:*' completer _oldlist _complete _match

_oldlist makes sure that you are using original expansions when
continuing completion (else second TAB may complete too much).

-andrej


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Getting context sensitive glob expansions using new completion
@ 2001-08-10 14:11 martin.ebourne
  2001-08-10 14:40 ` Borsenkow Andrej
  0 siblings, 1 reply; 3+ messages in thread
From: martin.ebourne @ 2001-08-10 14:11 UTC (permalink / raw)
  To: zsh-users


Hi,

I currently use styles including the following:

completer
        :completion:* _expand _complete _ignored _approximate _prefix
glob
        :completion:*:expand:* 1
tag-order
        :completion:*:expand:* all-expansions expansions original

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

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.

eg.
     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?

Thanks,

Martin.




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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-08-13 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-13 10:31 Getting context sensitive glob expansions using new completion martin.ebourne
  -- strict thread matches above, loose matches on Subject: below --
2001-08-10 14:11 martin.ebourne
2001-08-10 14:40 ` Borsenkow Andrej

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).