375
|
1 " Vim syntax file
|
|
2 " Language: ConTeXt typesetting engine
|
839
|
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
|
1224
|
4 " Latest Revision: 2006-08-10
|
375
|
5
|
|
6 if exists("b:current_syntax")
|
|
7 finish
|
|
8 endif
|
|
9
|
839
|
10 runtime! syntax/plaintex.vim
|
1224
|
11 unlet b:current_syntax
|
839
|
12
|
375
|
13 let s:cpo_save = &cpo
|
|
14 set cpo&vim
|
|
15
|
839
|
16 if !exists('g:context_include')
|
|
17 let g:context_include = ['mp', 'javascript', 'xml']
|
|
18 endif
|
375
|
19
|
1224
|
20 syn spell toplevel
|
|
21
|
375
|
22 syn match contextBlockDelim display '\\\%(start\|stop\)\a\+'
|
|
23 \ contains=@NoSpell
|
|
24
|
|
25 syn region contextEscaped display matchgroup=contextPreProc
|
|
26 \ start='\\type\z(\A\)' end='\z1'
|
|
27 syn region contextEscaped display matchgroup=contextPreProc
|
|
28 \ start='\\type\={' end='}'
|
|
29 syn region contextEscaped display matchgroup=contextPreProc
|
|
30 \ start='\\type\=<<' end='>>'
|
|
31 syn region contextEscaped matchgroup=contextPreProc
|
|
32 \ start='\\start\z(\a*\%(typing\|typen\)\)'
|
1224
|
33 \ end='\\stop\z1' contains=plaintexComment keepend
|
375
|
34 syn region contextEscaped display matchgroup=contextPreProc
|
|
35 \ start='\\\h\+Type{' end='}'
|
|
36 syn region contextEscaped display matchgroup=contextPreProc
|
|
37 \ start='\\Typed\h\+{' end='}'
|
|
38
|
839
|
39 syn match contextBuiltin display contains=@NoSpell
|
|
40 \ '\\\%(unprotect\|protect\|unexpanded\)'
|
375
|
41
|
|
42 syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\).*$'
|
|
43 \ contains=@NoSpell
|
839
|
44
|
|
45 if index(g:context_include, 'mp') != -1
|
|
46 syn include @mpTop syntax/mp.vim
|
|
47 unlet b:current_syntax
|
|
48
|
|
49 syn region contextMPGraphic transparent matchgroup=contextBlockDelim
|
|
50 \ start='\\start\z(\a*MPgraphic\|MP\%(page\|inclusions\|run\)\).*'
|
|
51 \ end='\\stop\z1'
|
|
52 \ contains=@mpTop
|
|
53 endif
|
|
54
|
|
55 " TODO: also need to implement this for \\typeC or something along those
|
|
56 " lines.
|
|
57 function! s:include_syntax(name, group)
|
|
58 if index(g:context_include, a:name) != -1
|
|
59 execute 'syn include @' . a:name . 'Top' 'syntax/' . a:name . '.vim'
|
|
60 unlet b:current_syntax
|
|
61 execute 'syn region context' . a:group . 'Code'
|
|
62 \ 'transparent matchgroup=contextBlockDelim'
|
|
63 \ 'start=+\\start' . a:group . '+ end=+\\stop' . a:group . '+'
|
|
64 \ 'contains=@' . a:name . 'Top'
|
|
65 endif
|
|
66 endfunction
|
|
67
|
|
68 call s:include_syntax('c', 'C')
|
|
69 call s:include_syntax('ruby', 'Ruby')
|
|
70 call s:include_syntax('javascript', 'JS')
|
|
71 call s:include_syntax('xml', 'XML')
|
375
|
72
|
|
73 syn match contextSectioning '\\chapter\>' contains=@NoSpell
|
|
74 syn match contextSectioning '\\\%(sub\)*section\>' contains=@NoSpell
|
|
75
|
|
76 syn match contextSpecial '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|'
|
|
77 \ contains=@NoSpell
|
839
|
78 syn match contextSpecial /\\[`'"]/
|
375
|
79 syn match contextSpecial +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+
|
|
80 \ contains=@NoSpell
|
|
81 syn match contextSpecial '\^\^.'
|
|
82 syn match contextSpecial '`\%(\\.\|\^\^.\|.\)'
|
|
83
|
839
|
84 syn match contextStyle '\\\%(em\|ss\|hw\|cg\|mf\)\>'
|
375
|
85 \ contains=@NoSpell
|
|
86 syn match contextFont '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>'
|
|
87 \ contains=@NoSpell
|
|
88 syn match contextFont '\\\%(Word\|WORD\|Words\|WORDS\)\>'
|
|
89 \ contains=@NoSpell
|
|
90 syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>'
|
|
91 \ contains=@NoSpell
|
839
|
92 syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>'
|
375
|
93 \ contains=@NoSpell
|
|
94
|
|
95 hi def link contextBlockDelim Keyword
|
|
96 hi def link contextBuiltin Keyword
|
|
97 hi def link contextDelimiter Delimiter
|
|
98 hi def link contextPreProc PreProc
|
|
99 hi def link contextSectioning PreProc
|
|
100 hi def link contextSpecial Special
|
839
|
101 hi def link contextType Type
|
375
|
102 hi def link contextStyle contextType
|
|
103 hi def link contextFont contextType
|
|
104
|
|
105 let b:current_syntax = "context"
|
|
106
|
|
107 let &cpo = s:cpo_save
|
|
108 unlet s:cpo_save
|