psql editor setting on Ubuntu
Posted
by
dezso
on Server Fault
See other posts from Server Fault
or by dezso
Published on 2012-06-29T08:51:17Z
Indexed on
2012/06/29
9:17 UTC
Read the original article
Hit count: 152
The situation is the following. This is an Ubuntu box:
Linux ns3mx3 2.6.32-41-server #89-Ubuntu SMP Fri Apr 27 22:33:31 UTC 2012 x86_64 GNU/Linux
Which means that when I first issue \e
in psql
, I'm asked to choose an editor. Then there is the .selected_editor
file, which contains
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/mcedit-debian"
So far this is OK (it's my problem that I consider this completely useless, but never mind).
Then I set up a .psqlrc
file:
\set PSQL_EDITOR /usr/bin/vim
\set EDITOR /usr/bin/vim
\set VISUAL /usr/bin/vim
As you can see, I wanted to be sure not to miss a candidate variable for editor setting. The file is used as expected:
test=# \echo :EDITOR
/usr/bin/vim
But when I issue the \e
command, none of these is used - I fall back to SELECTED_EDITOR
. The situation remains just the same if I append an \unset SELECTED_EDITOR
to the .psqlrc
file.
Now how can I make .psqlrc
setting win over the default editor?
(PostgreSQL version id 9.1.4)
© Server Fault or respective owner