Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
context.vim145 linesDownload Raw Back to syntax
1vim9script2 3# Vim syntax file4# Language:           ConTeXt typesetting engine5# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>6# Former Maintainers: Nikolai Weibull <now@bitwi.se>7# Latest Revision:    2026 Jan 108 9if exists("b:current_syntax")10  finish11endif12 13# Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP.14var context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'}))15 16# Deprecation warning17if type(context_include) ==# type([])18  echomsg "[ConTeXt] b:context_include/g:context_include must be Dictionaries."19  context_include = {'xml': 'XML'}20endif21 22syn iskeyword @,48-57,_,!,?,a-z,A-Z,192-25523 24syn spell toplevel25 26runtime! syntax/shared/context-data-context.vim27runtime! syntax/shared/context-data-interfaces.vim28runtime! syntax/shared/context-data-tex.vim29 30syn match contextCommand '\\\k\+\>' display contains=@NoSpell31 32# ConTeXt options, i.e., [...] blocks33syn region  contextOptions    matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=TOP,@Spell34 35# Highlight braces36syn match   contextDelimiter  '[{}]'37 38# Comments39syn match   contextComment    '\%(\_^\|[^\\]\)\%(\\\\\)*\zs%.*$' display contains=contextTodo,contextMagicLine40syn match   contextComment    '^\s*%[CDM].*$'                    display contains=contextTodo,contextMagicLine41syn keyword contextTodo       TODO FIXME XXX NOTE                contained42syn match   contextMagicLine  '^\s*%\s*!TEX.*$'                  contained43 44syn match   contextBlockDelim '\\\%(start\|stop\)\k\+' contains=@NoSpell45 46syn region  contextEscaped    matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1'47syn region  contextEscaped    matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}'48syn region  contextEscaped    matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>'49syn region  contextEscaped    matchgroup=contextPreProc50                              \ start='\\start\z(\a*\%(typing\|typen\)\)'51                              \ end='\\stop\z1' contains=contextComment keepend52syn region  contextEscaped    matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}'53syn region  contextEscaped    matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}'54 55syn match   contextBuiltin    '\\unexpanded\>' display contains=@NoSpell56 57# \unprotect... \protect regions58syn region  contextUnprotect  matchgroup=contextBuiltin start='\\unprotect' end='\\protect' contains=TOP59syn match   contextSequence   '\\[a-zA-Z]*[@_!?]\+[a-zA-Z@_!?]*' contains=@NoSpell contained containedin=contextUnprotect60 61# Math62syn match  contextMathCmd '\\m\%(ath\%(ematics\)\=\)\=\>'63syn region contextInlineMath matchgroup=contextMathDelim start='\$' skip='\\\\\|\\\$' end='\$'64syn region contextDisplayMath matchgroup=contextMathDelim start='\$\$' skip='\\\\\|\\\$' end='\$\$' keepend65syn region contextDisplayMath matchgroup=contextBlockDelim start='\\startformula' end='\\stopformula' contains=TOP66 67# MetaFun68b:mp_metafun = 169syn include @mpTop syntax/mp.vim70unlet b:current_syntax71 72syn region  contextMPGraphic  matchgroup=contextBlockDelim73      \ start='\\start\z(MP\%(clip\|code\|definitions\|drawing\|environment\|extensions\|inclusions\|initializations\|page\|\)\)\>.*$'74      \ end='\\stop\z1'75      \ contains=@mpTop,@NoSpell76syn region  contextMPGraphic  matchgroup=contextBlockDelim77      \ start='\\start\z(\%(\%[re]usable\|use\|unique\|static\)MPgraphic\|staticMPfigure\|uniqueMPpagegraphic\)\>.*$'78      \ end='\\stop\z1'79      \ contains=@mpTop,@NoSpell80 81# Lua82syn include @luaTop syntax/lua.vim83unlet b:current_syntax84 85syn region  contextLuaCode    matchgroup=contextBlockDelim86      \ start='\\startluacode\>'87      \ end='\\stopluacode\>' keepend88      \ contains=@luaTop,@NoSpell89syn match   contextDirectLua  "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\="90      \ nextgroup=contextBeginEndLua skipwhite skipempty91      \ contains=contextComment92syn region  contextBeginEndLua matchgroup=contextSpecial93      \ start="{" end="}" skip="\\[{}]" keepend94      \ contained contains=@luaTop,@NoSpell95 96for synname in keys(context_include)97  execute 'syn include @' .. synname .. 'Top' 'syntax/' .. synname .. '.vim'98  unlet b:current_syntax99  execute 'syn region context' .. context_include[synname] .. 'Code'100        \ 'matchgroup=contextBlockDelim'101        \ 'start=+\\start' .. context_include[synname] .. '\w*+'102        \ 'end=+\\stop' .. context_include[synname] .. '\w*+'103        \ 'contains=@' .. synname .. 'Top,@NoSpell'104endfor105 106syn match   contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>' contains=@NoSpell107 108syn match   contextSpecial    '\\par\>\|-\{2,3}\||[<>/]\=|'                     contains=@NoSpell109syn match   contextSpecial    /\\[`'"]/110syn match   contextSpecial    +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+     contains=@NoSpell111syn match   contextSpecial    '\^\^.'112syn match   contextSpecial    '`\%(\\.\|\^\^.\|.\)'113 114syn match   contextStyle      '\\\%(em\|ss\|hw\|cg\|mf\)\>'                     contains=@NoSpell115syn match   contextFont       '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>'        contains=@NoSpell116syn match   contextFont       '\\\%(Word\|WORD\|Words\|WORDS\)\>'               contains=@NoSpell117syn match   contextFont       '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>'                 contains=@NoSpell118syn match   contextFont       '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>' contains=@NoSpell119 120hi def link contextBlockDelim Keyword121hi def link contextBuiltin    Keyword122hi def link contextCommand    Keyword123hi def link contextComment    Comment124hi def link contextDelimiter  Delimiter125hi def link contextDirectLua  Keyword126hi def link contextEscaped    String127hi def link contextFont       contextType128hi def link contextKeyword    Keyword129hi def link contextInlineMath String130hi def link contextMagicLine  PreProc131hi def link contextMathCmd    Identifier132hi def link contextMathDelim  Delimiter133hi def link contextOptions    Typedef134hi def link contextPreProc    PreProc135hi def link contextSectioning PreProc136hi def link contextSequence   Identifier137hi def link contextSpecial    Special138hi def link contextStyle      contextType139hi def link contextTodo       Todo140hi def link contextType       Type141 142b:current_syntax = 'context'143 144# vim: sw=2 fdm=marker145 
codekingpro/portable-devtools · Team Ai