Add IM control support
[MacVim.git] / runtime / syntax / plaintex.vim
blob7020c68e9bd8865f09d606087bfa3094258bd2b4
1 " Vim syntax file
2 " Language:         TeX (plain.tex format)
3 " Maintainer:       Nikolai Weibull <now@bitwi.se>
4 " Latest Revision:  2006-10-26
6 if exists("b:current_syntax")
7   finish
8 endif
10 let s:cpo_save = &cpo
11 set cpo&vim
13 syn match   plaintexControlSequence         display contains=@NoSpell
14       \ '\\[a-zA-Z@]\+'
16 runtime! syntax/initex.vim
17 unlet b:current_syntax
19 syn match   plaintexComment                 display
20       \ contains=ALLBUT,initexComment,plaintexComment
21       \ '^\s*%[CDM].*$'
23 if exists("g:plaintex_delimiters")
24   syn match   plaintexDelimiter             display '[][{}]'
25 endif
27 syn match   plaintexRepeat                  display contains=@NoSpell
28       \ '\\\%(loop\|repeat\)\>'
30 syn match   plaintexCommand                 display contains=@NoSpell
31       \ '\\\%(plainoutput\|TeX\)\>'
32 syn match   plaintexBoxCommand              display contains=@NoSpell
33       \ '\\\%(null\|strut\)\>'
34 syn match   plaintexDebuggingCommand        display contains=@NoSpell
35       \ '\\\%(showhyphens\|tracingall\|wlog\)\>'
36 syn match   plaintexFontsCommand            display contains=@NoSpell
37       \ '\\\%(bf\|\%(five\|seven\)\%(bf\|i\|rm\|sy\)\|it\|oldstyle\|rm\|sl\|ten\%(bf\|ex\|it\=\|rm\|sl\|sy\|tt\)\|tt\)\>'
38 syn match   plaintexGlueCommand             display contains=@NoSpell
39       \ '\\\%(\%(big\|en\|med\|\%(no\|off\)interline\|small\)skip\|\%(center\|left\|right\)\=line\|\%(dot\|\%(left\|right\)arrow\)fill\|[hv]glue\|[lr]lap\|q\=quad\|space\|topglue\)\>'
40 syn match   plaintexInsertsCommand          display contains=@NoSpell
41       \ '\\\%(\%(end\|top\)insert\|v\=footnote\)\>'
42 syn match   plaintexJobCommand              display contains=@NoSpell
43       \ '\\\%(bye\|fmt\%(name\|version\)\)\>'
44 syn match   plaintexInsertsCommand          display contains=@NoSpell
45       \ '\\\%(mid\|page\)insert\>'
46 syn match   plaintexKernCommand             display contains=@NoSpell
47       \ '\\\%(en\|\%(neg\)\=thin\)space\>'
48 syn match   plaintexMacroCommand            display contains=@NoSpell
49       \ '\\\%(active\|[be]group\|empty\)\>'
50 syn match   plaintexPageCommand             display contains=@NoSpell
51       \ '\\\%(\%(super\)\=eject\|nopagenumbers\|\%(normal\|ragged\)bottom\)\>'
52 syn match   plaintexParagraphCommand        display contains=@NoSpell
53       \ '\\\%(endgraf\|\%(non\)\=frenchspacing\|hang\|item\%(item\)\=\|narrower\|normalbaselines\|obey\%(lines\|spaces\)\|openup\|proclaim\|\%(tt\)\=raggedright\|textindent\)\>'
54 syn match   plaintexPenaltiesCommand        display contains=@NoSpell
55       \ '\\\%(allow\|big\|fil\|good\|med\|no\|small\)\=break\>'
56 syn match   plaintexRegistersCommand        display contains=@NoSpell
57       \ '\\\%(advancepageno\|new\%(box\|count\|dimen\|fam\|help\|if\|insert\|language\|muskip\|read\|skip\|toks\|write\)\)\>'
58 syn match   plaintexTablesCommand           display contains=@NoSpell
59       \ '&\|\\+\|\\\%(cleartabs\|endline\|hidewidth\|ialign\|multispan\|settabs\|tabalign\)\>'
61 if !exists("g:plaintex_no_math")
62   syn region  plaintexMath                  matchgroup=plaintexMath
63       \ contains=@plaintexMath,@NoSpell
64       \ start='\$' skip='\\\\\|\\\$' end='\$'
65   syn region  plaintexMath                  matchgroup=plaintexMath
66       \ contains=@plaintexMath,@NoSpell keepend
67       \ start='\$\$' skip='\\\\\|\\\$' end='\$\$'
68 endif
70 " Keep this after plaintexMath, as we don’t want math mode started at a \$.
71 syn match   plaintexCharacterCommand        display contains=@NoSpell
72       \ /\\\%(["#$%&'.=^_`~]\|``\|''\|-\{2,3}\|[?!]`\|^^L\|\~\|\%(a[ae]\|A[AE]\|acute\|[cdHoOPStuvijlL]\|copyright\|d\=dag\|folio\|ldotp\|[lr]q\|oe\|OE\|slash\|ss\|underbar\)\>\)/
74 syn cluster plaintexMath
75       \ contains=plaintexMathCommand,plaintexMathBoxCommand,
76       \ plaintexMathCharacterCommand,plaintexMathDelimiter,
77       \ plaintexMathFontsCommand,plaintexMathLetter,plaintexMathSymbol,
78       \ plaintexMathFunction,plaintexMathOperator,plaintexMathPunctuation,
79       \ plaintexMathRelation
81 syn match   plaintexMathCommand             display contains=@NoSpell contained
82       \ '\\\%([!*,;>{}|_^]\|\%([aA]rrowvert\|[bB]ig\%(g[lmr]\=\|r\)\=\|\%(border\|p\)\=matrix\|displaylines\|\%(down\|up\)bracefill\|eqalign\%(no\)\|leqalignno\|[lr]moustache\|mathpalette\|root\|s[bp]\|skew\|sqrt\)\>\)'
83 syn match   plaintexMathBoxCommand          display contains=@NoSpell contained
84       \ '\\\%([hv]\=phantom\|mathstrut\|smash\)\>'
85 syn match   plaintexMathCharacterCommand    display contains=@NoSpell contained
86       \ '\\\%(b\|bar\|breve\|check\|d\=dots\=\|grave\|hat\|[lv]dots\|tilde\|vec\|wide\%(hat\|tilde\)\)\>'
87 syn match   plaintexMathDelimiter           display contains=@NoSpell contained
88       \ '\\\%(brace\%(vert\)\=\|brack\|cases\|choose\|[lr]\%(angle\|brace\|brack\|ceil\|floor\|group\)\|over\%(brace\|\%(left\|right\)arrow\)\|underbrace\)\>'
89 syn match   plaintexMathFontsCommand        display contains=@NoSpell contained
90       \ '\\\%(\%(bf\|it\|sl\|tt\)fam\|cal\|mit\)\>'
91 syn match   plaintexMathLetter              display contains=@NoSpell contained
92       \ '\\\%(aleph\|alpha\|beta\|chi\|[dD]elta\|ell\|epsilon\|eta\|[gG]amma\|[ij]math\|iota\|kappa\|[lL]ambda\|[mn]u\|[oO]mega\|[pP][hs]\=i\|rho\|[sS]igma\|tau\|[tT]heta\|[uU]psilon\|var\%(epsilon\|ph\=i\|rho\|sigma\|theta\)\|[xX]i\|zeta\)\>'
93 syn match   plaintexMathSymbol              display contains=@NoSpell contained
94       \ '\\\%(angle\|backslash\|bot\|clubsuit\|emptyset\|epsilon\|exists\|flat\|forall\|hbar\|heartsuit\|Im\|infty\|int\|lnot\|nabla\|natural\|neg\|pmod\|prime\|Re\|sharp\|smallint\|spadesuit\|surd\|top\|triangle\%(left\|right\)\=\|vdash\|wp\)\>'
95 syn match   plaintexMathFunction            display contains=@NoSpell contained
96       \ '\\\%(arc\%(cos\|sin\|tan\)\|arg\|\%(cos\|sin\|tan\)h\=\|coth\=\|csc\|de[gt]\|dim\|exp\|gcd\|hom\|inf\|ker\|lo\=g\|lim\%(inf\|sup\)\=\|ln\|max\|min\|Pr\|sec\|sup\)\>'
97 syn match   plaintexMathOperator            display contains=@NoSpell contained
98       \ '\\\%(amalg\|ast\|big\%(c[au]p\|circ\|o\%(dot\|plus\|times\|sqcup\)\|triangle\%(down\|up\)\|uplus\|vee\|wedge\|bmod\|bullet\)\|c[au]p\|cdot[ps]\=\|circ\|coprod\|d\=dagger\|diamond\%(suit\)\=\|div\|land\|lor\|mp\|o\%(dot\|int\|minus\|plus\|slash\|times\)pm\|prod\|setminus\|sqc[au]p\|sqsu[bp]seteq\|star\|su[bp]set\%(eq\)\=\|sum\|times\|uplus\|vee\|wedge\|wr\)\>'
99 syn match   plaintexMathPunctuation         display contains=@NoSpell contained
100       \ '\\\%(colon\)\>'
101 syn match   plaintexMathRelation            display contains=@NoSpell contained
102       \ '\\\%(approx\|asymp\|bowtie\|buildrel\|cong\|dashv\|doteq\|[dD]ownarrow\|equiv\|frown\|geq\=\|gets\|gg\|hook\%(left\|right\)arrow\|iff\|in\|leq\=\|[lL]eftarrow\|\%(left\|right\)harpoon\%(down\|up\)\|[lL]eftrightarrow\|ll\|[lL]ongleftrightarrow\|longmapsto\|[lL]ongrightarrow\|mapsto\|mid\|models\|[ns][ew]arrow\|neq\=\|ni\|not\%(in\)\=\|owns\|parallel\|perp\|prec\%(eq\)\=\|propto\|[rR]ightarrow\|rightleftharpoons\|sim\%(eq\)\=\|smile\|succ\%(eq\)\=\|to\|[uU]parrow\|[uU]pdownarrow\|[vV]ert\)\>'
104 syn match   plaintexParameterDimen          display contains=@NoSpell
105       \ '\\maxdimen\>'
106 syn match   plaintexMathParameterDimen      display contains=@NoSpell
107       \ '\\jot\>'
108 syn match   plaintexParagraphParameterGlue  display contains=@NoSpell
109       \ '\\\%(\%(big\|med\|small\)skipamount\|normalbaselineskip\|normallineskip\%(limit\)\=\)\>'
111 syn match   plaintexFontParameterInteger    display contains=@NoSpell
112       \ '\\magstep\%(half\)\=\>'
113 syn match   plaintexJobParameterInteger     display contains=@NoSpell
114       \ '\\magnification\>'
115 syn match   plaintexPageParameterInteger    display contains=@NoSpell
116       \ '\\pageno\>'
118 syn match   plaintexPageParameterToken      display contains=@NoSpell
119       \ '\\\%(foot\|head\)line\>'
121 hi def link plaintexOperator                Operator
123 hi def link plaintexDelimiter               Delimiter
125 hi def link plaintexControlSequence         Identifier
126 hi def link plaintexComment                 Comment
127 hi def link plaintexInclude                 Include
128 hi def link plaintexRepeat                  Repeat
130 hi def link plaintexCommand                 initexCommand
131 hi def link plaintexBoxCommand              plaintexCommand
132 hi def link plaintexCharacterCommand        initexCharacterCommand
133 hi def link plaintexDebuggingCommand        initexDebuggingCommand
134 hi def link plaintexFontsCommand            initexFontsCommand
135 hi def link plaintexGlueCommand             plaintexCommand
136 hi def link plaintexInsertsCommand          plaintexCommand
137 hi def link plaintexJobCommand              initexJobCommand
138 hi def link plaintexKernCommand             plaintexCommand
139 hi def link plaintexMacroCommand            initexMacroCommand
140 hi def link plaintexPageCommand             plaintexCommand
141 hi def link plaintexParagraphCommand        plaintexCommand
142 hi def link plaintexPenaltiesCommand        plaintexCommand
143 hi def link plaintexRegistersCommand        plaintexCommand
144 hi def link plaintexTablesCommand           plaintexCommand
146 hi def link plaintexMath                    String
147 hi def link plaintexMathCommand             plaintexCommand
148 hi def link plaintexMathBoxCommand          plaintexBoxCommand
149 hi def link plaintexMathCharacterCommand    plaintexCharacterCommand
150 hi def link plaintexMathDelimiter           plaintexDelimiter
151 hi def link plaintexMathFontsCommand        plaintexFontsCommand
152 hi def link plaintexMathLetter              plaintexMathCharacterCommand
153 hi def link plaintexMathSymbol              plaintexMathLetter
154 hi def link plaintexMathFunction            Function
155 hi def link plaintexMathOperator            plaintexOperator
156 hi def link plaintexMathPunctuation         plaintexCharacterCommand
157 hi def link plaintexMathRelation            plaintexOperator
159 hi def link plaintexParameterDimen          initexParameterDimen
160 hi def link plaintexMathParameterDimen      initexMathParameterDimen
161 hi def link plaintexParagraphParameterGlue  initexParagraphParameterGlue
162 hi def link plaintexFontParameterInteger    initexFontParameterInteger
163 hi def link plaintexJobParameterInteger     initexJobParameterInteger
164 hi def link plaintexPageParameterInteger    initexPageParameterInteger
165 hi def link plaintexPageParameterToken      initexParameterToken
167 let b:current_syntax = "plaintex"
169 let &cpo = s:cpo_save
170 unlet s:cpo_save