Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: search through alternative HISTFILE
- X-seq: zsh-users 17907
- From: Maarten Grachten <maarten.grachten@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: search through alternative HISTFILE
- Date: Mon, 05 Aug 2013 12:05:56 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=5lMeBAeTvk8M9pGAlNwbqxxQCI0izQDh0JHxmLTPqeg=; b=BKhrRDkI2yyL8f6blCj2Zn29NJdNGs0MUehW/v37aRIbwaaMfCsmDamfxgmbERgnGy X20mXpMZ26F2lzWyVDvqVe7Z+/a9XYXoVIyYlFdIro4Tgz12N37TLwqi9fvFGkyY13eG PoRwxdF60ocNyaG8dfOVqbD2FgOfzuaQlgyE1SuV68J061sXA9RT+9gzSCk1Z6XPIadk Mya4+p9ufQH8D31QLckYy9wAXmEV0dZx+Dsp/nKE2SBul3bg0BMUODzZUxpg1nFFdSTR QGmhO1OfpO0PRVgtKNMReFAEzbGocamUH7z4J92SVD2V1yZrmYuHE+60iFYLiFDRh/1m GdUA==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Sender: Maarten Grachten <maarten.grachten@xxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author