diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-04-29 01:43:29 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-04-29 01:47:36 +0200 |
commit | 8d3f8f639ba8ca37f32e08647822ac428738ea28 (patch) | |
tree | 521dcec5e0a71131e41ab41a850b5707dd76a555 /runtime/syntax | |
parent | 53419673154a98b705cfa80590099a247cc9df49 (diff) | |
download | rneovim-8d3f8f639ba8ca37f32e08647822ac428738ea28.tar.gz rneovim-8d3f8f639ba8ca37f32e08647822ac428738ea28.tar.bz2 rneovim-8d3f8f639ba8ca37f32e08647822ac428738ea28.zip |
vim-patch:46fceaaa8d14
Updated runtime files.
https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Diffstat (limited to 'runtime/syntax')
-rw-r--r-- | runtime/syntax/context.vim | 119 | ||||
-rw-r--r-- | runtime/syntax/mp.vim | 8 |
2 files changed, 82 insertions, 45 deletions
diff --git a/runtime/syntax/context.vim b/runtime/syntax/context.vim index 225cc6efc2..b29f256baa 100644 --- a/runtime/syntax/context.vim +++ b/runtime/syntax/context.vim @@ -1,7 +1,8 @@ " Vim syntax file -" Language: ConTeXt typesetting engine -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-08-10 +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2016 Oct 16 if exists("b:current_syntax") finish @@ -13,65 +14,93 @@ unlet b:current_syntax let s:cpo_save = &cpo set cpo&vim -if !exists('g:context_include') - let g:context_include = ['mp', 'javascript', 'xml'] +" Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP. +let s:context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'})) + +" For backward compatibility (g:context_include used to be a List) +if type(s:context_include) ==# type([]) + let g:context_metapost = (index(s:context_include, 'mp') != -1) + let s:context_include = filter( + \ {'c': 'C', 'javascript': 'JS', 'ruby': 'Ruby', 'xml': 'XML'}, + \ { k,_ -> index(s:context_include, k) != -1 } + \ ) endif +syn iskeyword @,48-57,a-z,A-Z,192-255 + syn spell toplevel -syn match contextBlockDelim display '\\\%(start\|stop\)\a\+' - \ contains=@NoSpell +" ConTeXt options, i.e., [...] blocks +syn region contextOptions matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=ALLBUT,contextBeginEndLua,@Spell + +" Highlight braces +syn match contextDelimiter '[{}]' -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\type\z(\A\)' end='\z1' -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\type\={' end='}' -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\type\=<<' end='>>' +" Comments +syn match contextComment '\\\@<!\%(\\\\\)*\zs%.*$' display contains=initexTodo +syn match contextComment '^\s*%[CDM].*$' display contains=initexTodo + +syn match contextBlockDelim '\\\%(start\|stop\)\a\+' contains=@NoSpell + +syn region contextEscaped matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1' +syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}' +syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>' syn region contextEscaped matchgroup=contextPreProc \ start='\\start\z(\a*\%(typing\|typen\)\)' \ end='\\stop\z1' contains=plaintexComment keepend -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\\h\+Type{' end='}' -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\Typed\h\+{' end='}' +syn region contextEscaped matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}' +syn region contextEscaped matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}' syn match contextBuiltin display contains=@NoSpell - \ '\\\%(unprotect\|protect\|unexpanded\)' + \ '\\\%(unprotect\|protect\|unexpanded\)\>' -syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\).*$' +syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\)\>' \ contains=@NoSpell -if index(g:context_include, 'mp') != -1 +if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) + let b:mp_metafun_macros = 1 " Highlight MetaFun keywords syn include @mpTop syntax/mp.vim unlet b:current_syntax - syn region contextMPGraphic transparent matchgroup=contextBlockDelim - \ start='\\start\z(\a*MPgraphic\|MP\%(page\|inclusions\|run\)\).*' + syn region contextMPGraphic matchgroup=contextBlockDelim + \ start='\\start\z(MP\%(clip\|code\|definitions\|drawing\|environment\|extensions\|inclusions\|initializations\|page\|\)\)\>.*$' + \ end='\\stop\z1' + \ contains=@mpTop,@NoSpell + syn region contextMPGraphic matchgroup=contextBlockDelim + \ start='\\start\z(\%(\%[re]usable\|use\|unique\|static\)MPgraphic\|staticMPfigure\|uniqueMPpagegraphic\)\>.*$' \ end='\\stop\z1' - \ contains=@mpTop + \ contains=@mpTop,@NoSpell endif -" TODO: also need to implement this for \\typeC or something along those -" lines. -function! s:include_syntax(name, group) - if index(g:context_include, a:name) != -1 - execute 'syn include @' . a:name . 'Top' 'syntax/' . a:name . '.vim' - unlet b:current_syntax - execute 'syn region context' . a:group . 'Code' - \ 'transparent matchgroup=contextBlockDelim' - \ 'start=+\\start' . a:group . '+ end=+\\stop' . a:group . '+' - \ 'contains=@' . a:name . 'Top' - endif -endfunction - -call s:include_syntax('c', 'C') -call s:include_syntax('ruby', 'Ruby') -call s:include_syntax('javascript', 'JS') -call s:include_syntax('xml', 'XML') - -syn match contextSectioning '\\chapter\>' contains=@NoSpell -syn match contextSectioning '\\\%(sub\)*section\>' contains=@NoSpell +if get(b:, 'context_lua', get(g:, 'context_lua', 1)) + syn include @luaTop syntax/lua.vim + unlet b:current_syntax + + syn region contextLuaCode matchgroup=contextBlockDelim + \ start='\\startluacode\>' + \ end='\\stopluacode\>' keepend + \ contains=@luaTop,@NoSpell + + syn match contextDirectLua "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\=" + \ nextgroup=contextBeginEndLua skipwhite skipempty + \ contains=initexComment + syn region contextBeginEndLua matchgroup=contextSpecial + \ start="{" end="}" skip="\\[{}]" + \ contained contains=@luaTop,@NoSpell +endif + +for synname in keys(s:context_include) + execute 'syn include @' . synname . 'Top' 'syntax/' . synname . '.vim' + unlet b:current_syntax + execute 'syn region context' . s:context_include[synname] . 'Code' + \ 'matchgroup=contextBlockDelim' + \ 'start=+\\start' . s:context_include[synname] . '+' + \ 'end=+\\stop' . s:context_include[synname] . '+' + \ 'contains=@' . synname . 'Top,@NoSpell' +endfor + +syn match contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>' + \ contains=@NoSpell syn match contextSpecial '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|' \ contains=@NoSpell @@ -92,15 +121,19 @@ syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>' syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>' \ contains=@NoSpell +hi def link contextOptions Typedef +hi def link contextComment Comment hi def link contextBlockDelim Keyword hi def link contextBuiltin Keyword hi def link contextDelimiter Delimiter +hi def link contextEscaped String hi def link contextPreProc PreProc hi def link contextSectioning PreProc hi def link contextSpecial Special hi def link contextType Type hi def link contextStyle contextType hi def link contextFont contextType +hi def link contextDirectLua Keyword let b:current_syntax = "context" diff --git a/runtime/syntax/mp.vim b/runtime/syntax/mp.vim index 95723d0d97..a8fa36fe0a 100644 --- a/runtime/syntax/mp.vim +++ b/runtime/syntax/mp.vim @@ -2,7 +2,7 @@ " Language: MetaPost " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> " Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com> -" Last Change: 2016 Oct 01 +" Last Change: 2016 Oct 14 if exists("b:current_syntax") finish @@ -233,7 +233,10 @@ if get(g:, "other_mp_macros", 1) endif " Up to date as of 23-Sep-2016. -if get(g:, "mp_metafun_macros", 0) +if get(b:, 'mp_metafun_macros', get(g:, 'mp_metafun_macros', 0)) + " Highlight TeX keywords (for use in ConTeXt documents) + syn match mpTeXKeyword '\\[a-zA-Z@]\+' + " These keywords have been added manually. syn keyword mpPrimitive runscript @@ -756,6 +759,7 @@ hi def link mpVariable mfVariable hi def link mpConstant mfConstant hi def link mpOnOff mpPrimitive hi def link mpDash mpPrimitive +hi def link mpTeXKeyword Identifier let b:current_syntax = "mp" |