Mercurial > vim
comparison runtime/syntax/pod.vim @ 4681:2eb30f341e8d
Updated runtime files and translations.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 01 Jun 2013 14:50:56 +0200 |
parents | 0bb74f626ba7 |
children | 11cd8d58372e |
comparison
equal
deleted
inserted
replaced
4680:fd8cc7fbc273 | 4681:2eb30f341e8d |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: Perl POD format | 2 " Language: Perl POD format |
3 " Maintainer: Andy Lester <andy@petdance.com> | 3 " Maintainer: vim-perl <vim-perl@googlegroups.com> |
4 " Previously: Scott Bigham <dsb@killerbunnies.org> | 4 " Previously: Scott Bigham <dsb@killerbunnies.org> |
5 " URL: http://github.com/petdance/vim-perl | 5 " Homepage: http://github.com/vim-perl/vim-perl |
6 " Last Change: 2009-08-14 | 6 " Bugs/requests: http://github.com/vim-perl/vim-perl/issues |
7 " Last Change: 2013 May 30 | |
7 | 8 |
8 " To add embedded POD documentation highlighting to your syntax file, add | 9 " To add embedded POD documentation highlighting to your syntax file, add |
9 " the commands: | 10 " the commands: |
10 " | 11 " |
11 " syn include @Pod <sfile>:p:h/pod.vim | 12 " syn include @Pod <sfile>:p:h/pod.vim |
24 syntax clear | 25 syntax clear |
25 elseif exists("b:current_syntax") | 26 elseif exists("b:current_syntax") |
26 finish | 27 finish |
27 endif | 28 endif |
28 | 29 |
30 let s:cpo_save = &cpo | |
31 set cpo&vim | |
32 | |
29 " POD commands | 33 " POD commands |
34 syn match podCommand "^=encoding" nextgroup=podCmdText contains=@NoSpell | |
30 syn match podCommand "^=head[1234]" nextgroup=podCmdText contains=@NoSpell | 35 syn match podCommand "^=head[1234]" nextgroup=podCmdText contains=@NoSpell |
31 syn match podCommand "^=item" nextgroup=podCmdText contains=@NoSpell | 36 syn match podCommand "^=item" nextgroup=podCmdText contains=@NoSpell |
32 syn match podCommand "^=over" nextgroup=podOverIndent skipwhite contains=@NoSpell | 37 syn match podCommand "^=over" nextgroup=podOverIndent skipwhite contains=@NoSpell |
33 syn match podCommand "^=back" contains=@NoSpell | 38 syn match podCommand "^=back" contains=@NoSpell |
34 syn match podCommand "^=cut" contains=@NoSpell | 39 syn match podCommand "^=cut" contains=@NoSpell |
83 HiLink podEscape2 Number | 88 HiLink podEscape2 Number |
84 | 89 |
85 delcommand HiLink | 90 delcommand HiLink |
86 endif | 91 endif |
87 | 92 |
93 if exists("perl_pod_spellcheck_headings") | |
94 " Spell-check headings | |
95 syn clear podCmdText | |
96 syn match podCmdText ".*$" contained contains=podFormat | |
97 endif | |
98 | |
99 if exists("perl_pod_formatting") | |
100 " By default, escapes like C<> are not checked for spelling. Remove B<> | |
101 " and I<> from the list of escapes. | |
102 syn clear podFormat | |
103 syn region podFormat start="[CLF]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell | |
104 syn region podFormat start="[CLF]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell | |
105 | |
106 " Don't spell-check inside E<>, but ensure that the E< itself isn't | |
107 " marked as a spelling mistake. | |
108 syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell | |
109 | |
110 " Z<> is a mock formatting code. Ensure Z<> on its own isn't marked as a | |
111 " spelling mistake. | |
112 syn match podFormat "Z<>" contains=podEscape,podEscape2,@NoSpell | |
113 | |
114 " These are required so that whatever is *within* B<...>, I<...>, etc. is | |
115 " spell-checked, but not the B, I, ... itself. | |
116 syn match podBoldOpen "B<" contains=@NoSpell | |
117 syn match podItalicOpen "I<" contains=@NoSpell | |
118 syn match podNoSpaceOpen "S<" contains=@NoSpell | |
119 syn match podIndexOpen "X<" contains=@NoSpell | |
120 | |
121 " Same as above but for the << >> syntax. | |
122 syn match podBoldAlternativeDelimOpen "B<< " contains=@NoSpell | |
123 syn match podItalicAlternativeDelimOpen "I<< " contains=@NoSpell | |
124 syn match podNoSpaceAlternativeDelimOpen "S<< " contains=@NoSpell | |
125 syn match podIndexAlternativeDelimOpen "X<< " contains=@NoSpell | |
126 | |
127 " Add support for spell checking text inside B<>, I<>, S<> and X<>. | |
128 syn region podBold start="B<[^<]"me=e end=">" oneline contains=podBoldItalic,podBoldOpen | |
129 syn region podBoldAlternativeDelim start="B<<\s" end="\s>>" oneline contains=podBoldAlternativeDelimOpen | |
130 | |
131 syn region podItalic start="I<[^<]"me=e end=">" oneline contains=podItalicBold,podItalicOpen | |
132 syn region podItalicAlternativeDelim start="I<<\s" end="\s>>" oneline contains=podItalicAlternativeDelimOpen | |
133 | |
134 " Nested bold/italic and vice-versa | |
135 syn region podBoldItalic contained start="I<[^<]"me=e end=">" oneline | |
136 syn region podItalicBold contained start="B<[^<]"me=e end=">" oneline | |
137 | |
138 syn region podNoSpace start="S<[^<]"ms=s-2 end=">"me=e oneline contains=podNoSpaceOpen | |
139 syn region podNoSpaceAlternativeDelim start="S<<\s"ms=s-2 end="\s>>"me=e oneline contains=podNoSpaceAlternativeDelimOpen | |
140 | |
141 syn region podIndex start="X<[^<]"ms=s-2 end=">"me=e oneline contains=podIndexOpen | |
142 syn region podIndexAlternativeDelim start="X<<\s"ms=s-2 end="\s>>"me=e oneline contains=podIndexAlternativeDelimOpen | |
143 | |
144 " Restore this (otherwise B<> is shown as bold inside verbatim) | |
145 syn match podVerbatimLine "^\s.*$" contains=@NoSpell | |
146 | |
147 " Ensure formatted text can be displayed in headings and items | |
148 syn clear podCmdText | |
149 | |
150 if exists("perl_pod_spellcheck_headings") | |
151 syn match podCmdText ".*$" contained contains=podFormat,podBold, | |
152 \podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim, | |
153 \podBoldOpen,podItalicOpen,podBoldAlternativeDelimOpen, | |
154 \podItalicAlternativeDelimOpen,podNoSpaceOpen | |
155 else | |
156 syn match podCmdText ".*$" contained contains=podFormat,podBold, | |
157 \podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim, | |
158 \@NoSpell | |
159 endif | |
160 | |
161 " Specify how to display these | |
162 hi def podBold term=bold cterm=bold gui=bold | |
163 | |
164 hi link podBoldAlternativeDelim podBold | |
165 hi link podBoldAlternativeDelimOpen podBold | |
166 hi link podBoldOpen podBold | |
167 | |
168 hi link podNoSpace Identifier | |
169 hi link podNoSpaceAlternativeDelim Identifier | |
170 | |
171 hi link podIndex Identifier | |
172 hi link podIndexAlternativeDelim Identifier | |
173 | |
174 hi def podItalic term=italic cterm=italic gui=italic | |
175 | |
176 hi link podItalicAlternativeDelim podItalic | |
177 hi link podItalicAlternativeDelimOpen podItalic | |
178 hi link podItalicOpen podItalic | |
179 | |
180 hi def podBoldItalic term=italic,bold cterm=italic,bold gui=italic,bold | |
181 hi def podItalicBold term=italic,bold cterm=italic,bold gui=italic,bold | |
182 endif | |
183 | |
88 let b:current_syntax = "pod" | 184 let b:current_syntax = "pod" |
89 | 185 |
186 let &cpo = s:cpo_save | |
187 unlet s:cpo_save | |
188 | |
90 " vim: ts=8 | 189 " vim: ts=8 |