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

Re: completion within a function



On 2020-12-29 10:52 a.m., Bart Schaefer wrote:
On Tue, Dec 29, 2020 at 7:24 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
How do we execute a completion within a function?
Depends on the context.

If the function is already executing as a ZLE widget, it might invoke
"zle recursive-edit".

If it's running as a command or from inside a script, using "vared" to
read from the keyboard into a local is one way.

There are examples of both of these in the Functions tree in the distribution.

I'm looking for something as simple as this:

func ()
{
code
    cd $1 [TAB]
code
code
}

... so that I can automatically execute a completion within a function.  'vared' is a variable editor no?  Does it do more than I think?  Even tho I've turned off all 'smart' expansion here, what would be cool is to have it expand only directories and I'm betting I can zoom in on the exact code to do that.



I presume Ray wants something like "complete ma", which would return
"make man ..." essentially everything that typing "ma<tab>" would
return.

Yeah, just that Filipe.






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