Setting vi editing mode for anything that uses readline (bash, psql, Python's REPL, etc...)

Put the following in a file named .inputrc in your home directory:

set editing-mode vi

I haven't tried this yet:

set editing-mode vi
set keymap vi