[SuperFrinkLogo]

PHP Highlighting for Elvis (vi)


Here is a set of elvis syntax rules you can add to your elvis.syn file. Elvis will then highlight the code in any files with a .php or .PHP extension as PHP code.

To make the changes system-wide you will want to add all of lines in the file to your system's elvis.syn. On Slackware 8.1 the file can be found at /usr/share/elvis-2.1_4/elvis.syn

To make it easier to install I've made a patch file. To patch your syntax file just run patch elvis.syn < elvis.syn.patch. This patch expects to insert the PHP lines in between the rules for Perl and TCL. If you have a different version of the systax file than I do it may not work.

In case you don't have write access to the main syntax file you can save the edited file as ~/.elvislib/elvis.syn. Important to note is that if you only save the PHP rules in your local directory then syntax highlighting of other languages will not work any more.

Things to note are: Also you might want to add a few lines to your ~/.exrc to make sure all of the highlighting styles have colors. You could use something like:
      color normal white
      color bold bright red
      color emphasized yellow
      color italic bright green
      color underlined bright blue

      set commentfont=italic
      set keywordfont=bold
      set stringfont=underlined
      set functionfont=emphasized
      set variablefont=normal
      set otherfont=bold
    
Screenshot with Highlighting
Screenshot without Highlighting