cupaxe wrote:
Is there a way to have different (see below) syntax highlighting for
different portions of a file?
What I am interested in knowing is whether there exists a meta file
format (say multisyn) which highlights different portions of a file
with syntax corresponding to that portion.
For instance, let the file multisyn.cat be the following-
Start of multisyn.cat
+++++++++++++++++++++++++++
#!/usr/bin/perl
print "Hello world\n";
foreach $i ( 1 .. 10 ){
print $i,"\n";
}
+++++++++++++++++++++++++++
#!/bin/tcsh
set hello = "world";
echo $hello
+++++++++++++++++++++++++++
End of multisyn.cat
What I would like is that each portion of multisyn.cat be highlighted
with a different syntax corresponding to that portions file marked by
the #!/usr/... indicator. For instance, I would like the first portion
to be highlighted using the perl syntax and the second portion be
highlighted using the tcsh syntax.
If there doesn't exist one, would it be possible to create a new file
type called say multisyn and write a syntax which does the job? Is it
possible?
Thanks,
Krishna
Some languages can include text written in other languages, and the
corresponding syntax script takes that into account: for instance, you might
want to look into $VIMRUNTIME/syntax/html.vim to see how it caters for CSS
style sheets, VBS scripts and JS scripts embedded into HTML pages; or into
$VIMRUNTIME/syntax/vim.vim which accepts here-documents in perl, python, ruby,
tcl or scheme, embedded into Vim scripts.
Best regards,
Tony.