Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have php files well any file type in general that I would like vim to highlight here docs sections using a different syntax highlighting.

<?php
echo <<<HTMLDOC
<h1> I am highlighted as html </h1>
<<<HTMLDOC

echo 'High Lighted as PHP again '
?>
share|improve this question
up vote 1 down vote accepted

You can tweak the colors of course but try this:

:highlight MyHereDoc ctermbg=green guibg=green
:match MyHereDoc /<<<\([A-Za-z]*\)\_.*\1/

Also, if you plan on it being something more perminant in your vimrc add:

highlight MyHereDoc ctermbg=green guibg=green
matchadd("MyHereDoc", '<<<\([A-Za-z]*\)\_.*\1')
share|improve this answer
    
TY I will try it as soon as I get the chance. – Prospero Oct 6 '11 at 16:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.