Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have history-search-backward mapped as PageUp.

When I type:

git push <PageUp><PageUp><PageUp>
  1. in Bash it begins to cycle through all history entries beginning with git push
  2. in Zsh it begins to cycle through all history entries beginning with git so it will list entries such git status, git remote update etc. This is not what I want.

How can I have zsh behave like bash? What setopt should I set?

share|improve this question

1 Answer 1

up vote 11 down vote accepted
bindkey "^[[5~" history-beginning-search-backward

bindkey "^[[6~" history-beginning-search-forward

This is what I use

share|improve this answer
If you want that the same functionality but with Up and Down arror, replace the binding key "^[[5~" to "^[[A" and "^[[6~" to "^[[B" – Millisami Apr 9 '12 at 7:54
zsh's history-beginning-search still have a subtle difference from bash(readline)'s history-search. readline's command is equivalent to history-backward/forward (and put the cursor at the end of the line) before u move the cursor in the line (which will make it turns into "history-beginning-search") while zsh's ones always put the cursor at the beginning of the line. Is there a easy way to change this behavior without writing a new widget? THX – yuyichao Aug 7 '12 at 17:28
@yuyichao, did you perhaps find how to make zsh behave like bash? – courteous Aug 23 at 14:44
@courteous Not really, Although I'm getting used to the zsh behavior after using it for some time... Especially since a simple <C-e> can turn the zsh behavior to the bash behavior but not so easy the other way around. – yuyichao Aug 23 at 20:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.