Reputation: 1235
I'm trying to create a custom syntax highlighter for MacVim that uses a combination of CSS and PHP, where CSS is static selectors, and sometimes there will be embedded PHP code (very similar to HTML+PHP).
Here is my syntax file:
"Import CSS first
runtime! syntax/css.vim
unlet b:current_syntax
" Use PHP any time there is <? ?>
syn include @syntaxPHP syntax/php.vim
syn region regionPHP start="<?" end="?>" contains=@syntaxPHP
When I open the following:
.my-css {
<?php echo 'my-php'; ?>
}
Only the php part is colored, the css is not.
Upvotes: 2
Views: 76
Reputation: 10455
Use containedin=ALL
:
syn region regionPHP start="<?" end="?>" containedin=ALL contains=@syntaxPHP
Upvotes: 1