How to bind up arrow in ~/.inputrc (readline) for vim insert mode?

Posted by Pawel Goscicki on Super User See other posts from Super User or by Pawel Goscicki
Published on 2012-10-12T08:53:02Z Indexed on 2012/10/12 9:41 UTC
Read the original article Hit count: 229

Filed under:
|

When in Readline apps with vim mode enabled in ~/.inputrc (set editing-mode vi) is there a way to bind the up arrow key? To previous history, for example. It seems I have to press ESC key first, only then it works.

Here's my attempt at making it work (~/.inputrc):

$if mode=vi
  # INSERT MODE
  set keymap vi-insert
  "\e[A": history-search-backward # up-arrow
  "\e[B": history-search-forward  # down-arrow

Also note, that when I press Ctrl+v and then <Up>, it prints ^[[A.

© Super User or respective owner

Related posts about vim

Related posts about keyboard-shortcuts