I have recently switched to zsh, using robbyrussell's oh-my-zsh
. Before that i used bash with a lot of custom stuff and i am only missing one thing because zsh is trying to be 'too smart':
If i type git commit
and then ↑ zsh goes through all recent git
commands. What i really want though, is going through all commands that start with git commit
(not just git
).
How can i achieve this behavior in (oh-my-)zsh?
Best Answer
I have found the solution to my problem in the ZSH documentation. Oh-my-zsh seems to map the ↑ and ↓ Keys to something like
Which yields the exact behavior I described above. The ZSH Documentation describes the behavior of
history-search-backward
asWhat I wanted instead was the following mapping, which I inserted into my
~/.zshrc
:The behavior of
history-beginning-search-backward
is as follows:Also, if
\e[A
doesn't work for the up or down arrows, press<ctrl-v><KEY (e.g., up arrow)>
in another terminal which gives^[OA
. Then you can use this instead of\e[A
. The process is described here: http://zshwiki.org/home/zle/bindkeys