psql
, the PostgreSQL CLI, uses readline for it's user interface. Readline allows both emacs- and vi editing mode, and psql
uses emacs mode by default. I, on the other hand, use vi for everything; is there a command for setting vi editing mode in psql?
2 Answers
You just have to configure readline appropriately. Create a file .inputrc
in your home directory with the following content:
set editing-mode vi
In case, you don't run the psql on your machine, it's enough to press Ctrl
+Alt
+J
for the session (taken from redit).