Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: ConTeXt typesetting engine |
| 3 | " Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se> |
| 4 | " Latest Revision: 2005-06-29 |
| 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 keyword contextTodo TODO FIXME XXX NOTE |
| 14 | |
| 15 | syn region contextComment display oneline matchgroup=contextComment |
| 16 | \ start='%' end='$' contains=contextTodo |
| 17 | syn region contextComment display oneline matchgroup=contextComment |
| 18 | \ start='^\s*%[CDM]' end='$' contains=ALL |
| 19 | |
| 20 | syn match contextStatement display '\\[a-zA-Z@]\+' contains=@NoSpell |
| 21 | |
| 22 | syn match contextBlockDelim display '\\\%(start\|stop\)\a\+' |
| 23 | \ contains=@NoSpell |
| 24 | |
| 25 | syn match contextDelimiter '[][{}]' |
| 26 | |
| 27 | syn match contextEscaped display '\\\_[\{}|&%$ ]' |
| 28 | syn region contextEscaped display matchgroup=contextPreProc |
| 29 | \ start='\\type\z(\A\)' end='\z1' |
| 30 | syn region contextEscaped display matchgroup=contextPreProc |
| 31 | \ start='\\type\={' end='}' |
| 32 | syn region contextEscaped display matchgroup=contextPreProc |
| 33 | \ start='\\type\=<<' end='>>' |
| 34 | syn region contextEscaped matchgroup=contextPreProc |
| 35 | \ start='\\start\z(\a*\%(typing\|typen\)\)' |
| 36 | \ end='\\stop\z1' |
| 37 | syn region contextEscaped display matchgroup=contextPreProc |
| 38 | \ start='\\\h\+Type{' end='}' |
| 39 | syn region contextEscaped display matchgroup=contextPreProc |
| 40 | \ start='\\Typed\h\+{' end='}' |
| 41 | |
| 42 | "syn region contextMath matchgroup=contextMath start='\$' end='\$' |
| 43 | " \ contains=contextStatement |
| 44 | |
| 45 | syn match contextBuiltin '\\\%(newif\|def\|gdef\|global\|let\|glet\|bgroup\)\>' |
| 46 | \ contains=@NoSpell |
| 47 | syn match contextBuiltin '\\\%(begingroup\|egroup\|endgroup\|long\|catcode\)\>' |
| 48 | \ contains=@NoSpell |
| 49 | syn match contextBuiltin '\\\%(unprotect\|unexpanded\|if\|else\|fi\|ifx\)\>' |
| 50 | \ contains=@NoSpell |
| 51 | syn match contextBuiltin '\\\%(futurelet\|protect\)\>' contains=@NoSpell |
| 52 | syn match contextBuiltin '\\\%([lr]q\)\>' contains=@NoSpell |
| 53 | |
| 54 | syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\).*$' |
| 55 | \ contains=@NoSpell |
| 56 | syn match contextPreProc '^\s*\\input\s\+.*$' contains=@NoSpell |
| 57 | |
| 58 | syn match contextSectioning '\\chapter\>' contains=@NoSpell |
| 59 | syn match contextSectioning '\\\%(sub\)*section\>' contains=@NoSpell |
| 60 | |
| 61 | syn match contextSpecial '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|' |
| 62 | \ contains=@NoSpell |
| 63 | syn match contextSpecial '\\[`'"]' |
| 64 | syn match contextSpecial +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+ |
| 65 | \ contains=@NoSpell |
| 66 | syn match contextSpecial '\^\^.' |
| 67 | syn match contextSpecial '`\%(\\.\|\^\^.\|.\)' |
| 68 | |
| 69 | syn match contextStyle '\\\%(em\|tt\|rm\|ss\|hw\|cg\)\>' |
| 70 | \ contains=@NoSpell |
| 71 | syn match contextFont '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>' |
| 72 | \ contains=@NoSpell |
| 73 | syn match contextFont '\\\%(Word\|WORD\|Words\|WORDS\)\>' |
| 74 | \ contains=@NoSpell |
| 75 | syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>' |
| 76 | \ contains=@NoSpell |
| 77 | syn match contextFont '\\\%(tf[abcdx]\|bfx\|[is]lx\)\>' |
| 78 | \ contains=@NoSpell |
| 79 | syn match contextFont '\\\%(b[fsi]\|s[cl]\|it\|os\|mf\)\>' |
| 80 | \ contains=@NoSpell |
| 81 | |
| 82 | syn match contextDimension '[+-]\=\s*\%(\d\+\%([.,]\d*\)\=\|[.,]\d\+\)\s*\%(true\)\=\s*\%(p[tc]\|in\|bp\|c[mc]\|mm\|dd\|sp\|e[mx]\)\>' |
| 83 | \ contains=@NoSpell |
| 84 | |
| 85 | hi def link contextTodo Todo |
| 86 | hi def link contextComment Comment |
| 87 | hi def link contextEscaped Special |
| 88 | hi def link contextStatement Identifier |
| 89 | hi def link contextMath String |
| 90 | hi def link contextBlockDelim Keyword |
| 91 | hi def link contextBuiltin Keyword |
| 92 | hi def link contextDelimiter Delimiter |
| 93 | hi def link contextPreProc PreProc |
| 94 | hi def link contextSectioning PreProc |
| 95 | hi def link contextSpecial Special |
| 96 | hi def link contextStyle contextType |
| 97 | hi def link contextFont contextType |
| 98 | hi def link contextType Type |
| 99 | hi def link contextDimension Number |
| 100 | |
| 101 | let b:current_syntax = "context" |
| 102 | |
| 103 | let &cpo = s:cpo_save |
| 104 | unlet s:cpo_save |