Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Adding to the history from within a widget
Hi Dana,
The example you posted works, and also my widget works if i use 'fc -l' to
view the history after executing it.
What doesn't work for me though is pressing up after executing the widget,
I don't see the entry added with 'print -s'.
If I execute another command in the shell I am then able to see the entry
added with 'print -s' by pressing up twice.
I'm wondering if you experience the same, possibly this has been fixed in
newer versions of zsh?
I'm on - zsh 5.4.2 (x86_64-ubuntu-linux-gnu)
On Fri, Jan 3, 2020 at 3:35 AM dana <dana@xxxxxxx> wrote:
> 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