Mercurial > vim
annotate runtime/syntax/context.vim @ 32156:70242ce3ec3d v9.0.1409
patch 9.0.1409: racket files are recognized as scheme
Commit: https://github.com/vim/vim/commit/d11ac403db07b6eac43882485e98caeb5e83e2e5
Author: Gabriel Kakizaki <gkakizaki@gmail.com>
Date: Thu Mar 16 20:13:29 2023 +0000
patch 9.0.1409: racket files are recognized as scheme
Problem: Racket files are recognized as scheme.
Solution: Recognize rackets files separately. (Gabriel Kakizaki,
closes #12164, closes #12162)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 16 Mar 2023 21:15:03 +0100 |
parents | 2acb87ee55fc |
children | d81556766132 |
rev | line source |
---|---|
29756 | 1 vim9script |
2 | |
3 # Vim syntax file | |
4 # Language: ConTeXt typesetting engine | |
5 # Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> | |
6 # Former Maintainers: Nikolai Weibull <now@bitwi.se> | |
7 # Latest Revision: 2022 Aug 12 | |
375 | 8 |
9 if exists("b:current_syntax") | |
10 finish | |
11 endif | |
12 | |
29756 | 13 # Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP. |
14 var context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'})) | |
375 | 15 |
29756 | 16 # Deprecation warning |
17 if type(context_include) ==# type([]) | |
18 echomsg "[ConTeXt] b:context_include/g:context_include must be Dictionaries." | |
19 context_include = {'xml': 'XML'} | |
839 | 20 endif |
375 | 21 |
29756 | 22 syn iskeyword @,48-57,_,!,?,a-z,A-Z,192-255 |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
23 |
29756 | 24 syn spell toplevel |
1224 | 25 |
29756 | 26 runtime! syntax/shared/context-data-context.vim |
27 runtime! syntax/shared/context-data-interfaces.vim | |
28 runtime! syntax/shared/context-data-tex.vim | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
29 |
29756 | 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 | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
36 syn match contextDelimiter '[{}]' |
375 | 37 |
29756 | 38 # Comments |
39 syn match contextComment '\%(\_^\|[^\\]\)\%(\\\\\)*\zs%.*$' display contains=contextTodo,contextMagicLine | |
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 | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
43 |
29756 | 44 syn match contextBlockDelim '\\\%(start\|stop\)\k\+' contains=@NoSpell |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
45 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
46 syn region contextEscaped matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1' |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
47 syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}' |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
48 syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>' |
375 | 49 syn region contextEscaped matchgroup=contextPreProc |
50 \ start='\\start\z(\a*\%(typing\|typen\)\)' | |
29756 | 51 \ end='\\stop\z1' contains=contextComment keepend |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
52 syn region contextEscaped matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}' |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
53 syn region contextEscaped matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}' |
375 | 54 |
29756 | 55 syn match contextBuiltin '\\unexpanded\>' display contains=@NoSpell |
375 | 56 |
29756 | 57 # \unprotect... \protect regions |
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 | |
839 | 60 |
29756 | 61 # Math |
62 syn match contextMathCmd '\\m\%(ath\%(ematics\)\=\)\=\>' | |
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 | |
839 | 66 |
29756 | 67 # MetaFun |
68 b:mp_metafun = 1 | |
69 syn include @mpTop syntax/mp.vim | |
70 unlet b:current_syntax | |
839 | 71 |
29756 | 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 | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
80 |
29756 | 81 # Lua |
82 syn include @luaTop syntax/lua.vim | |
83 unlet b:current_syntax | |
839 | 84 |
29756 | 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 | |
375 | 95 |
29756 | 96 for synname in keys(context_include) |
97 execute 'syn include @' .. synname .. 'Top' 'syntax/' .. synname .. '.vim' | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
98 unlet b:current_syntax |
29756 | 99 execute 'syn region context' .. context_include[synname] .. 'Code' |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
100 \ 'matchgroup=contextBlockDelim' |
29756 | 101 \ 'start=+\\start' .. context_include[synname] .. '\w*+' |
102 \ 'end=+\\stop' .. context_include[synname] .. '\w*+' | |
103 \ 'contains=@' .. synname .. 'Top,@NoSpell' | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
104 endfor |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
105 |
29756 | 106 syn match contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>' contains=@NoSpell |
375 | 107 |
29756 | 108 syn match contextSpecial '\\par\>\|-\{2,3}\||[<>/]\=|' contains=@NoSpell |
839 | 109 syn match contextSpecial /\\[`'"]/ |
29756 | 110 syn match contextSpecial +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+ contains=@NoSpell |
375 | 111 syn match contextSpecial '\^\^.' |
112 syn match contextSpecial '`\%(\\.\|\^\^.\|.\)' | |
113 | |
29756 | 114 syn match contextStyle '\\\%(em\|ss\|hw\|cg\|mf\)\>' contains=@NoSpell |
115 syn match contextFont '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>' contains=@NoSpell | |
116 syn match contextFont '\\\%(Word\|WORD\|Words\|WORDS\)\>' contains=@NoSpell | |
117 syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>' contains=@NoSpell | |
118 syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>' contains=@NoSpell | |
375 | 119 |
120 hi def link contextBlockDelim Keyword | |
121 hi def link contextBuiltin Keyword | |
29756 | 122 hi def link contextCommand Keyword |
123 hi def link contextComment Comment | |
375 | 124 hi def link contextDelimiter Delimiter |
29756 | 125 hi def link contextDirectLua Keyword |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1224
diff
changeset
|
126 hi def link contextEscaped String |
29756 | 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 | |
375 | 134 hi def link contextPreProc PreProc |
135 hi def link contextSectioning PreProc | |
29756 | 136 hi def link contextSequence Identifier |
375 | 137 hi def link contextSpecial Special |
138 hi def link contextStyle contextType | |
29756 | 139 hi def link contextTodo Todo |
140 hi def link contextType Type | |
375 | 141 |
29756 | 142 b:current_syntax = 'context' |
375 | 143 |
29756 | 144 # vim: sw=2 fdm=marker |