Highlighting Real SQL syntax in PHP scripts using Vim

I know that you can enable SQL syntax highlighting in PHP scripts using the option

let php_sql_query=1 

But it just allows you to highlight all the SQL keywords in each row. Even in a normal sentence , for example .

Is there a way to enable this only for lines starting with Select, Refresh, or Delete?

+6
source share
1 answer

Including a query in heredoc with the identifier "SQL" of Vim triggers to highlight SQL syntax in a block, for example:

 $q = <<<SQL SELECT `foo` FROM `db`.`table` WHERE `foo` = 'bar' SQL; 
+9
source

Source: https://habr.com/ru/post/910593/


All Articles