" Vim syntax file " Language: Perl " Maintainer: Sonia Heimann " Last change: 1997 May 26 " Remove any old syntax stuff hanging around syntax clear " A bunch of useful keywords syntax keyword perlStatement goto return last next syntax keyword perlLabel case default syntax keyword perlConditional if elsif unless else switch syntax keyword perlRepeat while for foreach do syntax keyword perlOperator defined undef syntax keyword perlMiscList shift push pop split join syntax keyword perlMisc print open close rename exit syntax keyword perlTodo contained TODO TBD " perl identifiers. Can be $foo, $foo[...], @{$foo}, ... syntax match perlIdentifierScalar "\$\$*#*[a-zA-Z_][a-zA-Z:0-9_]*\>\(->\)*\([{\[][^{\]][^{\]]*[}\]]\)*" syntax match perlIdentifierArray "@\({\$\)*[a-zA-Z_][a-zA-Z:0-9_]*\>\(}\)*" syntax match perlIdentifierHash "%\({\$\)*[a-zA-Z_][a-zA-Z:0-9_]*\>\(}\)*" syntax match perlIdentifierFunc "\&\({\$\)*[a-zA-Z][a-zA-Z:0-9_]*\>\(}\)*" " String and Character contstants " Highlight special characters (those which have a backslash) differently syntax match perlSpecial contained "\\[0-9][0-9][0-9]\|\\." syntax region perlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains perlSpecial perlIdentifierScalar perlIdentifierArray perlIdentifierHash perlIdentifierFunc syntax region perlStringUnexpanded start=+'+ skip=+\\\\\|\\"+ end=+'+ contains perlSpecial syntax match perlCharacter "'[^\\]'" syntax match perlSpecialCharacter "'\\.'" syntax match perlNumber "-\=\<[0-9]\+L\=\>\|0[xX][0-9a-fA-F]\+\>" "syntax sync ccomment perlComment " Comments. That's simple : # is a comment. syntax match perlComment "#.*$" contains perlTodo syntax match perlBigRegexp "/[^/]*/[^/]*/" contains perlIdentifierScalar perlIdentifierFunc syntax match perlRegexp "/[^/]*/" contains perlIdentifierScalar perlIdentifierFunc syntax keyword perlStorageClass my local syntax match perlClassDecl "^[ ]*package\>[^;]*" syntax match perlInclude "^ *\<\(use\|require\)\>.*$" syntax keyword perlControl BEGIN END syntax match perlLineSkip "\\$" " Functions ... " find ^sub foo{ . Find a nice way to remove the sub from the highlighted part. syntax match perlFunction "^[ ]*sub[ ]*[a-zA-Z][^({]*" if !exists("did_perl_syntax_inits") let did_perl_syntax_inits = 1 " The default methods for highlighting. Can be overridden later highlight link perlLabel Label highlight link perlConditional Conditional highlight link perlRepeat Repeat highlight link perlOperator Operator highlight link perlMiscList perlStatement highlight link perlMisc perlStatement highlight link perlIdentifierScalar perlIdentifier highlight link perlIdentifierArray perlIdentifier highlight link perlIdentifierHash perlIdentifier highlight link perlIdentifierFunc perlIdentifier highlight link perlStringUnexpanded perlString highlight link perlCharacter Character highlight link perlSpecialCharacter perlSpecial highlight link perlNumber Number highlight link perlClassDecl Typedef highlight link perlStorageClass perlType highlight link perlInclude Include highlight link perlControl PreProc highlight link perlStatement Statement highlight link perlType Type highlight link perlString String highlight link perlComment Comment highlight link perlSpecial Special highlight link perlTodo Todo highlight link perlFunction Function highlight link perlIdentifier Identifier endif