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

Re: Please fix history-search-backward/forward

On Aug 28,  9:54pm, Felipe Contreras wrote:
} zle says:
} Search backward in the history for a line beginning with the first
} word in the buffer.
} GNU readline says:
} Search backward through the history for the string of characters
} between the start of the current line and the point.
} I don't see why anybody would want zle's behavior.

IIRC (it's been a very long time) the expected usage was to recall the
previous history line with ctrl+p and then look backward for some other
history entry where the same command was run with different arguments.
(That's how I use it, in any case.)

However, please keep in mind that zsh was written from scratch about
20 years ago by a university student who really just wanted something
saner than csh with an emacs-like line editor.  If ZLE doesn't pre-date
readline, they're at least near-contemporaries, and zsh's command set
bears no direct relation to readline's -- in fact many zsh features
were based on (sometimes mis-)reading of emacs and ksh documentation
by someone who didn't have ksh and may (I forget) only have had the
Gosling version of emacs rather than Stallman's.

Note that for the first many years of its existence nobody who had ever
used bash was moving to zsh -- new zsh users were all coming from csh
or the old Bourne sh and had never had line editing at all, much less
have any expectation of naming congruence with readline.

Furthermore, it has always been a major tenet of zsh development that
nothing gets changed merely because a new developer has come along and
disagrees with previous design decisions.  Unlike many current OSS
projects which seem to discard the past twice a week and make all the
users adapt to something new, with zsh we've always tried very hard
to provide that someone who last used zsh a decade ago can sit down
with the latest and start running his old scripts from muscle memory
and barely notice the difference (unless he wants to).

} When I type "git check<TAB>"; I expect the whole text to be searched;

You have history-search-* bound to TAB?  What do you use for completion?

On Aug 29, 12:33am, Mikael Magnusson wrote:
} On 29 August 2010 00:23, Felipe Contreras <felipe.contreras@xxxxxxxxx> wrote: 
} > The point is that history-beginning-search-backward-end encompasses
} > the functionality of history-search-backward, so why not make
} > history-search-backward do the same as
} > history-beginning-search-backward-end, if no functionality would be
} > lost?
} They behave differently so I'm not sure what you mean. Trying to
} emulate history-search-backward behavior in
} history-beginning-search-backward(-end) would involve lots of awkward
} cursor movement to put it after the first word.

(See my example above about ctrl+p followed by esc-p.)

} OTOH, if you want the default bindings for ^[p and ^[n to be changed,
} I have no counter argument, but who even uses those keys for history
} movement?

Er, I do, actually.  All the time.  I also have

bindkey ^Xp history-beginning-search-backward

and use that probably slightly more often, but not a lot more often.

On Aug 29,  3:52am, Felipe Contreras wrote:
} Ah!
} So both start from the beginning, so what's the 'beginning' in the
} former supposed to differentiate? Wouldn't history-cur-search-backward
} make more sense?

The history-search-backward widget was around for a few years before
history-beginning-search-backward was added.  A new name was needed
for the new behavior (so as not to break anyone's old zshrc) and one
was chosen that made sense at the time.

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