ZSH history search is quite helpful, but one nit I have with it is that it moves your 'history pointer' to whereever your last search was. This is irritating if I'm typing a common command, and get landed at a spot in my history from weeks ago:
> ls foo/bar/[up arrow]
> ls foo/bar/baz/weeks/ago #(whoops!)
> [ctrl + u] #(clear it out, start over)
> [up arrow] #(try again...)
> ls more/weeks/ago #(search starts from that weeks-ago point)
I'm using the oh-my-zsh defaults of up-line-or-beginning-search and up-line-or-beginning-search for up-arrow and down-arrow respectively. I've checked man zshcontrib and man zshzle, but the documentation doesn't seem to address this behavior.
Short of shortening the size of the history (something I should probably do anyways), is there a way to make history search always start from the beginning (most recent)?
Press Enter on an empty line before trying again. This will reset
$HISTNO.Alternatively, use
zsh-autocomplete’s history menu & history search. They always start from the most recent item.