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

Re: Inserting all completions



On Mon, Jul 19, 1999 at 10:51:36PM +0000, Bart Schaefer wrote:

> On Jul 19, 11:30am, Danek Duvall wrote:
>
> > Is there a simple way to insert all the possible completions into the
> > current commandline?
> 
> In the new 3.1.6 completion system, you can use
> 
> 	compadd -A the_matches ...
> 	compadd -UQ "$the_matches"
> 
> [ Explanation snipped ]

Hmmm, okay ... I don't want to replace completion with this entirely.  I'd
like to have two keystrokes -- one, tab, is the normal completion
mechanism.  The second, ^X^I or something, puts all the matches on the
line.

Could I do something like:

function _widget() {
  function_to_compute_reply
  local -a the_matches
  compadd -A the_matches $reply
  compadd -UQ "$the_matches"
}

zle -N _widget
bindkey "^X^I" _widget

(I haven't yet migrated to the new completion stuff, so forgive me if I'm
stomping all over the normal usage of compadd ... ;)

The question then is, how to write function_to_compute_reply() in a
suitably generic manner ...

Thanks,
Danek



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