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

Re: Adding to the history from within a widget



I've bound ctrl+o to open fzf (a fuzzy finder) which is populated with the
output of find and then open the selected file in vim.

I'd like to be able to add the vim command to the history, so that pressing
up lets me re-open the same file in vim.


On Fri, 3 Jan 2020, 23:46 Bart Schaefer, <schaefer@xxxxxxxxxxxxxxxx> wrote:

> On Fri, Jan 3, 2020 at 3:10 PM dana <dana@xxxxxxx> wrote:
> >
> > On 3 Jan 2020, at 05:03, Piers Powlesland <pierspowlesland@xxxxxxxxx>
> wrote:
> > > 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?
> >
> > It's the same in master. I'm not positive, but i don't think it's
> possible to
> > make new history entries actually selectable until the next prompt.
>
> That's essentially correct.  Everything that happens from when zle is
> initialized to when it exits (on accept-line or send-break) is part of
> the current history event, and up-history moves to the previous event.
>
> What's the end result you're trying to achieve by adding to the
> history from your widget?
>


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