codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: Perl POD format3" Maintainer: vim-perl <vim-perl@googlegroups.com> (need to be subscribed to post)4" Previously: Scott Bigham <dsb@killerbunnies.org>5" Homepage: https://github.com/vim-perl/vim-perl6" Bugs/requests: https://github.com/vim-perl/vim-perl/issues7" License: Vim License (see :help license)8" Last Change: 2022 Jun 139 10" To add embedded POD documentation highlighting to your syntax file, add11" the commands:12"13" syn include @Pod <sfile>:p:h/pod.vim14" syn region myPOD start="^=pod" start="^=head" end="^=cut" keepend contained contains=@Pod15"16" and add myPod to the contains= list of some existing region, probably a17" comment. The "keepend" flag is needed because "=cut" is matched as a18" pattern in its own right.19 20 21" Remove any old syntax stuff hanging around (this is suppressed22" automatically by ":syn include" if necessary).23" quit when a syntax file was already loaded24if exists("b:current_syntax")25 finish26endif27 28let s:cpo_save = &cpo29set cpo&vim30 31" TODO: add supported encodings when we can utilize better performing Vim 8 features32syn match podEncoding "[0-9A-Za-z_-]\+" contained contains=@NoSpell33 34" Text of a =head1, =head2 or =item command35syn region podCmdText start="\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contained contains=podFormat,@NoSpell36 37" Indent amount of =over command38syn match podOverIndent "\d*\.\=\d\+\>" contained contains=@NoSpell39 40" Formatter identifier keyword for =for, =begin and =end commands41syn match podForKeywd "\S\+" contained contains=@NoSpell42 43" An indented line, to be displayed verbatim44syn region podVerbatim start="^\s\+\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contains=@NoSpell45 46syn region podOrdinary start="^\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contains=podFormat,podSpecial,@Spell47 48" Inline textual items handled specially by POD49syn match podSpecial "\(\<\|&\)\I\i*\(::\I\i*\)*([^)]*)" contains=@NoSpell50syn match podSpecial "[$@%]\I\i*\(::\I\i*\)*\>" contains=@NoSpell51 52" Special formatting sequences53 54syn cluster podFormat contains=podFormat,podFormatError55 56syn match podFormatError "[ADGHJKM-RT-WY]<"57 58syn region podFormat matchgroup=podFormatDelimiter start="[IBSCLFX]<" end=">" contains=@podFormat,@NoSpell59syn region podFormat matchgroup=podFormatDelimiter start="[IBSCLFX]<<\%(\s\+\|$\)" end="\%(\s\+\|^\)>>" contains=@podFormat,@NoSpell60 61syn match podFormat "Z<>"62 63syn region podFormat matchgroup=podFormatDelimiter start="E<" end=">" oneline contains=podEscape,podEscape2,@NoSpell64 65" HTML entities {{{166" Source: Pod/Escapes.pm67syn keyword podEscape contained lt gt quot amp apos sol verbar lchevron rchevron nbsp iexcl cent pound curren yen brvbar sect uml copy ordf laquo not shy reg macr deg plusmn sup2 sup3 acute micro para middot cedil sup1 ordm raquo frac14 frac12 frac34 iquest Agrave Aacute Acirc Atilde Auml Aring AElig Ccedil Egrave Eacute Ecirc Euml Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute Ocirc Otilde Ouml times Oslash Ugrave Uacute Ucirc Uuml Yacute THORN szlig agrave aacute acirc atilde auml aring aelig ccedil egrave eacute ecirc euml igrave iacute icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide oslash ugrave uacute ucirc uuml yacute thorn yuml fnof Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Iota Kappa Lambda Mu Nu Xi Omicron Pi Rho Sigma Tau Upsilon Phi Chi Psi Omega alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi rho sigmaf sigma tau upsilon phi chi psi omega thetasym upsih piv bull hellip prime Prime oline frasl weierp image real trade alefsym larr uarr rarr darr harr crarr lArr uArr rArr dArr hArr forall part exist empty nabla isin notin ni prod sum minus lowast radic prop infin ang and or cap cup int there4 sim cong asymp ne equiv le ge sub sup nsub sube supe oplus otimes perp sdot lceil rceil lfloor rfloor lang rang loz spades clubs hearts diams OElig oelig Scaron scaron Yuml circ tilde ensp emsp thinsp zwnj zwj lrm rlm ndash mdash lsquo rsquo sbquo ldquo rdquo bdquo dagger Dagger permil lsaquo rsaquo68" }}}69 70syn match podEscape2 "\d\+" contained contains=@NoSpell71syn match podEscape2 "0\=x\x\+" contained contains=@NoSpell72syn match podEscape2 "0\o\+" contained contains=@NoSpell73 74 75" POD commands76syn match podCommand "^=encoding\>" nextgroup=podEncoding skipwhite contains=@NoSpell77syn match podCommand "^=head[1234]\>" nextgroup=podCmdText skipwhite skipnl contains=@NoSpell78syn match podCommand "^=item\>" nextgroup=podCmdText skipwhite skipnl contains=@NoSpell79syn match podCommand "^=over\>" nextgroup=podOverIndent skipwhite contains=@NoSpell80syn match podCommand "^=back" contains=@NoSpell81syn match podCommand "^=cut" contains=@NoSpell82syn match podCommand "^=pod" contains=@NoSpell83syn match podCommand "^=for" nextgroup=podForKeywd skipwhite contains=@NoSpell84syn match podCommand "^=begin" nextgroup=podForKeywd skipwhite contains=@NoSpell85syn match podCommand "^=end" nextgroup=podForKeywd skipwhite contains=@NoSpell86 87" Comments88 89syn keyword podForKeywd comment contained nextgroup=podForComment skipwhite skipnl90 91if exists("perl_pod_no_comment_fold")92 syn region podBeginComment start="^=begin\s\+comment\s*$" end="^=end\s\+comment\ze\s*$" keepend extend contains=podCommand93 syn region podForComment start="\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contained contains=@Spell,podTodo94else95 syn region podBeginComment start="^=begin\s\+comment\s*$" end="^=end\s\+comment\ze\s*$" keepend extend contains=podCommand,podTodo fold96 syn region podForComment start="\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contained contains=@Spell,podTodo fold97endif98 99syn keyword podTodo contained TODO FIXME XXX100 101" Plain Pod files102syn region podNonPod start="\%^\%(=\w\+\>\)\@!" end="^\ze=\a\w*\>"103syn region podNonPod matchgroup=podCommand start="^=cut\>" end="\%$"104syn region podNonPod matchgroup=podCommand start="^=cut\>" end="^\ze=\a\w*\>"105 106" Define the default highlighting.107" Only when an item doesn't have highlighting yet108 109hi def link podCommand Statement110hi def link podBeginComment Comment111hi def link podForComment Comment112hi def link podNonPod Comment113hi def link podTodo Todo114hi def link podCmdText String115hi def link podEncoding Constant116hi def link podOverIndent Number117hi def link podForKeywd Identifier118hi def link podVerbatim PreProc119hi def link podFormat Identifier120hi def link podFormatDelimiter podFormat121hi def link podFormatError Error122hi def link podSpecial Identifier123hi def link podEscape Constant124hi def link podEscape2 Number125 126if exists("perl_pod_spellcheck_headings")127 " Spell-check headings128 syn clear podCmdText129 syn region podCmdText start="\S.*$" end="^\s*$" end="^\ze=cut\>" contained contains=podFormat130endif131 132if exists("perl_pod_formatting")133 " By default, escapes like C<> are not checked for spelling. Remove B<>134 " and I<> from the list of escapes.135 syn clear podFormat136 syn region podFormat start="[CLF]<[^<]"me=e-1 end=">" contains=@podFormat,@NoSpell137 syn region podFormat start="[CLF]<<\%(\s\+\|$\)" end="\%(\s\+\|^\)>>" contains=@podFormat,@NoSpell138 139 " Don't spell-check inside E<>, but ensure that the E< itself isn't140 " marked as a spelling mistake.141 syn region podFormat start="E<" end=">" oneline contains=podEscape,podEscape2,@NoSpell142 143 " Z<> is a mock formatting code. Ensure Z<> on its own isn't marked as a144 " spelling mistake.145 syn match podFormat "Z<>" contains=podEscape,podEscape2,@NoSpell146 147 " These are required so that whatever is *within* B<...>, I<...>, etc. is148 " spell-checked, but not the B, I, ... itself.149 syn match podBoldOpen "B<" contains=@NoSpell150 syn match podItalicOpen "I<" contains=@NoSpell151 syn match podNoSpaceOpen "S<" contains=@NoSpell152 syn match podIndexOpen "X<" contains=@NoSpell153 154 " Same as above but for the << >> syntax.155 syn match podBoldAlternativeDelimOpen "B<<\%(\s\+\|$\)" contains=@NoSpell156 syn match podItalicAlternativeDelimOpen "I<<\%(\s\+\|$\)" contains=@NoSpell157 syn match podNoSpaceAlternativeDelimOpen "S<<\%(\s\+\|$\)" contains=@NoSpell158 syn match podIndexAlternativeDelimOpen "X<<\%(\s\+\|$\)" contains=@NoSpell159 160 " Add support for spell checking text inside B<>, I<>, S<> and X<>.161 syn region podBold start="B<[^<]"me=e end=">" contains=podBoldItalic,podBoldOpen162 syn region podBoldAlternativeDelim start="B<<\%(\s\+\|$\)" end="\%(\s\+\|^\)>>" contains=podBoldAlternativeDelimOpen163 164 syn region podItalic start="I<[^<]"me=e end=">" contains=podItalicBold,podItalicOpen165 syn region podItalicAlternativeDelim start="I<<\%(\s\+\|$\)" end="\%(\s\+\|^\)>>" contains=podItalicAlternativeDelimOpen166 167 " Nested bold/italic and vice-versa168 syn region podBoldItalic contained start="I<[^<]"me=e end=">"169 syn region podItalicBold contained start="B<[^<]"me=e end=">"170 171 syn region podNoSpace start="S<[^<]"ms=s-2 end=">"me=e contains=podNoSpaceOpen172 syn region podNoSpaceAlternativeDelim start="S<<\%(\s\+\|$\)"ms=s-2 end="\%(\s\+\|^\)>>"me=e contains=podNoSpaceAlternativeDelimOpen173 174 syn region podIndex start="X<[^<]"ms=s-2 end=">"me=e contains=podIndexOpen175 syn region podIndexAlternativeDelim start="X<<\%(\s\+\|$\)"ms=s-2 end="\%(\s\+\|^\)>>"me=e contains=podIndexAlternativeDelimOpen176 177 " Restore this (otherwise B<> is shown as bold inside verbatim)178 syn region podVerbatim start="^\s\+\S.*$" end="^\ze\s*$" end="^\ze=cut\>" contains=@NoSpell179 180 " Ensure formatted text can be displayed in headings and items181 syn clear podCmdText182 183 if exists("perl_pod_spellcheck_headings")184 syn match podCmdText ".*$" contained contains=@podFormat,podBold,185 \podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim,186 \podBoldOpen,podItalicOpen,podBoldAlternativeDelimOpen,187 \podItalicAlternativeDelimOpen,podNoSpaceOpen188 else189 syn match podCmdText ".*$" contained contains=@podFormat,podBold,190 \podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim,191 \@NoSpell192 endif193 194 " Specify how to display these195 hi def podBold term=bold cterm=bold gui=bold196 197 hi link podBoldAlternativeDelim podBold198 hi link podBoldAlternativeDelimOpen podBold199 hi link podBoldOpen podBold200 201 hi link podNoSpace Identifier202 hi link podNoSpaceAlternativeDelim Identifier203 204 hi link podIndex Identifier205 hi link podIndexAlternativeDelim Identifier206 207 hi def podItalic term=italic cterm=italic gui=italic208 209 hi link podItalicAlternativeDelim podItalic210 hi link podItalicAlternativeDelimOpen podItalic211 hi link podItalicOpen podItalic212 213 hi def podBoldItalic term=italic,bold cterm=italic,bold gui=italic,bold214 hi def podItalicBold term=italic,bold cterm=italic,bold gui=italic,bold215endif216 217let b:current_syntax = "pod"218 219let &cpo = s:cpo_save220unlet s:cpo_save221 222" vim: ts=8 fdm=marker:223 