zsh-users
 help / color / mirror / code / Atom feed
From: Rocky Bernstein <rocky.bernstein@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re: An example of writing a custom history file?
Date: Mon, 15 Dec 2014 02:09:39 -0500	[thread overview]
Message-ID: <CANCp2gYhs8S863OfkMb824QHPx0xPq2cYqJ_8sB8qd-2N91CHg@mail.gmail.com> (raw)
In-Reply-To: <141214185332.ZM24112@torch.brasslantern.com>

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

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@brasslantern.com>
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".
>

  reply	other threads:[~2014-12-15  7:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15  1:38 Rocky Bernstein
2014-12-15  2:53 ` Bart Schaefer
2014-12-15  7:09   ` Rocky Bernstein [this message]
2014-12-15  8:37     ` Bart Schaefer
2014-12-15 14:26       ` Rocky Bernstein
2014-12-15 16:14         ` Bart Schaefer
2014-12-15 17:05           ` Rocky Bernstein
2014-12-15 17:46             ` Peter Stephenson
2014-12-15 18:22             ` Mikael Magnusson
2014-12-16  3:58               ` Rocky Bernstein
2014-12-15 18:26             ` Bart Schaefer
2014-12-15 18:34               ` Mikael Magnusson
2014-12-16 11:36                 ` Peter Stephenson
2014-12-16  5:57               ` Rocky Bernstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCp2gYhs8S863OfkMb824QHPx0xPq2cYqJ_8sB8qd-2N91CHg@mail.gmail.com \
    --to=rocky.bernstein@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).