How to use vi motions in Bash

Bash uses readline for input which provides two modes for command line editing - emacs and vi. While emacs is the default, it's easy to switch to vi.

To get into the vi editing mode, use:

$ set -o vi

Unlike vi the editor, you're dropped directly into Edit mode, and you'll have to press the ESC key to get back into Normal mode, where you can perform your normal vi motions.

As a bonus, in Normal mode, you can press v to edit the current command in the vi editor itself!