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

Re: incremental history search

* Eric Mangold (2004-02-21 04:07 +0100)
> On Sat, 21 Feb 2004 02:35:14 +0100, Thorsten Kampe 
> <thorsten@xxxxxxxxxxxxxxxx> wrote:
>> * Eric Mangold (2004-02-21 02:17 +0100)
>>> On Sat, 21 Feb 2004 00:04:00 +0100, Thorsten Kampe
>>> <thorsten@xxxxxxxxxxxxxxxx> wrote:
>>>> I have bound[1] the cursor keys to "up-line-or-search" and
>>>> down-line-or-search. Unfortunately this only completes the first word
>>>> of the search; meaning when I type
>>>> wget http://foo.com
>>>> wget ftp://bar.com
>>>> and then...
>>>> wget http[up cursor]
>>>> ...it completes to "wget ftp://bar.com"; and not to the desired "wget
>>>> http://foo.com";. It only searches matches for the first word ("wget")
>>>> of the already typed command line in history.
>>>> Is it possible to make zsh search for matches of the whole command
>>>> line ("wget http") - and not only the first word?
>>> Yes. I use the following bindings for that.
>>> bindkey '\M-p' history-beginning-search-backward
>>> bindkey '\M-n' history-beginning-search-forward
>> Aah, seems like exactly what I want. Are there any functional
>> disadvantages compared to "up-line-or-search"/"down-line-or-search"
>> (because it seems to me as "history-beginning-search-backward" is a
>> superset of "up-line-or-search")?
> I can't think of any disadvantages, [...]

Hm, now the cursor stays at the beginning of the command line when I
haven't typed anything and press the up cursor - contrary to the
movement to the end of the command line with "up-line-or-search".
Probably because of the missing "up-line" functionality.

It's a bit of a nuisance because I more often change things at the end
of a command line than at the beginning but I think the extra
functionality of "history-beginning-search-backward" makes it a gain
for me though.


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