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

Re: alias hygiene



On Feb 17,  4:17pm, Ray Andrews wrote:
}
} That doesn't sound too terrible, not some actualnew construction? So a 
} function can be a widget?

Sort of.  A function can be one component of a widget.  The other parts
of a widget are the bit of zsh internals that explains how it works in
ZLE, and the name used to refer to the whole composite.  A "user-defined"
widget has a shell function, those internals, and a name.  A "builtin"
widget has C code, internals, and a name.

} Show me one that I can understand

Daniel tried to do so a few messages ago, in users/23134.  You create a
widget with either "zle -N" (which sets up the internals for a "normal"
widget and attaches the name) or "zle -C" (which sets up internals for
completion and names it).

Once you have one of those objects you can use its name in "bindkey".

} When would I call 
} something a widget, not a function? When it's associated with ZLE?

Approximately, yes.  Most of the time it's convenient if the widget and
the function that implements it have the same name, but that's not a
requirement; for example, many function that implement searches or line
motions can handle going both forward and backward, so there will be
two widget names but only one function.



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