blob: f21e72a7011117b023547ee747f8314b69189148 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaarede981a2010-08-11 23:37:32 +02002" Language: Perl POD format
3" Maintainer: Andy Lester <andy@petdance.com>
4" URL: http://github.com/petdance/vim-perl
5" Last Change: 2009-08-14
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7" To add embedded POD documentation highlighting to your syntax file, add
8" the commands:
9"
10" syn include @Pod <sfile>:p:h/pod.vim
11" syn region myPOD start="^=pod" start="^=head" end="^=cut" keepend contained contains=@Pod
12"
13" and add myPod to the contains= list of some existing region, probably a
14" comment. The "keepend" flag is needed because "=cut" is matched as a
15" pattern in its own right.
16
17
18" Remove any old syntax stuff hanging around (this is suppressed
19" automatically by ":syn include" if necessary).
20" For version 5.x: Clear all syntax items
21" For version 6.x: Quit when a syntax file was already loaded
22if version < 600
23 syntax clear
24elseif exists("b:current_syntax")
25 finish
26endif
27
28" POD commands
Bram Moolenaarede981a2010-08-11 23:37:32 +020029syn match podCommand "^=head[1234]" nextgroup=podCmdText contains=@NoSpell
30syn match podCommand "^=item" nextgroup=podCmdText contains=@NoSpell
31syn match podCommand "^=over" nextgroup=podOverIndent skipwhite contains=@NoSpell
32syn match podCommand "^=back" contains=@NoSpell
33syn match podCommand "^=cut" contains=@NoSpell
34syn match podCommand "^=pod" contains=@NoSpell
35syn match podCommand "^=for" nextgroup=podForKeywd skipwhite contains=@NoSpell
36syn match podCommand "^=begin" nextgroup=podForKeywd skipwhite contains=@NoSpell
37syn match podCommand "^=end" nextgroup=podForKeywd skipwhite contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000038
39" Text of a =head1, =head2 or =item command
Bram Moolenaar97409f12005-07-08 22:17:29 +000040syn match podCmdText ".*$" contained contains=podFormat,@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000041
42" Indent amount of =over command
Bram Moolenaar97409f12005-07-08 22:17:29 +000043syn match podOverIndent "\d\+" contained contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000044
45" Formatter identifier keyword for =for, =begin and =end commands
Bram Moolenaar97409f12005-07-08 22:17:29 +000046syn match podForKeywd "\S\+" contained contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000047
48" An indented line, to be displayed verbatim
Bram Moolenaar97409f12005-07-08 22:17:29 +000049syn match podVerbatimLine "^\s.*$" contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000050
51" Inline textual items handled specially by POD
Bram Moolenaar97409f12005-07-08 22:17:29 +000052syn match podSpecial "\(\<\|&\)\I\i*\(::\I\i*\)*([^)]*)" contains=@NoSpell
53syn match podSpecial "[$@%]\I\i*\(::\I\i*\)*\>" contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000054
55" Special formatting sequences
Bram Moolenaar97409f12005-07-08 22:17:29 +000056syn region podFormat start="[IBSCLFX]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000057syn region podFormat start="[IBSCLFX]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +000058syn match podFormat "Z<>"
Bram Moolenaar97409f12005-07-08 22:17:29 +000059syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell
60syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell
61syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +000062
63" Define the default highlighting.
64" For version 5.7 and earlier: only when not done already
65" For version 5.8 and later: only when an item doesn't have highlighting yet
66if version >= 508 || !exists("did_pod_syntax_inits")
67 if version < 508
68 let did_pod_syntax_inits = 1
69 command -nargs=+ HiLink hi link <args>
70 else
71 command -nargs=+ HiLink hi def link <args>
72 endif
73
74 HiLink podCommand Statement
75 HiLink podCmdText String
76 HiLink podOverIndent Number
77 HiLink podForKeywd Identifier
78 HiLink podFormat Identifier
79 HiLink podVerbatimLine PreProc
80 HiLink podSpecial Identifier
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +000081 HiLink podEscape String
82 HiLink podEscape2 Number
Bram Moolenaar071d4272004-06-13 20:20:40 +000083
84 delcommand HiLink
85endif
86
87let b:current_syntax = "pod"
88
89" vim: ts=8