On Tue, 14 Sep 2010, Tim Johnson wrote:

Using vim 7.2 in ubuntu 10.04, Huge version with GTK2 GUI.
From :h php
I see the following
"""
If you like SQL syntax highlighting inside Strings:
 let php_sql_query = 1
"""

In truth, I *do not* like SQL syntax highlighting inside Strings.

So in ~/.vim/after/ftplugin/php.vim I have the following:

let php_sql_query = 0

and when I open a PHP file and
:echo php_sql_query
I see 0
--------------------------------------------
Yet, I still have sql keywords highlighted!
Grrr!
--------------------------------------------

How may I turn the feature off?

syntax/php.vim has:

if exists( "php_sql_query")
  syn cluster phpAddStrings contai...@sqltop
endif

So, if you don't want the keywords highlighted, you shouldn't 'let' php_sql_query to anything. They shouldn't be highlighted by default. So, removing any reference whatsoever to php_sql_query would do the trick, but you can also use:

unlet php_sql_query

to be absolutely sure. (In the off chance a plugin is setting it -- seems unlikely.)

<rant degree="slight">

The majority of syntax files seem to have options like php_sql_query, where the name of the variable indicates what you'll get if you 'let' it to 1:

let php_sql_query = 1 " set a non-default
unlet php_sql_query " ensure default is honored (no SQL in strings)

let dtd_no_tag_errors = 1 " override a default (to get no tag errors)
unlet dtd_no_tag_errors " ensure default is honored (you get tag_errors)

Personally, I prefer it when syntax files use the following forms, which make a nicer "yes"/"no"/"don't care" trichotomy:

if exists('php_sql_query') ? php_sql_query : 0
        " some stuff excluded by default
endif

let php_sql_query = 1 " option is on
let php_sql_query = 0 " option is off
unlet php_sql_query   " option is off (by default)

if exists('some_option') ? some_option : 1
        " some stuff included by default
endif

let some_option = 1 " option is on
let some_option = 0 " option is off
unlet some_option   " option is on (by default)

</rant>

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to