When bash has vi bindings available (set -o vi), up/down arrows work in both command and insertion mode. When I setup readline's ~/.inputrc to use vi mode (set editing-mode vi), applications like irb don't get the arrow functionality. I've tried "set enable-keypad on" in inputrc to no effect.

How do I get bash-like arrow functionality in other readline aware applications?

  • Did you figure this out by any chance? :) – gak May 3 '12 at 4:50
  • This seems like a bug just in Ruby 1.9's IRB Readline support, because the arrow keys work elsewhere (interactive Python shell, using rlwrap with SBCL, Ruby 1.8 IRB, etc) – atomicules Sep 18 '12 at 8:33

It seems to be an issue only with Ruby's readline (and it's still there).

I deal with it by skipping set editing-mode vi if we're using ruby's readline:

$if ruby
  set editing-mode vi



There's not really anything else to do unless ruby's readline gets fixed.

| improve this answer | |
  • If the mapping works in emacs mode, why not copy it across? – Tom Hale Aug 17 '16 at 1:51

So far, the only way I've been able to use the up/down arrow keys for history is to press ESC first.

This also works with the j and k keys, as long as ESC is pressed first.

| improve this answer | |
  • I find j & k to be a LOT easier to type than the up/down arrows... – jahroy Mar 14 '13 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.