I "set editing-mode vi" in my .inputrc on my Mac OS system, which allows vi editing in IRB. When I'm using a RVM Ruby, the IRB sessions don't process this directive.
Does anyone know a solution?
I "set editing-mode vi" in my .inputrc on my Mac OS system, which allows vi editing in IRB. When I'm using a RVM Ruby, the IRB sessions don't process this directive.
Does anyone know a solution?
As mentioned before, you can add bind -v in your ~/.editrc.
The problem with this, as you may or may not have noticed is that this removes your ability to use tab completion. If you want to keep tab completion you can add: bind \\t rl_complete to your
~/.editrc.
These days, I'm using rbenv-installed Ruby 2.5 on MacOS Mojave and the way to get vi key bindings in irb is to add set editing-mode vi to ~/.inputrc.
It appears that adding bind -v to ~/.editrc isn't required and doesn't help.
I'm on BigSur (11.1) and observe this
So you have to do both to make sure. A method does not work for the other
IRB (interactive Ruby shell) uses the Readline utility for line-editing capabilities.
Readline comes with a set of default keybindings. You can change these in the inputrc file. The location of this file defaults to ~/.inputrc.
When IRB starts up, the inputrc file is read, and the key bindings are set.
To use vim editing mode add the following to your ~/.inputrc
set editing-mode vi
set keymap vi-command
Please consult the documentation for other useful configuration options and where to put them.