Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
add comment

1 Answer 1

up vote 3 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! –  user815423426 Aug 26 '11 at 14:53
add comment

Your Answer

 
discard

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.