In tcsh, the \eP and \eN commands take into account the whitespace-normalized prefix of the current line, not just the first word.For instance if my history containsgit pull upstream feature-dancing-pigsgit cloneand I type% git pulland then hit \eP in tcsh, I get% git pull upstream feature-dancing-pigsif I hit \eP in zsh, I get a history item that just matches the command% git cloneI want to configure zsh to emulate the tcsh behavior. Is it possible?I've tried zsh with the default emacs key configuration and with an explicitbindkey \eP history-search-backwardAs it turns outbindkey \eP history-beginning-search-backwarddoes have the expected behavior I was just using ^[ initially in place of \e.
zsh tcsh-like history navigation
zsh;command history;line editor
There is a function documented in zshcontrib called up-line-or-beginning-search, you can view this by running.  man zshcontrib | less '+/^\s*up-line-or-beginning-search'These widgets are similar to the builtin functions up-line-or-search and down-line-or-search:  if in a multiline buffer they move up                or  down within the buffer, otherwise they search for a history line matching the start of the current line.  In this case, however,                they search for a line which matches the current  line  up  to  the  current  cursor  position,  in  the  manner  of  history-begin                ning-search-backward and -forward, rather than the first word on the line.if you look at the instructions given at the top of the ZLE FUNCTIONS section in man zshcontribZLE FUNCTIONS     Widgets         These  functions  all  implement  user-defined  ZLE widgets (see zshzle(1)) which can be bound to keystrokes in interactive shells.  To use         them, your .zshrc should contain lines of the formautoload functionzle -N functionPersonally I have followed the instructions above, but I suspect nowadays you may not need to...in your ~/.zshrc# register the function with the autoloaderautoload -U up-line-or-beginning-search# define new zle widgetzle -N up-line-or-beginning-search# bind UP key[[ -n ${key[Up]} ]] && bindkey ${key[Up]} up-line-or-beginning-search