Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 200 lines (161 sloc) 8.112 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
" Vim syntax file
" Language: Perl POD format with support for arbitrary POD sections
" Maintainer: Andy Lester <andy@petdance.com>,
" Homepage: https://github.com/rkitover/perl-vim-mxd
" Bugs/requests: https://github.com/rkitover/perl-vim-mxd/issues
" Last Change: 2011-01-27
" Contributors: Oleg Kostyuk <cub@cpan.org>
"
" ORIGINAL VERSION:
"
" Language: Perl POD format
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Previously: Scott Bigham <dsb@killerbunnies.org>
" Homepage: http://github.com/vim-perl/vim-perl
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: {{LAST_CHANGE}}

" To add embedded POD documentation highlighting to your syntax file, add
" the commands:
"
" syn include @Pod <sfile>:p:h/pod.vim
" syn region myPOD start="^=pod" start="^=head" end="^=cut" keepend contained contains=@Pod
"
" and add myPod to the contains= list of some existing region, probably a
" comment. The "keepend" flag is needed because "=cut" is matched as a
" pattern in its own right.


" Remove any old syntax stuff hanging around (this is suppressed
" automatically by ":syn include" if necessary).
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

" POD commands
syn match podCommand "^=encoding" nextgroup=podCmdText contains=@NoSpell
syn match podCommand "^=head[1234]" nextgroup=podCmdText contains=@NoSpell
syn match podCommand "^=item" nextgroup=podCmdText contains=@NoSpell
syn match podCommand "^=over" nextgroup=podOverIndent skipwhite contains=@NoSpell
syn match podCommand "^=back" contains=@NoSpell
syn match podCommand "^=cut" contains=@NoSpell
syn match podCommand "^=pod" contains=@NoSpell
syn match podCommand "^=for" nextgroup=podForKeywd skipwhite contains=@NoSpell
syn match podCommand "^=begin" nextgroup=podForKeywd skipwhite contains=@NoSpell
syn match podCommand "^=end" nextgroup=podForKeywd skipwhite contains=@NoSpell
syn match podCommand "^=[a-z]\S*" nextgroup=podForKeywd skipwhite contains=@NoSpell

" Text of a =head1, =head2 or =item command
syn match podCmdText ".*$" contained contains=podFormat,@NoSpell

" Indent amount of =over command
syn match podOverIndent "\d\+" contained contains=@NoSpell

" Formatter identifier keyword for =for, =begin and =end commands
syn match podForKeywd "\S\+" contained contains=@NoSpell

" An indented line, to be displayed verbatim
syn match podVerbatimLine "^\s.*$" contains=@NoSpell

" Inline textual items handled specially by POD
syn match podSpecial "\(\<\|&\)\I\i*\(::\I\i*\)*([^)]*)" contains=@NoSpell
syn match podSpecial "[$@%]\I\i*\(::\I\i*\)*\>" contains=@NoSpell

" Special formatting sequences
syn region podFormat start="[IBSCLFX]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell
syn region podFormat start="[IBSCLFX]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell
syn match podFormat "Z<>"
syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell
syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell
syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_pod_syntax_inits")
  if version < 508
    let did_pod_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink podCommand Statement
  HiLink podCmdText String
  HiLink podOverIndent Number
  HiLink podForKeywd Identifier
  HiLink podFormat Identifier
  HiLink podVerbatimLine PreProc
  HiLink podSpecial Identifier
  HiLink podEscape String
  HiLink podEscape2 Number

  delcommand HiLink
endif

if exists("perl_pod_spellcheck_headings")
" Spell-check headings
  syn clear podCmdText
  syn match podCmdText ".*$" contained contains=podFormat
endif

if exists("perl_pod_formatting")
" By default, escapes like C<> are not checked for spelling. Remove B<>
" and I<> from the list of escapes.
  syn clear podFormat
  syn region podFormat start="[CLF]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell
  syn region podFormat start="[CLF]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell

" Don't spell-check inside E<>, but ensure that the E< itself isn't
" marked as a spelling mistake.
  syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell

" Z<> is a mock formatting code. Ensure Z<> on its own isn't marked as a
" spelling mistake.
  syn match podFormat "Z<>" contains=podEscape,podEscape2,@NoSpell

" These are required so that whatever is *within* B<...>, I<...>, etc. is
" spell-checked, but not the B, I, ... itself.
  syn match podBoldOpen "B<" contains=@NoSpell
  syn match podItalicOpen "I<" contains=@NoSpell
  syn match podNoSpaceOpen "S<" contains=@NoSpell
  syn match podIndexOpen "X<" contains=@NoSpell

" Same as above but for the << >> syntax.
  syn match podBoldAlternativeDelimOpen "B<< " contains=@NoSpell
  syn match podItalicAlternativeDelimOpen "I<< " contains=@NoSpell
  syn match podNoSpaceAlternativeDelimOpen "S<< " contains=@NoSpell
  syn match podIndexAlternativeDelimOpen "X<< " contains=@NoSpell

" Add support for spell checking text inside B<>, I<>, S<> and X<>.
  syn region podBold start="B<[^<]"me=e end=">" oneline contains=podBoldItalic,podBoldOpen
  syn region podBoldAlternativeDelim start="B<<\s" end="\s>>" oneline contains=podBoldAlternativeDelimOpen

  syn region podItalic start="I<[^<]"me=e end=">" oneline contains=podItalicBold,podItalicOpen
  syn region podItalicAlternativeDelim start="I<<\s" end="\s>>" oneline contains=podItalicAlternativeDelimOpen

" Nested bold/italic and vice-versa
  syn region podBoldItalic contained start="I<[^<]"me=e end=">" oneline
  syn region podItalicBold contained start="B<[^<]"me=e end=">" oneline

  syn region podNoSpace start="S<[^<]"ms=s-2 end=">"me=e oneline contains=podNoSpaceOpen
  syn region podNoSpaceAlternativeDelim start="S<<\s"ms=s-2 end="\s>>"me=e oneline contains=podNoSpaceAlternativeDelimOpen

  syn region podIndex start="X<[^<]"ms=s-2 end=">"me=e oneline contains=podIndexOpen
  syn region podIndexAlternativeDelim start="X<<\s"ms=s-2 end="\s>>"me=e oneline contains=podIndexAlternativeDelimOpen

" Restore this (otherwise B<> is shown as bold inside verbatim)
  syn match podVerbatimLine "^\s.*$" contains=@NoSpell

" Ensure formatted text can be displayed in headings and items
  syn clear podCmdText

  if exists("perl_pod_spellcheck_headings")
    syn match podCmdText ".*$" contained contains=podFormat,podBold,
          \podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim,
          \podBoldOpen,podItalicOpen,podBoldAlternativeDelimOpen,
          \podItalicAlternativeDelimOpen,podNoSpaceOpen
  else
    syn match podCmdText ".*$" contained contains=podFormat,podBold,
          \podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim,
          \@NoSpell
  endif

" Specify how to display these
  hi def podBold term=bold cterm=bold gui=bold

  hi link podBoldAlternativeDelim podBold
  hi link podBoldAlternativeDelimOpen podBold
  hi link podBoldOpen podBold

  hi link podNoSpace Identifier
  hi link podNoSpaceAlternativeDelim Identifier

  hi link podIndex Identifier
  hi link podIndexAlternativeDelim Identifier

  hi def podItalic term=italic cterm=italic gui=italic

  hi link podItalicAlternativeDelim podItalic
  hi link podItalicAlternativeDelimOpen podItalic
  hi link podItalicOpen podItalic

  hi def podBoldItalic term=italic,bold cterm=italic,bold gui=italic,bold
  hi def podItalicBold term=italic,bold cterm=italic,bold gui=italic,bold
endif

let b:current_syntax = "pod"

let &cpo = s:cpo_save
unlet s:cpo_save

" vim: ts=8
Something went wrong with that request. Please try again.