addvog
Last Updated: February 25, 2016
·
1.036K
· jafrog

Move cursor to prev/next word in Irb (Pry) Vi-style

A handy key binding to use in irb to move cursor one word forward/backward that recognises dots as word separators:

echo 'bind "\\eb" vi-prev-word\nbind "\\ef" vi-next-word' >> .editrc

It will bind Meta-f/Meta-b to commands vi-next-word & vi-prev-word. This setting will affect not only irb but every program that uses readline (libedit on MacOS X).

Make sure you have Meta key set up in your terminal.

For more info on editline config see man editrc