Mercurial > vim
comparison runtime/syntax/context.vim @ 29756:2acb87ee55fc
Update runtime files
Commit: https://github.com/vim/vim/commit/e1f3fd1d02e3f5fe6d2b6d82687c6846b8e500f8
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Aug 15 18:51:32 2022 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 15 Aug 2022 20:00:05 +0200 |
parents | 07d2b5a3b7cc |
children | d81556766132 |
comparison
equal
deleted
inserted
replaced
29755:e726ee71b93b | 29756:2acb87ee55fc |
---|---|
1 " Vim syntax file | 1 vim9script |
2 " Language: ConTeXt typesetting engine | 2 |
3 " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> | 3 # Vim syntax file |
4 " Former Maintainers: Nikolai Weibull <now@bitwi.se> | 4 # Language: ConTeXt typesetting engine |
5 " Latest Revision: 2016 Oct 16 | 5 # Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> |
6 # Former Maintainers: Nikolai Weibull <now@bitwi.se> | |
7 # Latest Revision: 2022 Aug 12 | |
6 | 8 |
7 if exists("b:current_syntax") | 9 if exists("b:current_syntax") |
8 finish | 10 finish |
9 endif | 11 endif |
10 | 12 |
11 runtime! syntax/plaintex.vim | 13 # Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP. |
12 unlet b:current_syntax | 14 var context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'})) |
13 | 15 |
14 let s:cpo_save = &cpo | 16 # Deprecation warning |
15 set cpo&vim | 17 if type(context_include) ==# type([]) |
16 | 18 echomsg "[ConTeXt] b:context_include/g:context_include must be Dictionaries." |
17 " Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP. | 19 context_include = {'xml': 'XML'} |
18 let s:context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'})) | |
19 | |
20 " For backward compatibility (g:context_include used to be a List) | |
21 if type(s:context_include) ==# type([]) | |
22 let g:context_metapost = (index(s:context_include, 'mp') != -1) | |
23 let s:context_include = filter( | |
24 \ {'c': 'C', 'javascript': 'JS', 'ruby': 'Ruby', 'xml': 'XML'}, | |
25 \ { k,_ -> index(s:context_include, k) != -1 } | |
26 \ ) | |
27 endif | 20 endif |
28 | 21 |
29 syn iskeyword @,48-57,a-z,A-Z,192-255 | 22 syn iskeyword @,48-57,_,!,?,a-z,A-Z,192-255 |
30 | 23 |
31 syn spell toplevel | 24 syn spell toplevel |
32 | 25 |
33 " ConTeXt options, i.e., [...] blocks | 26 runtime! syntax/shared/context-data-context.vim |
34 syn region contextOptions matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=ALLBUT,contextBeginEndLua,@Spell | 27 runtime! syntax/shared/context-data-interfaces.vim |
28 runtime! syntax/shared/context-data-tex.vim | |
35 | 29 |
36 " Highlight braces | 30 syn match contextCommand '\\\k\+\>' display contains=@NoSpell |
31 | |
32 # ConTeXt options, i.e., [...] blocks | |
33 syn region contextOptions matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=TOP,@Spell | |
34 | |
35 # Highlight braces | |
37 syn match contextDelimiter '[{}]' | 36 syn match contextDelimiter '[{}]' |
38 | 37 |
39 " Comments | 38 # Comments |
40 syn match contextComment '\\\@<!\%(\\\\\)*\zs%.*$' display contains=initexTodo | 39 syn match contextComment '\%(\_^\|[^\\]\)\%(\\\\\)*\zs%.*$' display contains=contextTodo,contextMagicLine |
41 syn match contextComment '^\s*%[CDM].*$' display contains=initexTodo | 40 syn match contextComment '^\s*%[CDM].*$' display contains=contextTodo,contextMagicLine |
41 syn keyword contextTodo TODO FIXME XXX NOTE contained | |
42 syn match contextMagicLine '^\s*%\s*!TEX.*$' contained | |
42 | 43 |
43 syn match contextBlockDelim '\\\%(start\|stop\)\a\+' contains=@NoSpell | 44 syn match contextBlockDelim '\\\%(start\|stop\)\k\+' contains=@NoSpell |
44 | 45 |
45 syn region contextEscaped matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1' | 46 syn region contextEscaped matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1' |
46 syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}' | 47 syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}' |
47 syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>' | 48 syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>' |
48 syn region contextEscaped matchgroup=contextPreProc | 49 syn region contextEscaped matchgroup=contextPreProc |
49 \ start='\\start\z(\a*\%(typing\|typen\)\)' | 50 \ start='\\start\z(\a*\%(typing\|typen\)\)' |
50 \ end='\\stop\z1' contains=plaintexComment keepend | 51 \ end='\\stop\z1' contains=contextComment keepend |
51 syn region contextEscaped matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}' | 52 syn region contextEscaped matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}' |
52 syn region contextEscaped matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}' | 53 syn region contextEscaped matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}' |
53 | 54 |
54 syn match contextBuiltin display contains=@NoSpell | 55 syn match contextBuiltin '\\unexpanded\>' display contains=@NoSpell |
55 \ '\\\%(unprotect\|protect\|unexpanded\)\>' | |
56 | 56 |
57 syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\)\>' | 57 # \unprotect... \protect regions |
58 \ contains=@NoSpell | 58 syn region contextUnprotect matchgroup=contextBuiltin start='\\unprotect' end='\\protect' contains=TOP |
59 syn match contextSequence '\\[a-zA-Z]*[@_!?]\+[a-zA-Z@_!?]*' contains=@NoSpell contained containedin=contextUnprotect | |
59 | 60 |
60 if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) | 61 # Math |
61 let b:mp_metafun_macros = 1 " Highlight MetaFun keywords | 62 syn match contextMathCmd '\\m\%(ath\%(ematics\)\=\)\=\>' |
62 syn include @mpTop syntax/mp.vim | 63 syn region contextInlineMath matchgroup=contextMathDelim start='\$' skip='\\\\\|\\\$' end='\$' |
64 syn region contextDisplayMath matchgroup=contextMathDelim start='\$\$' skip='\\\\\|\\\$' end='\$\$' keepend | |
65 syn region contextDisplayMath matchgroup=contextBlockDelim start='\\startformula' end='\\stopformula' contains=TOP | |
66 | |
67 # MetaFun | |
68 b:mp_metafun = 1 | |
69 syn include @mpTop syntax/mp.vim | |
70 unlet b:current_syntax | |
71 | |
72 syn region contextMPGraphic matchgroup=contextBlockDelim | |
73 \ start='\\start\z(MP\%(clip\|code\|definitions\|drawing\|environment\|extensions\|inclusions\|initializations\|page\|\)\)\>.*$' | |
74 \ end='\\stop\z1' | |
75 \ contains=@mpTop,@NoSpell | |
76 syn region contextMPGraphic matchgroup=contextBlockDelim | |
77 \ start='\\start\z(\%(\%[re]usable\|use\|unique\|static\)MPgraphic\|staticMPfigure\|uniqueMPpagegraphic\)\>.*$' | |
78 \ end='\\stop\z1' | |
79 \ contains=@mpTop,@NoSpell | |
80 | |
81 # Lua | |
82 syn include @luaTop syntax/lua.vim | |
83 unlet b:current_syntax | |
84 | |
85 syn region contextLuaCode matchgroup=contextBlockDelim | |
86 \ start='\\startluacode\>' | |
87 \ end='\\stopluacode\>' keepend | |
88 \ contains=@luaTop,@NoSpell | |
89 syn match contextDirectLua "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\=" | |
90 \ nextgroup=contextBeginEndLua skipwhite skipempty | |
91 \ contains=contextComment | |
92 syn region contextBeginEndLua matchgroup=contextSpecial | |
93 \ start="{" end="}" skip="\\[{}]" | |
94 \ contained contains=@luaTop,@NoSpell | |
95 | |
96 for synname in keys(context_include) | |
97 execute 'syn include @' .. synname .. 'Top' 'syntax/' .. synname .. '.vim' | |
63 unlet b:current_syntax | 98 unlet b:current_syntax |
64 | 99 execute 'syn region context' .. context_include[synname] .. 'Code' |
65 syn region contextMPGraphic matchgroup=contextBlockDelim | |
66 \ start='\\start\z(MP\%(clip\|code\|definitions\|drawing\|environment\|extensions\|inclusions\|initializations\|page\|\)\)\>.*$' | |
67 \ end='\\stop\z1' | |
68 \ contains=@mpTop,@NoSpell | |
69 syn region contextMPGraphic matchgroup=contextBlockDelim | |
70 \ start='\\start\z(\%(\%[re]usable\|use\|unique\|static\)MPgraphic\|staticMPfigure\|uniqueMPpagegraphic\)\>.*$' | |
71 \ end='\\stop\z1' | |
72 \ contains=@mpTop,@NoSpell | |
73 endif | |
74 | |
75 if get(b:, 'context_lua', get(g:, 'context_lua', 1)) | |
76 syn include @luaTop syntax/lua.vim | |
77 unlet b:current_syntax | |
78 | |
79 syn region contextLuaCode matchgroup=contextBlockDelim | |
80 \ start='\\startluacode\>' | |
81 \ end='\\stopluacode\>' keepend | |
82 \ contains=@luaTop,@NoSpell | |
83 | |
84 syn match contextDirectLua "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\=" | |
85 \ nextgroup=contextBeginEndLua skipwhite skipempty | |
86 \ contains=initexComment | |
87 syn region contextBeginEndLua matchgroup=contextSpecial | |
88 \ start="{" end="}" skip="\\[{}]" | |
89 \ contained contains=@luaTop,@NoSpell | |
90 endif | |
91 | |
92 for synname in keys(s:context_include) | |
93 execute 'syn include @' . synname . 'Top' 'syntax/' . synname . '.vim' | |
94 unlet b:current_syntax | |
95 execute 'syn region context' . s:context_include[synname] . 'Code' | |
96 \ 'matchgroup=contextBlockDelim' | 100 \ 'matchgroup=contextBlockDelim' |
97 \ 'start=+\\start' . s:context_include[synname] . '+' | 101 \ 'start=+\\start' .. context_include[synname] .. '\w*+' |
98 \ 'end=+\\stop' . s:context_include[synname] . '+' | 102 \ 'end=+\\stop' .. context_include[synname] .. '\w*+' |
99 \ 'contains=@' . synname . 'Top,@NoSpell' | 103 \ 'contains=@' .. synname .. 'Top,@NoSpell' |
100 endfor | 104 endfor |
101 | 105 |
102 syn match contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>' | 106 syn match contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>' contains=@NoSpell |
103 \ contains=@NoSpell | |
104 | 107 |
105 syn match contextSpecial '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|' | 108 syn match contextSpecial '\\par\>\|-\{2,3}\||[<>/]\=|' contains=@NoSpell |
106 \ contains=@NoSpell | |
107 syn match contextSpecial /\\[`'"]/ | 109 syn match contextSpecial /\\[`'"]/ |
108 syn match contextSpecial +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+ | 110 syn match contextSpecial +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+ contains=@NoSpell |
109 \ contains=@NoSpell | |
110 syn match contextSpecial '\^\^.' | 111 syn match contextSpecial '\^\^.' |
111 syn match contextSpecial '`\%(\\.\|\^\^.\|.\)' | 112 syn match contextSpecial '`\%(\\.\|\^\^.\|.\)' |
112 | 113 |
113 syn match contextStyle '\\\%(em\|ss\|hw\|cg\|mf\)\>' | 114 syn match contextStyle '\\\%(em\|ss\|hw\|cg\|mf\)\>' contains=@NoSpell |
114 \ contains=@NoSpell | 115 syn match contextFont '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>' contains=@NoSpell |
115 syn match contextFont '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>' | 116 syn match contextFont '\\\%(Word\|WORD\|Words\|WORDS\)\>' contains=@NoSpell |
116 \ contains=@NoSpell | 117 syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>' contains=@NoSpell |
117 syn match contextFont '\\\%(Word\|WORD\|Words\|WORDS\)\>' | 118 syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>' contains=@NoSpell |
118 \ contains=@NoSpell | |
119 syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>' | |
120 \ contains=@NoSpell | |
121 syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>' | |
122 \ contains=@NoSpell | |
123 | 119 |
124 hi def link contextOptions Typedef | |
125 hi def link contextComment Comment | |
126 hi def link contextBlockDelim Keyword | 120 hi def link contextBlockDelim Keyword |
127 hi def link contextBuiltin Keyword | 121 hi def link contextBuiltin Keyword |
122 hi def link contextCommand Keyword | |
123 hi def link contextComment Comment | |
128 hi def link contextDelimiter Delimiter | 124 hi def link contextDelimiter Delimiter |
125 hi def link contextDirectLua Keyword | |
129 hi def link contextEscaped String | 126 hi def link contextEscaped String |
127 hi def link contextFont contextType | |
128 hi def link contextKeyword Keyword | |
129 hi def link contextInlineMath String | |
130 hi def link contextMagicLine PreProc | |
131 hi def link contextMathCmd Identifier | |
132 hi def link contextMathDelim Delimiter | |
133 hi def link contextOptions Typedef | |
130 hi def link contextPreProc PreProc | 134 hi def link contextPreProc PreProc |
131 hi def link contextSectioning PreProc | 135 hi def link contextSectioning PreProc |
136 hi def link contextSequence Identifier | |
132 hi def link contextSpecial Special | 137 hi def link contextSpecial Special |
138 hi def link contextStyle contextType | |
139 hi def link contextTodo Todo | |
133 hi def link contextType Type | 140 hi def link contextType Type |
134 hi def link contextStyle contextType | |
135 hi def link contextFont contextType | |
136 hi def link contextDirectLua Keyword | |
137 | 141 |
138 let b:current_syntax = "context" | 142 b:current_syntax = 'context' |
139 | 143 |
140 let &cpo = s:cpo_save | 144 # vim: sw=2 fdm=marker |
141 unlet s:cpo_save |