Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | 214641f | 2017-03-05 17:04:09 +0100 | [diff] [blame] | 2 | " Language: TeX (plain.tex format) |
| 3 | " Previous Maintainer: Nikolai Weibull <now@bitwi.se> |
| 4 | " Latest Revision: 2006-10-26 |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 5 | |
| 6 | if exists("b:current_syntax") |
| 7 | finish |
| 8 | endif |
| 9 | |
| 10 | let s:cpo_save = &cpo |
| 11 | set cpo&vim |
| 12 | |
| 13 | syn match plaintexControlSequence display contains=@NoSpell |
| 14 | \ '\\[a-zA-Z@]\+' |
| 15 | |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 16 | runtime! syntax/initex.vim |
Bram Moolenaar | 10c5695 | 2007-05-10 18:38:52 +0000 | [diff] [blame] | 17 | unlet b:current_syntax |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 18 | |
| 19 | syn match plaintexComment display |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 20 | \ contains=ALLBUT,initexComment,plaintexComment |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 21 | \ '^\s*%[CDM].*$' |
| 22 | |
| 23 | if exists("g:plaintex_delimiters") |
| 24 | syn match plaintexDelimiter display '[][{}]' |
| 25 | endif |
| 26 | |
| 27 | syn match plaintexRepeat display contains=@NoSpell |
| 28 | \ '\\\%(loop\|repeat\)\>' |
| 29 | |
| 30 | syn match plaintexCommand display contains=@NoSpell |
| 31 | \ '\\\%(plainoutput\|TeX\)\>' |
| 32 | syn match plaintexBoxCommand display contains=@NoSpell |
| 33 | \ '\\\%(null\|strut\)\>' |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 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\)\>' |
| 60 | |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 61 | if !exists("g:plaintex_no_math") |
| 62 | syn region plaintexMath matchgroup=plaintexMath |
Bram Moolenaar | 10c5695 | 2007-05-10 18:38:52 +0000 | [diff] [blame] | 63 | \ contains=@plaintexMath,@NoSpell |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 64 | \ start='\$' skip='\\\\\|\\\$' end='\$' |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 65 | syn region plaintexMath matchgroup=plaintexMath |
Bram Moolenaar | 10c5695 | 2007-05-10 18:38:52 +0000 | [diff] [blame] | 66 | \ contains=@plaintexMath,@NoSpell keepend |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 67 | \ start='\$\$' skip='\\\\\|\\\$' end='\$\$' |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 68 | endif |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 69 | |
Bram Moolenaar | 10c5695 | 2007-05-10 18:38:52 +0000 | [diff] [blame] | 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\)\>\)/ |
| 73 | |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 74 | syn cluster plaintexMath |
| 75 | \ contains=plaintexMathCommand,plaintexMathBoxCommand, |
| 76 | \ plaintexMathCharacterCommand,plaintexMathDelimiter, |
| 77 | \ plaintexMathFontsCommand,plaintexMathLetter,plaintexMathSymbol, |
| 78 | \ plaintexMathFunction,plaintexMathOperator,plaintexMathPunctuation, |
| 79 | \ plaintexMathRelation |
| 80 | |
| 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\)\>' |
| 103 | |
| 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\)\=\)\>' |
| 110 | |
| 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\>' |
| 117 | |
| 118 | syn match plaintexPageParameterToken display contains=@NoSpell |
| 119 | \ '\\\%(foot\|head\)line\>' |
| 120 | |
| 121 | hi def link plaintexOperator Operator |
| 122 | |
| 123 | hi def link plaintexDelimiter Delimiter |
| 124 | |
| 125 | hi def link plaintexControlSequence Identifier |
| 126 | hi def link plaintexComment Comment |
| 127 | hi def link plaintexInclude Include |
| 128 | hi def link plaintexRepeat Repeat |
| 129 | |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 130 | hi def link plaintexCommand initexCommand |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 131 | hi def link plaintexBoxCommand plaintexCommand |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 132 | hi def link plaintexCharacterCommand initexCharacterCommand |
| 133 | hi def link plaintexDebuggingCommand initexDebuggingCommand |
| 134 | hi def link plaintexFontsCommand initexFontsCommand |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 135 | hi def link plaintexGlueCommand plaintexCommand |
| 136 | hi def link plaintexInsertsCommand plaintexCommand |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 137 | hi def link plaintexJobCommand initexJobCommand |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 138 | hi def link plaintexKernCommand plaintexCommand |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 139 | hi def link plaintexMacroCommand initexMacroCommand |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 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 |
| 145 | |
| 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 |
| 158 | |
Bram Moolenaar | 8424a62 | 2006-04-19 21:23:36 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | d2cec5b | 2006-03-28 21:08:56 +0000 | [diff] [blame] | 166 | |
| 167 | let b:current_syntax = "plaintex" |
| 168 | |
| 169 | let &cpo = s:cpo_save |
| 170 | unlet s:cpo_save |