zsh-users
 help / color / mirror / code / Atom feed
From: Maarten Grachten <maarten.grachten@ofai.at>
To: zsh-users@zsh.org
Subject: Re: search through alternative HISTFILE
Date: Mon, 05 Aug 2013 12:05:56 +0200	[thread overview]
Message-ID: <51FF7904.3030003@ofai.at> (raw)

Dear Peter,

Thank you very much for your answer. Your use case is indeed similar, if 
slightly more complex. I had hoped I could reuse the existing 
history-incremental-search-backward widget, only changing the history 
before calling it. The relevant command (which you also use in your 
widget) seems to be "fc -p <NEWHISTFILE>". As I understand it, this 
pushes the current history and replaces it with a new history, read from 
<NEWHISTFILE>. This approach actually works when I use the fc -p command 
on the command line before hitting Ctrl-R, but when I wrap it in a 
widget it does not work:

# Define shell function to be used as widget:

function accumulated-history-incremental-search-backward () {
     fc -p "${HOME}/.accumulated-history"
     zle .history-incremental-search-backward
}

# Tell zsh to use the function as a widget:

zle -N accumulated-history-incremental-search-backward

# Bind Ctrl-i to the widget:

bindkey "^I" accumulated-history-incremental-search-backward

Is there any particular reason why calling fc -p inside the widget does 
not affect the history search?

Maarten


             reply	other threads:[~2013-08-05 10:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05 10:05 Maarten Grachten [this message]
2013-08-05 18:52 ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
2013-08-06 14:09 Maarten Grachten
2013-08-06 10:11 Maarten Grachten
2013-08-06 11:05 ` Peter Stephenson
2013-08-06  9:55 Maarten Grachten
2013-08-02 10:38 Maarten Grachten
2013-08-02 11:08 ` Peter Stephenson

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=51FF7904.3030003@ofai.at \
    --to=maarten.grachten@ofai.at \
    --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).