blob: 9809d00b5aa62c975acc27f5a3698a5804ecbae1 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Perl POD format
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003" Maintainer: Scott Bigham <dsb@killerbunnies.org>
Bram Moolenaarc81e5e72007-05-05 18:24:42 +00004" Last Change: 2007 Jan 21
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
6" To add embedded POD documentation highlighting to your syntax file, add
7" the commands:
8"
9" syn include @Pod <sfile>:p:h/pod.vim
10" syn region myPOD start="^=pod" start="^=head" end="^=cut" keepend contained contains=@Pod
11"
12" and add myPod to the contains= list of some existing region, probably a
13" comment. The "keepend" flag is needed because "=cut" is matched as a
14" pattern in its own right.
15
16
17" Remove any old syntax stuff hanging around (this is suppressed
18" automatically by ":syn include" if necessary).
19" For version 5.x: Clear all syntax items
20" For version 6.x: Quit when a syntax file was already loaded
21if version < 600
22 syntax clear
23elseif exists("b:current_syntax")
24 finish
25endif
26
27" POD commands
Bram Moolenaar97409f12005-07-08 22:17:29 +000028syn match podCommand "^=head[1234]" nextgroup=podCmdText contains=@NoSpell
29syn match podCommand "^=item" nextgroup=podCmdText contains=@NoSpell
30syn match podCommand "^=over" nextgroup=podOverIndent skipwhite contains=@NoSpell
31syn match podCommand "^=back" contains=@NoSpell
32syn match podCommand "^=cut" contains=@NoSpell
33syn match podCommand "^=pod" contains=@NoSpell
34syn match podCommand "^=for" nextgroup=podForKeywd skipwhite contains=@NoSpell
35syn match podCommand "^=begin" nextgroup=podForKeywd skipwhite contains=@NoSpell
36syn match podCommand "^=end" nextgroup=podForKeywd skipwhite contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000037
38" Text of a =head1, =head2 or =item command
Bram Moolenaar97409f12005-07-08 22:17:29 +000039syn match podCmdText ".*$" contained contains=podFormat,@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000040
41" Indent amount of =over command
Bram Moolenaar97409f12005-07-08 22:17:29 +000042syn match podOverIndent "\d\+" contained contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000043
44" Formatter identifier keyword for =for, =begin and =end commands
Bram Moolenaar97409f12005-07-08 22:17:29 +000045syn match podForKeywd "\S\+" contained contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000046
47" An indented line, to be displayed verbatim
Bram Moolenaar97409f12005-07-08 22:17:29 +000048syn match podVerbatimLine "^\s.*$" contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000049
50" Inline textual items handled specially by POD
Bram Moolenaar97409f12005-07-08 22:17:29 +000051syn match podSpecial "\(\<\|&\)\I\i*\(::\I\i*\)*([^)]*)" contains=@NoSpell
52syn match podSpecial "[$@%]\I\i*\(::\I\i*\)*\>" contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000053
54" Special formatting sequences
Bram Moolenaar97409f12005-07-08 22:17:29 +000055syn region podFormat start="[IBSCLFX]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000056syn region podFormat start="[IBSCLFX]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +000057syn match podFormat "Z<>"
Bram Moolenaar97409f12005-07-08 22:17:29 +000058syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell
59syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell
60syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000061
62" Define the default highlighting.
63" For version 5.7 and earlier: only when not done already
64" For version 5.8 and later: only when an item doesn't have highlighting yet
65if version >= 508 || !exists("did_pod_syntax_inits")
66 if version < 508
67 let did_pod_syntax_inits = 1
68 command -nargs=+ HiLink hi link <args>
69 else
70 command -nargs=+ HiLink hi def link <args>
71 endif
72
73 HiLink podCommand Statement
74 HiLink podCmdText String
75 HiLink podOverIndent Number
76 HiLink podForKeywd Identifier
77 HiLink podFormat Identifier
78 HiLink podVerbatimLine PreProc
79 HiLink podSpecial Identifier
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +000080 HiLink podEscape String
81 HiLink podEscape2 Number
Bram Moolenaar071d4272004-06-13 20:20:40 +000082
83 delcommand HiLink
84endif
85
86let b:current_syntax = "pod"
87
88" vim: ts=8