2

I want to change the external editor in psql. But the command select-editor does not work. How can I change it? How do I run the command?

1
  • What operating system? Commented Mar 23, 2018 at 16:42

1 Answer 1

3

There are environmental variables you can set, from man psql

PSQL_EDITOR, EDITOR, VISUAL

Editor used by the \e, \ef, and \ev commands. These variables are examined in the order listed; the first that is set is used.

The built-in default editors are vi on Unix systems and notepad.exe on Windows systems.

The PSQL_EDITOR is if you want to specify a unique editor for just PostgreSQL. You can probably ignore that as not many people have a different editor for that, but in the event you're using a SQL Editor, go for it.

On Linux, you probably want to change EDITOR. On Ubuntu and Debian, that's done like this,

sudo update-alternatives --config editor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.