This is for all the vim users out there who edit mod_perl configurations. I wrote a patch for $VIMRUNTIME/syntax/apache.vim that will properly syntax highlight <Perl> blocks inside httpd.conf files. The changes required were actually very minimal:

--- /usr/share/vim/vim63/syntax/apache.vim 2005-03-20 13:35:11.00 +0000000 -0800 +++ apache.vim 2005-06-29 00:49:41.367120680 -0700 @@ -52,6 +52,7 @@ endif syn keyword apacheOption Any All On Off Double EMail DNS Min Minimal +OS Prod ProductOnly Full syn keyword apacheOption emerg alert crit error warn notice info debu +g +syn match apacheOption "perl-script" syn keyword apacheOption registry script inetd standalone syn match apacheOptionOption "[+-]\?\<\(ExecCGI\|FollowSymLinks\|Incl +udes\|IncludesNoExec\|Indexes\|MultiViews\|SymLinksIfOwnerMatch\)\>" syn keyword apacheOption user group valid-user @@ -191,6 +192,14 @@ syn keyword apacheDeclaration PerlCleanupHandler PerlChildInitHandler + PerlChildExitHandler syn keyword apacheDeclaration PerlRestartHandler PerlDispatchHandler syn keyword apacheDeclaration PerlFreshRestart PerlSendHeader +syn include @Perl $VIMRUNTIME/syntax/perl.vim +syn match apacheSection "<Perl>\|<\/Perl>" contained +syn region apachePerlBlock + \ start="<Perl>" + \ end="<\/Perl>" + \ contains=@Perl, apacheSection + \ keepend + syn keyword apacheDeclaration php_value php_flag php_admin_value php_ +admin_flag syn keyword apacheDeclaration AllowCONNECT NoProxy ProxyBlock ProxyDo +main ProxyPass ProxyPassReverse ProxyReceiveBufferSize ProxyRemote Pr +oxyRequests ProxyVia if s:av < "002000000"

This patch was made against the apache.vim that came with vim 6.3, but I've also successfully run it against an apache.vim that came with vim 6.1. But just to be on the safe side, please back up your original apache.vim before you let patch do its magic.

Here's how I'd do it:

# go somewhere you have write access to cd # find out where apache.vim is locate apache.vim # of course, the path on your system to apache.vim may be different. # substitute accordingly cp /usr/share/vim/vim63/syntax/apache.vim . # apply the patch patch < apache.vim.diff # and iff all went well..... sudo cp apache.vim /usr/share/vim/vim63/syntax

In reply to apache.vim with proper highlighting of <Perl> blocks by beppu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.