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

Re: history-incremental-search-backward with a twist

On Sep 29, 12:16am, Hannu Koivisto wrote:
} What would I have to do if I wanted to have commands that work just
} like history-incremental-search-{forward,backward} but consider
} only history elements that start with what is written on the
} command line at the time of invocation of such a searching command?

Presuming you have 4.0.x, this is ridiculously easy ...

    function beginning-incremental-search {
	zle .${WIDGET/beginning/history} $LBUFFER
    zle -N beginning-incremental-search-backward beginning-incremental-search
    zle -N beginning-incremental-search-forward beginning-incremental-search

    bindkey "^R" beginning-incremental-search-backward

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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