bashrc:
set -o vi
inputrc:
set editing-mode vi
Now bash and anything using readline will use vi key bindings. This Just Works for most of the common cli tools, e.g. the python shell and psql, but there are exceptions. In the past, the mysql client hasn't respected these settings, and there's also a node library called vorpal that is reinventing readline, poorly and for no obvious reason.