jump to navigation

Adding vi keybindings to irb, script/console, and mysql October 19, 2008

Posted by John Dewey in Rails, Ruby.
trackback

I loves me my vi, and sun keyboard mappings (although it drives people crazy when they peer on my macbook).

Add the following on OS X 10.5:

john@emopop:~> cat .editrc
bind -v

This will work for OS X 10.4 and other operating systems:

john@emopop:~> cat .inputrc
set editing-mode vi

Comments»

1. reidmix - October 24, 2008

emacs or death!

2. Ben Oakes - December 22, 2008

So nice.

I had just been using “set -o vi” in my .bashrc, but this takes care of that and everything else.

3. Jeff - February 15, 2009

Thanks for this. For some reason, .inputrc (the first thing I tried) doesn’t seem to work on OS X 10.5. Did they switch from readline to editline or something?

4. John Dewey - February 15, 2009

Hi Jeff -

OS 10.5 uses libEdit vs gnu readline. I believe that is why you need
.editrc in this case.

John

5. yogsototh - June 11, 2009

Thank you so much. This is perfect :-) . I used only bindkey -v in zsh, but this is far better.

6. Neal Clark - November 14, 2009

if you’re like me and can’t live without ^L clearing the screen (in irb and script/console), you’ll want this second line too:

bind -v
bind ^L ed-clear-screen

7. david wright - November 24, 2009

I finally admitted to myself that set editing-mode vi in .inputrc was no longer working

Many Thanks for the great tip