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
emacs or death!
So nice.
I had just been using “set -o vi” in my .bashrc, but this takes care of that and everything else.
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?
Hi Jeff -
OS 10.5 uses libEdit vs gnu readline. I believe that is why you need
.editrc in this case.
John
Thank you so much. This is perfect
. I used only bindkey -v in zsh, but this is far better.
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
I finally admitted to myself that set editing-mode vi in .inputrc was no longer working
Many Thanks for the great tip