Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following entries on my .inputrc for bash:

"\C-p": history-search-backward
"\C-n": history-search-forward
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
"\ew": copy-region-as-kill

I just moved to zsh, and would like to keep the same keyboard bindings I have in bash. Do the lines above have an equivalent in zsh?

share|improve this question
up vote 5 down vote accepted

Almost everything you can do in bash has a zsh equivalent, but you have to handle the translation on a case-by-case basis.

The line editor in zsh is zle. The command to bind keys is bindkey. The line edition commands that can be bound to keys are called widgets.

# You may want to call different history search commands, e.g.
# down-line-or-history or down-line-or-search (and up-*)
bindkey '^P' history-search-backward
bindkey '^N' history-search-forward
bindkey '\e[A' history-search-backward
bindkey '\e[B' history-search-forward
# The others should work already
share|improve this answer
Thanks @Gilles! – Amelio Vazquez-Reina Aug 26 '11 at 14:53

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.