The documentation says in section 18.4 Widgets, that a "widget’s job is simply to perform some small action". But I cannot find a general description how to invoke these actions, i.e. how to call a widget.
I've seen in examples (for example see this Q&A) that widgets can bin bound to keys using bindkey KEY WIDGET. Then one can call the widget using KEY.
I wanted to toggle set-local-history and I tried:
$ zle set-local-history 1
zle: widgets can only be called when ZLE is active
zle -h not work, but I've found a description of the arguments here. But it does not seem there is something like --call.
What am I doing wrong? How is it possible to call the widget without bindkey? How can I print the current status? (set-local-history toggles the state)
ZLE_STATEis defined only inside widget functions. I refined my answer. What is your goal? [Wild guess: To indicate local/global history in my prompt I use a widget to (i.) set an shell variable (this is possible inside widgets) and (ii.) executezle set-local-history.] – mpy Dec 23 '13 at 10:29*globalhistory*insert*" instead of "*insert*globalhistory*", based on reading the sentence before the example? – Volker Siegel Sep 12 '14 at 18:53execute-named-cmd, which is bound toALT-xwhen using emacs bindings. – mpy Aug 06 '16 at 09:22