comparison runtime/syntax/tex.vim @ 2662:916c90b37ea9

Update runtime files.
author Bram Moolenaar <bram@vim.org>
date Fri, 10 Dec 2010 20:35:50 +0100
parents 5e4b1f442057
children b0d34143ebfc
comparison
equal deleted inserted replaced
2661:a03f7551bacc 2662:916c90b37ea9
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: Aug 12, 2010 4 " Last Change: Sep 17, 2010
5 " Version: 57 5 " Version: 60
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,
65 " Determine whether or not to use "*.sty" mode {{{1 65 " Determine whether or not to use "*.sty" mode {{{1
66 " The user may override the normal determination by setting 66 " The user may override the normal determination by setting
67 " g:tex_stylish to 1 (for "*.sty" mode) 67 " g:tex_stylish to 1 (for "*.sty" mode)
68 " or to 0 else (normal "*.tex" mode) 68 " or to 0 else (normal "*.tex" mode)
69 " or on a buffer-by-buffer basis with b:tex_stylish 69 " or on a buffer-by-buffer basis with b:tex_stylish
70 let b:extfname=expand("%:e") 70 let s:extfname=expand("%:e")
71 if exists("g:tex_stylish") 71 if exists("g:tex_stylish")
72 let b:tex_stylish= g:tex_stylish 72 let b:tex_stylish= g:tex_stylish
73 elseif !exists("b:tex_stylish") 73 elseif !exists("b:tex_stylish")
74 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx" 74 if s:extfname == "sty" || s:extfname == "cls" || s:extfname == "clo" || s:extfname == "dtx" || s:extfname == "ltx"
75 let b:tex_stylish= 1 75 let b:tex_stylish= 1
76 else 76 else
77 let b:tex_stylish= 0 77 let b:tex_stylish= 0
78 endif 78 endif
79 endif 79 endif
90 endif 90 endif
91 91
92 " (La)TeX keywords: only use the letters a-zA-Z {{{1 92 " (La)TeX keywords: only use the letters a-zA-Z {{{1
93 " but _ is the only one that causes problems. 93 " but _ is the only one that causes problems.
94 if version < 600 94 if version < 600
95 set isk-=_ 95 set isk=a-z,A-Z
96 if b:tex_stylish 96 if b:tex_stylish
97 set isk+=@ 97 set isk+=@
98 endif 98 endif
99 else 99 else
100 setlocal isk-=_ 100 setlocal isk=a-z,A-Z
101 if b:tex_stylish 101 if b:tex_stylish
102 setlocal isk+=@ 102 setlocal isk+=@
103 endif 103 endif
104 endif 104 endif
105 105
298 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell 298 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell
299 endif 299 endif
300 300
301 " Bad Math (mismatched): {{{1 301 " Bad Math (mismatched): {{{1
302 if !exists("tex_no_math") 302 if !exists("tex_no_math")
303 syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}" 303 syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|smallmatrix\|xxalignat\)\s*}"
304 syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}" 304 syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}"
305 syn match texBadMath "\\[\])]" 305 syn match texBadMath "\\[\])]"
306 endif 306 endif
307 307
308 " Math Zones: {{{1 308 " Math Zones: {{{1
343 call TexNewMathZone("E","equation",1) 343 call TexNewMathZone("E","equation",1)
344 call TexNewMathZone("F","flalign",1) 344 call TexNewMathZone("F","flalign",1)
345 call TexNewMathZone("G","gather",1) 345 call TexNewMathZone("G","gather",1)
346 call TexNewMathZone("H","math",1) 346 call TexNewMathZone("H","math",1)
347 call TexNewMathZone("I","multline",1) 347 call TexNewMathZone("I","multline",1)
348 call TexNewMathZone("J","subequations",0)
349 call TexNewMathZone("K","xalignat",1) 348 call TexNewMathZone("K","xalignat",1)
350 call TexNewMathZone("L","xxalignat",0) 349 call TexNewMathZone("L","xxalignat",0)
351 350
352 " Inline Math Zones: {{{2 351 " Inline Math Zones: {{{2
353 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd' 352 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd'
410 syn cluster texCommentGroup contains=texTodo,@NoSpell 409 syn cluster texCommentGroup contains=texTodo,@NoSpell
411 endif 410 endif
412 syn case ignore 411 syn case ignore
413 syn keyword texTodo contained combak fixme todo xxx 412 syn keyword texTodo contained combak fixme todo xxx
414 syn case match 413 syn case match
415 if b:extfname == "dtx" 414 if s:extfname == "dtx"
416 syn match texComment "\^\^A.*$" contains=@texCommentGroup 415 syn match texComment "\^\^A.*$" contains=@texCommentGroup
417 syn match texComment "^%\+" contains=@texCommentGroup 416 syn match texComment "^%\+" contains=@texCommentGroup
418 else 417 else
419 if g:tex_fold_enabled 418 if g:tex_fold_enabled
420 " allows syntax-folding of 2 or more contiguous comment lines 419 " allows syntax-folding of 2 or more contiguous comment lines
466 endif 465 endif
467 endif 466 endif
468 endif 467 endif
469 468
470 " Tex Reference Zones: {{{1 469 " Tex Reference Zones: {{{1
471 syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup 470 syn match texRefZone '\\@samp\>' skipwhite nextgroup=texRefLabel
472 syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup 471 syn match texRefZone '\\nocite\>' skipwhite nextgroup=texRefLabel
473 syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup 472 syn match texRefZone '\\bibliography\>' skipwhite nextgroup=texRefLabel
474 syn region texRefZone matchgroup=texStatement start="\\label{" end="}\|%stopzone\>" contains=@texRefGroup 473 syn match texRefZone '\\label\>' skipwhite nextgroup=texRefLabel
475 syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup 474 syn match texRefZone '\\\(page\|eq\)ref\>' skipwhite nextgroup=texRefLabel
476 syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup 475 syn match texRefZone '\\v\=ref' skipwhite nextgroup=texRefLabel
477 syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite 476 syn match texRefZone '\\cite\%([tp]\*\=\)\=' skipwhite nextgroup=texCiteOption,texCite
478 syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite 477 syn region texRefLabel contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup
479 syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite 478 syn region texCiteOption contained matchgroup=Delimiter start='\[' end=']' contains=@Spell,@texRefGroup,@texMathZones,texRefZone nextgroup=texCiteOption,texCite
479 syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texCite
480 480
481 " Handle newcommand, newenvironment : {{{1 481 " Handle newcommand, newenvironment : {{{1
482 syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl 482 syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
483 syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl 483 syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
484 syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl 484 syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
751 \ ['vee' , '∨'], 751 \ ['vee' , '∨'],
752 \ ['Vvdash' , '⊪'], 752 \ ['Vvdash' , '⊪'],
753 \ ['wedge' , '∧'], 753 \ ['wedge' , '∧'],
754 \ ['wr' , '≀']] 754 \ ['wr' , '≀']]
755 for texmath in s:texMathList 755 for texmath in s:texMathList
756 exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1] 756 if texmath[0] =~ '\w$'
757 exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1]
758 else
759 exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1]
760 endif
757 endfor 761 endfor
758 762
759 if &ambw == "double" 763 if &ambw == "double"
760 syn match texMathSymbol '\\gg\>' contained conceal cchar=≫ 764 syn match texMathSymbol '\\gg\>' contained conceal cchar=≫
761 syn match texMathSymbol '\\ll\>' contained conceal cchar=≪ 765 syn match texMathSymbol '\\ll\>' contained conceal cchar=≪
1025 endif 1029 endif
1026 endif 1030 endif
1027 HiLink texError Error 1031 HiLink texError Error
1028 endif 1032 endif
1029 1033
1030 HiLink texCite texRefZone
1031 HiLink texDefCmd texDef 1034 HiLink texDefCmd texDef
1032 HiLink texDefName texDef 1035 HiLink texDefName texDef
1033 HiLink texDocType texCmdName 1036 HiLink texDocType texCmdName
1034 HiLink texDocTypeArgs texCmdArgs 1037 HiLink texDocTypeArgs texCmdArgs
1035 HiLink texInputFileOpt texCmdArgs 1038 HiLink texInputFileOpt texCmdArgs
1050 HiLink texMathZoneX texMath 1053 HiLink texMathZoneX texMath
1051 HiLink texMathZoneY texMath 1054 HiLink texMathZoneY texMath
1052 HiLink texMathZoneV texMath 1055 HiLink texMathZoneV texMath
1053 HiLink texMathZoneZ texMath 1056 HiLink texMathZoneZ texMath
1054 endif 1057 endif
1058 HiLink texRefZone Identifier
1055 HiLink texSectionMarker texCmdName 1059 HiLink texSectionMarker texCmdName
1056 HiLink texSectionName texSection 1060 HiLink texSectionName texSection
1057 HiLink texSpaceCode texStatement 1061 HiLink texSpaceCode texStatement
1058 HiLink texStyleStatement texStatement 1062 HiLink texStyleStatement texStatement
1059 HiLink texTypeSize texType 1063 HiLink texTypeSize texType
1060 HiLink texTypeStyle texType 1064 HiLink texTypeStyle texType
1061 1065
1062 " Basic TeX highlighting groups 1066 " Basic TeX highlighting groups
1067 HiLink texCite Special
1063 HiLink texCmdArgs Number 1068 HiLink texCmdArgs Number
1064 HiLink texCmdName Statement 1069 HiLink texCmdName Statement
1065 HiLink texComment Comment 1070 HiLink texComment Comment
1066 HiLink texDef Statement 1071 HiLink texDef Statement
1067 HiLink texDefParm Special 1072 HiLink texDefParm Special
1073 HiLink texMathDelim Statement 1078 HiLink texMathDelim Statement
1074 HiLink texMathOper Operator 1079 HiLink texMathOper Operator
1075 HiLink texNewCmd Statement 1080 HiLink texNewCmd Statement
1076 HiLink texNewEnv Statement 1081 HiLink texNewEnv Statement
1077 HiLink texOption Number 1082 HiLink texOption Number
1078 HiLink texRefZone Special 1083 HiLink texRefLabel Special
1079 HiLink texSection PreCondit 1084 HiLink texSection PreCondit
1080 HiLink texSpaceCodeChar Special 1085 HiLink texSpaceCodeChar Special
1081 HiLink texSpecialChar SpecialChar 1086 HiLink texSpecialChar SpecialChar
1082 HiLink texStatement Statement 1087 HiLink texStatement Statement
1083 HiLink texString String 1088 HiLink texString String
1087 1092
1088 delcommand HiLink 1093 delcommand HiLink
1089 endif 1094 endif
1090 1095
1091 " Current Syntax: {{{1 1096 " Current Syntax: {{{1
1092 unlet b:extfname 1097 unlet s:extfname
1093 let b:current_syntax = "tex" 1098 let b:current_syntax = "tex"
1094 " vim: ts=8 fdm=marker 1099 " vim: ts=8 fdm=marker