Thread: psql \e and syntax highlighting in vim
Hello, how to force vim to set sql syntax highlighting, without having to explicitly type ':set syntax=sql', every time when entering vim with \e metacomand from psql? Thanks Irek.
Le 18/05/2010 14:36, Ireneusz Pluta a écrit : > Hello, > > how to force vim to set sql syntax highlighting, without having to > explicitly type ':set syntax=sql', every time when entering vim with \e > metacomand from psql? > > Thanks > > Irek. > Have you tried to add "syntax on" to the main configuration file (/etc/vim/vimrc) ?
In response to Ireneusz Pluta : > Hello, > > how to force vim to set sql syntax highlighting, without having to > explicitly type ':set syntax=sql', every time when entering vim with \e > metacomand from psql? au BufRead /tmp/psql.edit.* set syntax=sql (set that in your ~/.vimrc) Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
damien clochard pisze: Le 18/05/2010 14:36, Ireneusz Pluta a écrit : Hello, how to force vim to set sql syntax highlighting, without having to explicitly type ':set syntax=sql', every time when entering vim with \e metacomand from psql? Thanks Irek. Have you tried to add "syntax on" to the main configuration file (/etc/vim/vimrc) ? Yes, it is on already, but this is global setting to highlight, if particular syntax is set explicitly or recognized by vim. To my understanding, it doesn't, at it is given a temporary file to work on, like '/tmp/psql.edit.96672'. It probably might work if the tmp file was named like '/tmp/psql.edit.96672.sql'. Or invoked with its -c"set syntax=sql" command line switch. So, the whole question is how to have psql to tell vim which particular syntax to use, in one of these ways.
Ireneusz Pluta pisze: Or invoked with its -c"set syntax=sql" command line switch. So, the whole question is how to have psql to tell vim which particular syntax to use, in one of these ways. OK, after real RTFM of man psql in this area:              Tip: psql searches the environment variables PSQL_EDITOR, EDI-              TOR, and VISUAL (in that order) for an editor to use. If all of              them are unset, vi is used on Unix systems, notepad.exe on Win-              dows systems. I found the solution by setting the PSQL_EDITOR to 'vim -c"set syntax=sql"'. It works now the way I want. Thanks
On Tuesday 18. May 2010 15.58.10 Ireneusz Pluta wrote: > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > <html> > <head> > <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> > </head> > <body bgcolor="#ffffff" text="#000000"> > <br> > <br> > Ireneusz Pluta pisze: > <blockquote cite="mid:4BF298D0.4000205@wp.pl" type="cite"> > <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> > Or invoked with its -c"set > syntax=sql" command line switch. So, the whole question is how to have > psql to tell vim which particular syntax to use, in one of these ways.<br> Your mail client is broken. regards, -- Leif Biberg Kristensen http://solumslekt.org/blog/
John Gage pisze: > Please forgive this interruption. > > I am embarrassed to say that I do not know how to set the PSQL_EDITOR > environmental variable. It would be very convenient to know how. > > I have attempted to do it in bash (Mac OSX), but when I do, psql seems > to ignore what I have done. on freebsd and bash: export PSQL_EDITOR='vim -c"set syntax=sql"' To make it permanrent across logins, include that line in your ~/.profile, or, yet better, system wide profile (like /etc/profile), if you have access.
Leif Biberg Kristensen pisze: > On Tuesday 18. May 2010 15.58.10 Ireneusz Pluta wrote: > >> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> >> <html> >> <head> >> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> >> </head> >> <body bgcolor="#ffffff" text="#000000"> >> <br> >> <br> >> Ireneusz Pluta pisze: >> <blockquote cite="mid:4BF298D0.4000205@wp.pl" type="cite"> >> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> >> Or invoked with its -c"set >> syntax=sql" command line switch. So, the whole question is how to have >> psql to tell vim which particular syntax to use, in one of these ways.<br> >> > > Your mail client is broken. > Is it OK this time? What usually happens to break is not the client itself, but my own memory which does not always remind me to click on "send as text only", while myself being too lazy to keep updating Tunderbird message formatting options depending on destination domains. Thank you for the tip.
On Tuesday 18. May 2010 20.13.06 Ireneusz Pluta wrote: > Leif Biberg Kristensen pisze: > > Your mail client is broken. > > > Is it OK this time? Sure, great. > What usually happens to break is not the client itself, but my own > memory which does not always remind me to click on "send as text only", > while myself being too lazy to keep updating Tunderbird message > formatting options depending on destination domains. Maybe someone should submit a feature request to the fine developers of Thunderbird for an option to send messages to mail lists as plain text. > Thank you for the tip. You're welcome :) regards, -- Leif Biberg Kristensen http://solumslekt.org/blog/