Add the following lines to the zsh config e.g. .zshrc
bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward
The behavior of history-beginning-search-backward
is as follows:
Search forward in the history for a line beginning with the current line up to the cursor. This leaves the cursor in its original position.