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

insert-all-matches example RE: completion and globbing, part 2



>
> May be, widget to do it (insert all current choices) would be the simplest
> case. Hmm ... may be it is even possible to implement it as function.
>

Very dumb implemetation. It won't work (correctly) if anything is already
inserted on command line - that is, it will insert all matches directly after
anything already there. This may or may not be appropriate.

bor@itsrm2% which _insert_all_matches
_insert_all_matches () {
        compstate[insert]=all
        compstate[old_list]=keep
        _complete
}
bor@itsrm2% zle -C insert-all-matches complete-word _insert_all_matches
bor@itsrm2% bindkey '^Xi' insert-all-matches

With these you could do:

bor@itsrm2% ls f*^D
bor@itsrm2% ls f*
Completing file
fnt/    foo.c

Now press ^Xi

bor@itsrm2% ls fnt foo.c

But, as stated, it has all sorts of problems. It does not work correctly after
*completion* - it tries to complete word already inserted (that is, it is
treated as new completion instead of continuation of old - but this may be
related to my styles settings).  ^D is needed to get a list that is inserted
with ^Xi.

-andrej



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