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

Using buffer for history-incremental-search-backward

I'm trying to figure out how to use history-incremental-search-backward.

I do this.
zsh -f
host% echo abc  > /dev/null
host% echo def  > /dev/null
host% echo ghi  > /dev/null
host% bindkey -e
host% sleep 5
host% echo

So why doesn't the control-R register?  Regardless, there are times I
would like to take the initial contents of the current BUFFER and start
a h-i-s-b.  So I tried to write a widget that can be dropped in the
place of the builtin h-i-s-b.  The problem I've been having is how to
determine if this is the initial call of h-i-s-b, or if it is in the
middle of a search in progress.

Here's my current version:
h-i-s-b () {
        local saveBuf
        zle history-incremental-search-backward $saveBuf
zle -N h-i-s-b h-i-s-b
bindkey "^R" h-i-s-b

The problem is that it doesn't properly handle the situation of being
called in the middle of the current search, like the builtin h.i.s.b.


Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail

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