Wednesday, September 15, 2010

problems with 'syntax include' for nested Perl and R code regions

I'm using the code below to highlight different languages within the
same document, using the syntax files shipped with vim 7.2.

1. The code in my Python region highlights perfectly.
2. The code in my Perl region highlights properly, but text in the
main document after the Perl region has some Perl highlighting applied
(mostly pink or magena, I think, I forget which syntax element).
3. The code in my R region doesn't get highlighted at all, although
it gets highlighted fine when it's in its own separate 'rcode.r'
document.

Are these bugs, limitations, or am I doing something wrong? Do the
syntax files themselves have to be written a certain way to be
compatible with 'syntax include'?

-----------------------------------------------------------------------------------

"Perl
syntax include @Perlcode $VIMRUNTIME\syntax\perl.vim
syntax region orgPerl start='^src-Perl' end='^end-Perl'
contains=@Perlcode
"Python
syntax include @python $VIMRUNTIME\syntax\python.vim
syntax region orgPython start="^src-Python" end="^end-Python" keepend
contains=@python
"R
syntax include @rinvim $VIMRUNTIME\syntax\r.vim
syntax region orgR start="^src-R" end="^end-R" keepend
contains=@rinvim
----------------------------------------------------

Thanks for any help,

Herb

--
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

No comments: