Mercurial > vim
comparison runtime/syntax/tex.vim @ 2034:7bc41231fbc7
Update runtime files.
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 06 Jan 2010 20:54:52 +0100 |
parents | 73fe8baea242 |
children | b9e314fe473f |
comparison
equal
deleted
inserted
replaced
2033:de5a43c5eedc | 2034:7bc41231fbc7 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: TeX | 2 " Language: TeX |
3 " Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM> | 3 " Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM> |
4 " Last Change: Jun 03, 2008 | 4 " Last Change: Dec 28, 2009 |
5 " Version: 41 | 5 " Version: 46 |
6 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax | 6 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax |
7 " | 7 " |
8 " Notes: {{{1 | 8 " Notes: {{{1 |
9 " | 9 " |
10 " 1. If you have a \begin{verbatim} that appears to overrun its boundaries, | 10 " 1. If you have a \begin{verbatim} that appears to overrun its boundaries, |
101 syn cluster texCmdGroup add=texMathError | 101 syn cluster texCmdGroup add=texMathError |
102 endif | 102 endif |
103 syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement | 103 syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement |
104 syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texSectionMarker,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract | 104 syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texSectionMarker,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract |
105 syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell | 105 syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell |
106 syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher | |
106 syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter | 107 syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter |
107 if !exists("tex_no_math") | 108 if !exists("tex_no_math") |
108 syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ | 109 syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ |
109 syn cluster texMatchGroup add=@texMathZones | 110 syn cluster texMatchGroup add=@texMathZones |
110 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 | 111 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 |
177 syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+ | 178 syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+ |
178 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$" | 179 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$" |
179 | 180 |
180 " \begin{}/\end{} section markers: {{{1 | 181 " \begin{}/\end{} section markers: {{{1 |
181 syn match texSectionMarker "\\begin\>\|\\end\>" nextgroup=texSectionName | 182 syn match texSectionMarker "\\begin\>\|\\end\>" nextgroup=texSectionName |
182 syn region texSectionName matchgroup=Delimiter start="{" end="}" contained nextgroup=texSectionModifier | 183 syn region texSectionName matchgroup=Delimiter start="{" end="}" contained nextgroup=texSectionModifier contains=texComment |
183 syn region texSectionModifier matchgroup=Delimiter start="\[" end="]" contained | 184 syn region texSectionModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment |
184 | 185 |
185 " \documentclass, \documentstyle, \usepackage: {{{1 | 186 " \documentclass, \documentstyle, \usepackage: {{{1 |
186 syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texSectionName,texDocTypeArgs | 187 syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texSectionName,texDocTypeArgs |
187 syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texSectionName | 188 syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texSectionName contains=texComment |
188 | 189 |
189 " Preamble syntax-based folding support: {{{1 | 190 " Preamble syntax-based folding support: {{{1 |
190 if g:tex_fold_enabled && has("folding") | 191 if g:tex_fold_enabled && has("folding") |
191 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=@texMatchGroup | 192 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texMatchGroup |
192 endif | 193 endif |
193 | 194 |
194 " TeX input: {{{1 | 195 " TeX input: {{{1 |
195 syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement | 196 syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement |
196 syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies | 197 syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt |
197 syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt | 198 syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt |
198 syn match texInputCurlies "[{}]" contained | 199 syn match texInputCurlies "[{}]" contained |
199 syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained | 200 syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment |
200 | 201 |
201 " Type Styles (LaTeX 2.09): {{{1 | 202 " Type Styles (LaTeX 2.09): {{{1 |
202 syn match texTypeStyle "\\rm\>" | 203 syn match texTypeStyle "\\rm\>" |
203 syn match texTypeStyle "\\em\>" | 204 syn match texTypeStyle "\\em\>" |
204 syn match texTypeStyle "\\bf\>" | 205 syn match texTypeStyle "\\bf\>" |
307 endif | 308 endif |
308 exe "syn cluster texMathZones add=".grpname | 309 exe "syn cluster texMathZones add=".grpname |
309 exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd | 310 exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd |
310 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' | 311 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' |
311 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' | 312 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' |
312 exe 'HiLink '.grpname.' texMath' | 313 exe 'hi def link '.grpname.' texMath' |
313 if a:starform | 314 if a:starform |
314 let grpname = "texMathZone".a:sfx.'S' | 315 let grpname = "texMathZone".a:sfx.'S' |
315 let syncname = "texSyncMathZone".a:sfx.'S' | 316 let syncname = "texSyncMathZone".a:sfx.'S' |
316 exe "syn cluster texMathZones add=".grpname | 317 exe "syn cluster texMathZones add=".grpname |
317 exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd | 318 exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd |
318 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' | 319 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' |
319 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' | 320 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' |
320 exe 'HiLink '.grpname.' texMath' | 321 exe 'hi def link '.grpname.' texMath' |
321 endif | 322 endif |
322 endfun | 323 endfun |
323 | 324 |
324 " Standard Math Zones: {{{2 | 325 " Standard Math Zones: {{{2 |
325 call TexNewMathZone("A","align",1) | 326 call TexNewMathZone("A","align",1) |
397 endif | 398 endif |
398 | 399 |
399 " Separate lines used for verb` and verb# so that the end conditions {{{1 | 400 " Separate lines used for verb` and verb# so that the end conditions {{{1 |
400 " will appropriately terminate. Ideally vim would let me save a | 401 " will appropriately terminate. Ideally vim would let me save a |
401 " character from the start pattern and re-use it in the end-pattern. | 402 " character from the start pattern and re-use it in the end-pattern. |
402 syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>" contains=@Spell | 403 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell |
403 " listings package: | 404 " listings package: |
404 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell | 405 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell |
405 " moreverb package: | 406 " moreverb package: |
406 syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell | 407 syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell |
407 syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell | 408 syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell |
453 " TeX Lengths: {{{1 | 454 " TeX Lengths: {{{1 |
454 syn match texLength "\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>" | 455 syn match texLength "\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>" |
455 | 456 |
456 " TeX String Delimiters: {{{1 | 457 " TeX String Delimiters: {{{1 |
457 syn match texString "\(``\|''\|,,\)" | 458 syn match texString "\(``\|''\|,,\)" |
459 | |
460 " makeatletter -- makeatother sections | |
461 if !exists("g:tex_no_error") | |
462 syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained | |
463 syn match texStyleStatement "\\[a-zA-Z@]\+" contained | |
464 syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained | |
465 syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained | |
466 endif | |
458 | 467 |
459 " LaTeX synchronization: {{{1 | 468 " LaTeX synchronization: {{{1 |
460 syn sync maxlines=200 | 469 syn sync maxlines=200 |
461 syn sync minlines=50 | 470 syn sync minlines=50 |
462 | 471 |
505 if !exists("tex_no_math") | 514 if !exists("tex_no_math") |
506 HiLink texMathDelimSet1 texMathDelim | 515 HiLink texMathDelimSet1 texMathDelim |
507 HiLink texMathDelimSet2 texMathDelim | 516 HiLink texMathDelimSet2 texMathDelim |
508 HiLink texMathDelimKey texMathDelim | 517 HiLink texMathDelimKey texMathDelim |
509 HiLink texMathMatcher texMath | 518 HiLink texMathMatcher texMath |
519 HiLink texMathZoneV texMath | |
510 HiLink texMathZoneW texMath | 520 HiLink texMathZoneW texMath |
511 HiLink texMathZoneX texMath | 521 HiLink texMathZoneX texMath |
512 HiLink texMathZoneY texMath | 522 HiLink texMathZoneY texMath |
513 HiLink texMathZoneV texMath | 523 HiLink texMathZoneV texMath |
514 HiLink texMathZoneZ texMath | 524 HiLink texMathZoneZ texMath |
515 endif | 525 endif |
516 HiLink texSectionMarker texCmdName | 526 HiLink texSectionMarker texCmdName |
517 HiLink texSectionName texSection | 527 HiLink texSectionName texSection |
518 HiLink texSpaceCode texStatement | 528 HiLink texSpaceCode texStatement |
529 HiLink texStyleStatement texStatement | |
519 HiLink texTypeSize texType | 530 HiLink texTypeSize texType |
520 HiLink texTypeStyle texType | 531 HiLink texTypeStyle texType |
521 | 532 |
522 " Basic TeX highlighting groups | 533 " Basic TeX highlighting groups |
523 HiLink texCmdArgs Number | 534 HiLink texCmdArgs Number |