vi-mode in Bash

As a vim user I've always struggled to consistently the emacs-style keyboard shortcuts in bash. You know: ctrl-A to jump to the beginning of the line, ctrl-E to jump to the end of a line. I just don't like hammering that control key so frequently.

But today I learned that there is also a vi mode in bash. You can activate it with set -o vi. Now you're in a vi-like "insert mode". To exit "insert mode" to "normal mode", press escape. No you can scroll through your history with j & k keys, jump words with w and b and do all the other vimmy things you're accustomed to!

Remember to add set -o vim to you .vimrc to maintain this setting in future terminal sessions.

Show Comments