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

Re: Adding to the history from within a widget



On 2 Jan 2020, at 11:14, Piers Powlesland <pierspowlesland@xxxxxxxxx> wrote:
> I tried to use "print -s xxxxx" to add entries to the history from within a
> widget but it doesn't seem to work, although executing the function not as
> a widget does allow me to add entries to the history.

Maybe i misunderstand, but it seems to work for me:

  % zsh -f
  % foo() { print -s foo test }; zle -N foo; bindkey '^r' foo
  % # Press Ctrl+R
  % fc -l
      1  foo() { print -s foo test }; zle -N foo; bindkey '^r' foo
      2  foo test
  %

What exactly are you doing that's not working?

dana



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