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

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

Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> writes:

| On Sep 29,  1:41am, Bart Schaefer wrote:
| }
| } Presuming you have 4.0.x, this is ridiculously easy ...

I have 4.0.2, running on Debian GNU/Linux unstable x86; sorry I
forgot to mention this.

|     function beginning-incremental-search {
| 	if [[ $LASTWIDGET == $WIDGET ]]
| 	then zle .$WIDGET
| 	else zle .$WIDGET $LBUFFER
| 	fi
|     }
|     zle -N history-incremental-search-backward beginning-incremental-search
|     zle -N history-incremental-search-forward beginning-incremental-search

This doesn't seem to do what I want.  Let's try again.  If, after
evaluating that, I say:

dir bar foo
echo foo

I see:

[my-prompt] dir
failing bck-i-search: dirfoo_

whereas I expected it to find "dir bar foo" history entry.  That
is, your change seems to insert to the bck-i-search: -prompt, as if
I had written it, what I have on the command line at the moment I
invoke the search.  In order to do what I want, such insertion
would work only if a) the search would be regexp search and b) it
inserted "^<what I have on the command line>.*" instead of just
"<what I have on the command line>".

| Which means you can't use the old history-incremental-search-* any more if
| you want this variant to work.

This is not a problem; I don't think I have any use for normal
history-incremental-search-* behaviour.

Please don't send copies of list mail

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