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

Re: using history in a command processor

On Thu, Sep 18, 2008 at 12:57 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Sep 17, 10:59pm, Rocky Bernstein wrote:
} In other words, what I'm looking for is an equivalent to what in bash  is
} "history -s"

You want "print -s".  

Got it. thanks. The organization of the functions to do editing and history seems a bit weird.

I think of print and read going together but the kind of read you need for editing is vared
not read. Bash is a little more logical here in that there is a -e option on read. Of course it doesn't have all the other options for specifying keymaps and so on, but largely that's not needed.

So once you find out not to use read but vared, I find myself in the zle section where of course there is nothing about print -s. And history manipulation seems to be fc which brings us back to builtins which also doesn't mention that there is this print -s thing.

Perhaps there should be a fc thing that is equivalent to "print -s"?

And the name history seems to be better than fc, so it's good there is that builtin. But perhaps it should allow the other options that fc allows. In other words be an alias to "fc" rather than "fc -l".

Functions/Misc/sticky-note has an example of this.
So does Functions/Misc/zcalc, which effectively IS a command processor.

} Also, is there a way to delete an entry?

Only by having them fall off due to HISTSIZE or be skipped by one of the
HIST_IGNORE_* setopts.

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