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 copied my bashrc and start tweaking it for zsh, but I suddenly found ^P wasn't functioning,

It just print a ^P on screen.

What could be wrong? Or where should I look at now?

share|improve this question
up vote 4 down vote accepted

You are probably using vi-like key-bindings in zsh without knowing it.

Zsh chooses the default keyboard mode by looking at $VISUAL and $EDITOR. If those look vi-ish (like "vim"), it'll choose vi-like bindings instead of emacs-like bindings.

C-p is a binding that's only in the emacs-like key-table by default. You're obviously free to bind keys to whatever you like in the vi-like key-tables as well, as "int" suggested. But chances are, that you really want emacs mode instead, which you can achieve by doing the following somewhere in your configuration:

bindkey -e

...preferably before you're doing other keyboard-related configuration.

As always, full details about zsh's line editor (zle) can be found in the corresponding section of zsh's reference manual. It describes how the default mode is chosen, as well as which actions are bound to what keys by default in the different key-maps.

share|improve this answer
Yeah, I set EDITOR to vim, and I was wondering why all default keybinds are gone, +1 for mentioning -e – warl0ck Nov 4 '12 at 10:24


bindkey "^P" up-line-or-history
share|improve this answer

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.