Skip to content

Commit 48fdbfd

Browse files
TaluuStanAngeloff
authored andcommitted
Add support for SQL coloration in nowdoc blocks
1 parent 763119d commit 48fdbfd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

syntax/php.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"
3535
" Options: php_sql_query = 1 for SQL syntax highlighting inside strings (default: 0)
3636
" php_sql_heredoc = 1 for SQL syntax highlighting inside heredocs (default: 1)
37+
" php_sql_nowdoc = 1 for SQL syntax highlighting inside nowdocs (default: 1)
3738
" b:sql_type_override = 'postgresql' for PostgreSQL syntax highlighting in current buffer (default: 'mysql')
3839
" g:sql_type_default = 'postgresql' to set global SQL syntax highlighting language default (default: 'mysql')"
3940
" php_html_in_strings = 1 for HTML syntax highlighting inside strings (default: 0)
@@ -130,7 +131,11 @@ if !exists("php_sql_heredoc")
130131
let php_sql_heredoc=1
131132
endif
132133

133-
if ((exists("php_sql_query") && php_sql_query) || (exists("php_sql_heredoc") && php_sql_heredoc))
134+
if !exists("php_sql_nowdoc")
135+
let php_sql_nowdoc=1
136+
endif
137+
138+
if ((exists("php_sql_query") && php_sql_query) || (exists("php_sql_heredoc") && php_sql_heredoc) || (exists("php_sql_nowdoc") && php_sql_nowdoc))
134139
" Use MySQL as the default SQL syntax file.
135140
" See https://github.com/StanAngeloff/php.vim/pull/1
136141
if !exists('b:sql_type_override') && !exists('g:sql_type_default')
@@ -652,6 +657,10 @@ endif
652657
" NowDoc
653658
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend
654659

660+
if (exists("php_sql_nowdoc") && php_sql_nowdoc)
661+
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
662+
endif
663+
655664
syn case ignore
656665

657666
" Parent

0 commit comments

Comments
 (0)