I wrote this: jifty syntax
* Syntax highlight support for html,sql,js embedded heredoc. something like $content=<<HTML123 will make vim highlight the string as HTML
* Dispatcher folding
* Template::Declare tags folding
I encountered some problems of syntax region. the built-in syntax file of perl uses "<<...something" to match heredoc identifiers, which makes HTML highlight the "<" of HereDoc as an error. so I tried to use lookforward regular expression to exclude the "<<" part.
It seems that vim will compile and organize all patterns, so a pattern of heredoc which uses lookforward regular expression won't match heredoc , because the non-lookforward pattern will match first.
Changing the built-in perl syntax is not a good idea , and I tried to syn clear the perlHereDoc region, but it still can't work out. the small hack I did here is, let the '<<' match the HereDoc first , then make it contains a HTML block, and create another syntax region to contain the @htmlTop. set end pattern as "^\(HTML\)\@= to let the HereDoc pattern can match the end.
The sequence of syntax loading is very interesting. Vim will load the $HOME/.vim runtime path at first , after that, Vim loads $VIM/vimfiles , $VIMRUNTIME , then load the $HOME/.vim/after finally.
It was wrong that I put the jifty.vim to ~/.vim/after/syntax and let ~/.vim/syntax/perl.vim to load it, so Vim loads jifty.vim before the built-in perl.vim which override my patterns. Vim documentation also mentioned that the lastest pattern will match first, thus my patterns always can't work out.
Actually, jifty.vim should be located at .vim/after/syntax/perl/ not .vim/after/syntax/. we can put all the enhanced syntax files into a directory, vim will load them automatically.
This told me, I should read all the syntax.txt doc before I play with it...