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

Re: An example of writing a custom history file?



Thanks for the pointer. That program is too complicated and there is too
much going on for me to understand which parts add to the history file. I'm
guessing it has something to do with the
zle .push-line.

Here is the 138 line program boiled down to less than 10,  the parts I'd
like to focus on:

    #!/usr/bin/zsh
    fc -ap /tmp/example_history 1000
    # Read lines and add them to history
    local sticky
    while vared -h -p "hey: "  sticky
    do
        print $sticky
        sticky=''
    done

In the above, if I add lines to history file /tmp/example_history, I see
them available in vared. However in the the above doesn't *add* lines to
the history.

Additionally what I would like to do in the body of the loop decide whether
or not to add this to the history.

Thanks


On Sun, Dec 14, 2014 at 9:53 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:

> On Dec 14,  8:38pm, Rocky Bernstein wrote:
> }
> } Is there an example somewhere that I can follow for this?
>
> The only one I can suggest is Functions/Misc/sticky-note which comes
> with zsh.  Look at uses of "fc -ap".
>


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