Last Updated: February 25, 2016
· szajbus

Vimify your command line

Say you entered pretty long command into your shell but noticed an error in the middle. How do you fix that?

Well... What if you could, like in vi, switch from insert to normal mode and modify the input with vi key bindings?

You can do just that.

Put this in ~/.zshrc

bindkey -v

Now your command line is your insert mode. Press ESC to switch to normal mode.

But you're not limited to your shell. You can have the same functionality providing input in other places, like irb or pry, basically any place where readline is used.

Put this in ~/.inputrc

set editing-mode vi
Say Thanks

1 Response
Add your response


For those of us using bash, you can do the same thing with "set -o vi" in your .bash_profile. Thanks for the pro-tip!

over 1 year ago ·
Filed Under