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

Re: Completeinword and ambiguous completions



Bart Schaefer wrote:

> Consider the following situation:
> 
> zsh% setopt completeinword
> zsh% setopt pro<TAB>
> zsh% setopt prompt<TAB>
> promptbang     promptcr       promptpercent  promptsubst    promptvars
> 
> Note that the prefix "prompt" is unambiguous.  Now consider what happens
> if the cursor is over the "m" when TAB is hit in each of these cases:
> 
> zsh% setopt prompt
> (feep, cursor stays on "m")
> zsh% setopt promptvars
> zsh% setopt promptvars
> (cursor is one space past end of word)
> 
> What I'd like is, in the first of those cases, the cursor doesn't stay
> on the "m" but rather moves to the end of the unambiguous prefix, so that
> I can immediately start menu completion for the rest of the word.  The
> following almost does it:

That's a case for global match specs, since what you want is that the
code finds out that you are in a prefix for possible matches and moves 
you at the end of the unambiguous string. Since completeinword
normally doesn't test this, but instead looks only for strings ending
with the stuff after the cursor, it doesn't help. But with:

  compmatchers=('r:|=*')

It takes the string from the line only as a prefix, builds the
possible matches you were expecting and puts you at the place were
something is missing, i.e. the end in your example.

This is then independent of the setting of completeinword (at least in 
this example). And, of course, you may prefer to use:

  compmatchers=('' 'r:|=*')

to first try to generate matches without this strings-is-a-prefix
behaviour.


Is that good enough?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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