Quantcast
Channel: database – Tech ABC to XYZ
Viewing all articles
Browse latest Browse all 31

To have Vim Psql's editor [ANSWERED]

$
0
0

To have Vim Psql's editor

Asked By: Masi
Originally Asked On: 2009-08-03 03:23:55
Asked Via: superuser

I have a Fresh Ubuntu installation.
I have no personal dot-files active.

I run unsuccessfully e file.sql in Psql, when I have the following in my .bashrc, since Nano opens instead of Vim

export VISUAL=/usr/bin/vim
export EDITOR=/usr/bin/vim
export PSQL_EDITOR=/usr/bin/vim

I run the same command when I have vim in place of PATH/vim in .bashrc for the above three commands.

I get vim when I cat $EDITOR, for instance.

The problem is in environmental variables likely.
However, I am not sure where.

How can you have Vim as Psql’s editor?

He received 2 answers
eventually accepting:

jtb’s answer to

To have Vim Psql's editor

I’m not sure about psql, but if something is goofed up with $EDITOR it will probably fall back on the system default as defined through the /usr/bin/editor symlink, which is nano by default. If you have admin access, try

sudo update-alternatives --config editor

and select vim there. I think programs should still respect $EDITOR if it’s defined but that will define the fallback. It’s the only setting I use and it works just fine.

The answer with the highest score with 1 points was:

jtimberman’s answer to

To have Vim Psql's editor

Edit the file ~/.selected_editor or run select-editor. Select /usr/bin/vim-basic in either case, /usr/bin/vim on Ubuntu is a symlink to /etc/alternatives/vim, which is a symlink to /usr/bin/vim.basic.

Here’s the contents of the file for an Ubuntu system’s postgres user:

postgres@ubuntu904test:~$ cat .selected_editor
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/vim.basic"

If the selected answer did not help you out, the other answers might!

All Answers For: To have Vim Psql's editor

jtb’s answer to

To have Vim Psql's editor

I’m not sure about psql, but if something is goofed up with $EDITOR it will probably fall back on the system default as defined through the /usr/bin/editor symlink, which is nano by default. If you have admin access, try

sudo update-alternatives --config editor

and select vim there. I think programs should still respect $EDITOR if it’s defined but that will define the fallback. It’s the only setting I use and it works just fine.

jtimberman’s answer to

To have Vim Psql's editor

Edit the file ~/.selected_editor or run select-editor. Select /usr/bin/vim-basic in either case, /usr/bin/vim on Ubuntu is a symlink to /etc/alternatives/vim, which is a symlink to /usr/bin/vim.basic.

Here’s the contents of the file for an Ubuntu system’s postgres user:

postgres@ubuntu904test:~$ cat .selected_editor
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/vim.basic"

Of course, you should really check out the original question.

The post To have Vim Psql's editor [ANSWERED] appeared first on Tech ABC to XYZ.


Viewing all articles
Browse latest Browse all 31

Trending Articles