changeset 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 e726ee71b93b
children beab53bb989e
files Filelist runtime/autoload/context.vim runtime/autoload/typeset.vim runtime/compiler/context.vim runtime/doc/eval.txt runtime/doc/motion.txt runtime/doc/options.txt runtime/doc/tags runtime/doc/textprop.txt runtime/doc/todo.txt runtime/doc/vim9.txt runtime/ftplugin/context.vim runtime/ftplugin/elixir.vim runtime/ftplugin/mf.vim runtime/ftplugin/mp.vim runtime/syntax/README.txt runtime/syntax/context.vim runtime/syntax/mf.vim runtime/syntax/mp.vim runtime/syntax/shared/README.txt runtime/syntax/shared/typescriptcommon.vim runtime/syntax/swayconfig.vim runtime/syntax/typescript.vim runtime/syntax/typescriptreact.vim
diffstat 24 files changed, 2992 insertions(+), 1180 deletions(-) [+]
line wrap: on
line diff
--- a/Filelist
+++ b/Filelist
@@ -814,6 +814,8 @@ RT_SCRIPTS =	\
 		runtime/plugin/README.txt \
 		runtime/syntax/*.vim \
 		runtime/syntax/README.txt \
+		runtime/syntax/shared/*.vim \
+		runtime/syntax/shared/README.txt \
 
 # Unix runtime
 RT_UNIX =	\
--- a/runtime/autoload/context.vim
+++ b/runtime/autoload/context.vim
@@ -1,184 +1,95 @@
-" Language:           ConTeXt typesetting engine
-" Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
-" Latest Revision:    2016 Oct 21
-
-let s:keepcpo= &cpo
-set cpo&vim
+vim9script
 
-" Helper functions {{{
-function! s:context_echo(message, mode)
-  redraw
-  echo "\r"
-  execute 'echohl' a:mode
-  echomsg '[ConTeXt]' a:message
-  echohl None
-endf
+# Language:           ConTeXt typesetting engine
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Former Maintainers: Nikolai Weibull <now@bitwi.se>
+# Latest Revision:    2022 Aug 12
 
-function! s:sh()
-  return has('win32') || has('win64') || has('win16') || has('win95')
-        \ ? ['cmd.exe', '/C']
-        \ : ['/bin/sh', '-c']
-endfunction
-
-" For backward compatibility
-if exists('*win_getid')
-
-  function! s:win_getid()
-    return win_getid()
-  endf
+# Typesetting {{{
+import autoload './typeset.vim'
 
-  function! s:win_id2win(winid)
-    return win_id2win(a:winid)
-  endf
-
-else
+export def ConTeXtCmd(path: string): list<string>
+  return ['mtxrun', '--script', 'context', '--nonstopmode', '--autogenerate', path]
+enddef
 
-  function! s:win_getid()
-    return winnr()
-  endf
-
-  function! s:win_id2win(winnr)
-    return a:winnr
-  endf
+export def Typeset(bufname: string, env = {}, Cmd = ConTeXtCmd): bool
+  return typeset.TypesetBuffer(bufname, Cmd, env, 'ConTeXt')
+enddef
 
-endif
-" }}}
-
-" ConTeXt jobs {{{
-if has('job')
-
-  let g:context_jobs = []
+export def JobStatus()
+  typeset.JobStatus('ConTeXt')
+enddef
 
-  " Print the status of ConTeXt jobs
-  function! context#job_status()
-    let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"')
-    let l:n = len(l:jobs)
-    call s:context_echo(
-          \ 'There '.(l:n == 1 ? 'is' : 'are').' '.(l:n == 0 ? 'no' : l:n)
-          \ .' job'.(l:n == 1 ? '' : 's').' running'
-          \ .(l:n == 0 ? '.' : ' (' . join(l:jobs, ', ').').'),
-          \ 'ModeMsg')
-  endfunction
+export def StopJobs()
+  typeset.StopJobs('ConTeXt')
+enddef
 
-  " Stop all ConTeXt jobs
-  function! context#stop_jobs()
-    let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"')
-    for job in l:jobs
-      call job_stop(job)
-    endfor
-    sleep 1
-    let l:tmp = []
-    for job in l:jobs
-      if job_status(job) == "run"
-        call add(l:tmp, job)
-      endif
-    endfor
-    let g:context_jobs = l:tmp
-    if empty(g:context_jobs)
-      call s:context_echo('Done. No jobs running.', 'ModeMsg')
-    else
-      call s:context_echo('There are still some jobs running. Please try again.', 'WarningMsg')
-    endif
-  endfunction
+export def Log(bufname: string)
+  execute 'edit' typeset.LogPath(bufname)
+enddef
+# }}}
 
-  function! context#callback(path, job, status)
-    if index(g:context_jobs, a:job) != -1 && job_status(a:job) != 'run' " just in case
-      call remove(g:context_jobs, index(g:context_jobs, a:job))
-    endif
-    call s:callback(a:path, a:job, a:status)
-  endfunction
+# Completion {{{
+def BinarySearch(base: string, keywords: list<string>): list<string>
+  const pat = '^' .. base
+  const len = len(keywords)
+  var res = []
+  var lft = 0
+  var rgt = len
 
-  function! context#close_cb(channel)
-    call job_status(ch_getjob(a:channel)) " Trigger exit_cb's callback for faster feedback
-  endfunction
+  # Find the leftmost index matching base
+  while lft < rgt
+    var i = (lft + rgt) / 2
+    if keywords[i] < base
+      lft = i + 1
+    else
+      rgt = i
+    endif
+  endwhile
 
-  function! s:typeset(path)
-    call add(g:context_jobs,
-          \ job_start(add(s:sh(), context#command() . ' ' . shellescape(fnamemodify(a:path, ":t"))), {
-          \   'close_cb' : 'context#close_cb',
-          \   'exit_cb'  : function(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')),
-          \                         [a:path]),
-          \   'in_io'    : 'null'
-          \ }))
-  endfunction
+  while lft < len && keywords[lft] =~ pat
+    add(res, keywords[lft])
+    lft += 1
+  endwhile
 
-else " No jobs
-
-  function! context#job_status()
-    call s:context_echo('Not implemented', 'WarningMsg')
-  endfunction!
+  return res
+enddef
 
-  function! context#stop_jobs()
-    call s:context_echo('Not implemented', 'WarningMsg')
-  endfunction
+var isMetaPostBlock = false
 
-  function! context#callback(path, job, status)
-    call s:callback(a:path, a:job, a:status)
-  endfunction
+var MP_KEYWORDS:  list<string> = []
+var CTX_KEYWORDS: list<string> = []
 
-  function! s:typeset(path)
-    execute '!' . context#command() . ' ' . shellescape(fnamemodify(a:path, ":t"))
-    call call(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')),
-          \ [a:path, 0, v:shell_error])
-  endfunction
+# Complete only MetaPost keywords in MetaPost blocks, and complete only
+# ConTeXt keywords otherwise.
+export def Complete(findstart: number, base: string): any
+  if findstart == 1
+    if len(synstack(line("."), 1)) > 0 && synIDattr(synstack(line("."), 1)[0], "name") ==# 'contextMPGraphic'
+      isMetaPostBlock = true
+      return match(getline('.'), '\S\+\%' .. col('.') .. 'c')
+    endif
 
-endif " has('job')
-
-function! s:callback(path, job, status) abort
-  if a:status < 0 " Assume the job was terminated
-    return
+    # Complete only \commands starting with a backslash
+    isMetaPostBlock = false
+    var pos = match(getline('.'), '\\\zs\S\+\%' .. col('.') .. 'c')
+    return (pos == -1) ? -3 : pos
   endif
-  " Get info about the current window
-  let l:winid = s:win_getid()             " Save window id
-  let l:efm = &l:errorformat              " Save local errorformat
-  let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory
-  " Set errorformat to parse ConTeXt errors
-  execute 'setl efm=' . escape(b:context_errorformat, ' ')
-  try " Set cwd to expand error file correctly
-    execute 'lcd' fnameescape(fnamemodify(a:path, ':h'))
-  catch /.*/
-    execute 'setl efm=' . escape(l:efm, ' ')
-    throw v:exception
-  endtry
-  try
-    execute 'cgetfile' fnameescape(fnamemodify(a:path, ':r') . '.log')
-    botright cwindow
-  finally " Restore cwd and errorformat
-    execute s:win_id2win(l:winid) . 'wincmd w'
-    execute 'lcd ' . fnameescape(l:cwd)
-    execute 'setl efm=' . escape(l:efm, ' ')
-  endtry
-  if a:status == 0
-    call s:context_echo('Success!', 'ModeMsg')
-  else
-    call s:context_echo('There are errors. ', 'ErrorMsg')
+
+  if isMetaPostBlock
+    if empty(MP_KEYWORDS)
+      MP_KEYWORDS = sort(syntaxcomplete#OmniSyntaxList(['mf\w\+', 'mp\w\+']))
+    endif
+    return BinarySearch(base, MP_KEYWORDS)
   endif
-endfunction
 
-function! context#command()
-  return get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun'))
-        \ . ' --script context --autogenerate --nonstopmode'
-        \ . ' --synctex=' . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0')
-        \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', ''))
-endfunction
+  if empty(CTX_KEYWORDS)
+    CTX_KEYWORDS = sort(syntaxcomplete#OmniSyntaxList([
+      'context\w\+', 'texAleph', 'texEtex', 'texLuatex', 'texOmega',
+      'texPdftex', 'texTex', 'texXeTeX'
+    ]))
+  endif
+  return BinarySearch(base, CTX_KEYWORDS)
+enddef
+# }}}
 
-" Accepts an optional path (useful for big projects, when the file you are
-" editing is not the project's root document). If no argument is given, uses
-" the path of the current buffer.
-function! context#typeset(...) abort
-  let l:path = fnamemodify(strlen(a:000[0]) > 0 ? a:1 : expand("%"), ":p")
-  let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory
-  call s:context_echo('Typesetting...',  'ModeMsg')
-  execute 'lcd' fnameescape(fnamemodify(l:path, ":h"))
-  try
-    call s:typeset(l:path)
-  finally " Restore local working directory
-    execute 'lcd ' . fnameescape(l:cwd)
-  endtry
-endfunction!
-"}}}
-
-let &cpo = s:keepcpo
-unlet s:keepcpo
-
-" vim: sw=2 fdm=marker
+# vim: sw=2 fdm=marker
new file mode 100644
--- /dev/null
+++ b/runtime/autoload/typeset.vim
@@ -0,0 +1,233 @@
+vim9script
+
+# Language:           Generic TeX typesetting engine
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Latest Revision:    2022 Aug 12
+
+# Constants and helpers {{{
+const SLASH = !exists("+shellslash") || &shellslash ? '/' : '\'
+
+def Echo(msg: string, mode: string, label: string)
+  redraw
+  echo "\r"
+  execute 'echohl' mode
+  echomsg printf('[%s] %s', label, msg)
+  echohl None
+enddef
+
+def EchoMsg(msg: string, label = 'Notice')
+  Echo(msg, 'ModeMsg', label)
+enddef
+
+def EchoWarn(msg: string, label = 'Warning')
+  Echo(msg, 'WarningMsg', label)
+enddef
+
+def EchoErr(msg: string, label = 'Error')
+  Echo(msg, 'ErrorMsg', label)
+enddef
+# }}}
+
+# Track jobs {{{
+var running_jobs = {} # Dictionary of job IDs of jobs currently executing
+
+def AddJob(label: string, j: job)
+  if !has_key(running_jobs, label)
+    running_jobs[label] = []
+  endif
+
+  add(running_jobs[label], j)
+enddef
+
+def RemoveJob(label: string, j: job)
+  if has_key(running_jobs, label) && index(running_jobs[label], j) != -1
+    remove(running_jobs[label], index(running_jobs[label], j))
+  endif
+enddef
+
+def GetRunningJobs(label: string): list<job>
+  return has_key(running_jobs, label) ? running_jobs[label] : []
+enddef
+# }}}
+
+# Callbacks {{{
+def ProcessOutput(qfid: number, wd: string, efm: string, ch: channel, msg: string)
+  # Make sure the quickfix list still exists
+  if getqflist({'id': qfid}).id != qfid
+    EchoErr("Quickfix list not found, stopping the job")
+    call job_stop(ch_getjob(ch))
+    return
+  endif
+
+  # Make sure the working directory is correct
+  silent execute "lcd" wd
+  setqflist([], 'a', {'id': qfid, 'lines': [msg], 'efm': efm})
+  silent lcd -
+enddef
+
+def CloseCb(ch: channel)
+  job_status(ch_getjob(ch)) # Trigger exit_cb's callback
+enddef
+
+def ExitCb(label: string, jobid: job, exitStatus: number)
+  RemoveJob(label, jobid)
+
+  if exitStatus == 0
+    botright cwindow
+    EchoMsg('Success!', label)
+  elseif exitStatus < 0
+    EchoWarn('Job terminated', label)
+  else
+    botright copen
+    wincmd p
+    EchoWarn('There are errors.', label)
+  endif
+enddef
+# }}}
+
+# Create a new empty quickfix list at the end of the stack and return its id {{{
+def NewQuickfixList(path: string): number
+  if setqflist([], ' ', {'nr': '$', 'title': path}) == -1
+    return -1
+  endif
+
+  return getqflist({'nr': '$', 'id': 0}).id
+enddef
+# }}}
+
+# Public interface {{{
+# When a TeX document is split into several source files, each source file
+# may contain a "magic line" specifiying the "root" file, e.g.:
+#
+#   % !TEX root = main.tex
+#
+# Using this line, Vim can know which file to typeset even if the current
+# buffer is different from main.tex.
+#
+# This function searches for the magic line in the first ten lines of the
+# given buffer, and returns the full path of the root document.
+#
+# NOTE: the value of "% !TEX root" *must* be a relative path.
+export def FindRootDocument(bufname: string = bufname("%")): string
+  const bufnr = bufnr(bufname)
+
+  if !bufexists(bufnr)
+    return bufname
+  endif
+
+  var rootpath = fnamemodify(bufname(bufnr), ':p')
+
+  # Search for magic line `% !TEX root = ...` in the first ten lines
+  const header = getbufline(bufnr, 1, 10)
+  const idx = match(header, '^\s*%\s\+!TEX\s\+root\s*=\s*\S')
+  if idx > -1
+    const main = matchstr(header[idx], '!TEX\s\+root\s*=\s*\zs.*$')
+    rootpath = simplify(fnamemodify(rootpath, ":h") .. SLASH .. main)
+  endif
+
+  return rootpath
+enddef
+
+export def LogPath(bufname: string): string
+  const logfile = FindRootDocument(bufname)
+  return fnamemodify(logfile, ":r") .. ".log"
+enddef
+
+# Typeset the specified path
+#
+# Parameters:
+#   label: a descriptive string used in messages to identify the kind of job
+#   Cmd:   a function that takes the path of a document and returns the typesetting command
+#   path:  the path of the document to be typeset. To avoid ambiguities, pass a *full* path.
+#   efm:   the error format string to parse the output of the command.
+#   env:   environment variables for the process (passed to job_start())
+#
+# Returns:
+#   true if the job is started successfully;
+#   false otherwise.
+export def Typeset(
+  label: string,
+  Cmd:   func(string): list<string>,
+  path:  string,
+  efm:   string,
+  env:   dict<string> = {}
+): bool
+  var fp   = fnamemodify(path, ":p")
+  var wd   = fnamemodify(fp, ":h")
+  var qfid = NewQuickfixList(fp)
+
+  if qfid == -1
+    EchoErr('Could not create quickfix list', label)
+    return false
+  endif
+
+  if !filereadable(fp)
+    EchoErr(printf('File not readable: %s', fp), label)
+    return false
+  endif
+
+  var jobid = job_start(Cmd(path), {
+    env: env,
+    cwd: wd,
+    in_io: "null",
+    callback: (c, m) => ProcessOutput(qfid, wd, efm, c, m),
+    close_cb: CloseCb,
+    exit_cb: (j, e) => ExitCb(label, j, e),
+    })
+
+  if job_status(jobid) ==# "fail"
+    EchoErr("Failed to start job", label)
+    return false
+  endif
+
+  AddJob(label, jobid)
+
+  EchoMsg('Typesetting...', label)
+
+  return true
+enddef
+
+export def JobStatus(label: string)
+  EchoMsg('Jobs still running: ' .. string(len(GetRunningJobs(label))), label)
+enddef
+
+export def StopJobs(label: string)
+  for job in GetRunningJobs(label)
+    job_stop(job)
+  endfor
+
+  EchoMsg('Done.', label)
+enddef
+
+# Typeset the specified buffer
+#
+# Parameters:
+#   name:    a buffer's name. this may be empty to indicate the current buffer.
+#   cmd:     a function that takes the path of a document and returns the typesetting command
+#   label:   a descriptive string used in messages to identify the kind of job
+#   env:     environment variables for the process (passed to job_start())
+#
+# Returns:
+#   true if the job is started successfully;
+#   false otherwise.
+export def TypesetBuffer(
+  name: string,
+  Cmd: func(string): list<string>,
+  env = {},
+  label = 'Typeset'
+): bool
+  const bufname = bufname(name)
+
+  if empty(bufname)
+    EchoErr('Please save the buffer first.', label)
+    return false
+  endif
+
+  const efm = getbufvar(bufnr(bufname), "&efm")
+  const rootpath = FindRootDocument(bufname)
+
+  return Typeset('ConTeXt', Cmd, rootpath, efm, env)
+enddef
+# }}}
+
+# vim: sw=2 fdm=marker
--- a/runtime/compiler/context.vim
+++ b/runtime/compiler/context.vim
@@ -1,54 +1,48 @@
-" Vim compiler file
-" Compiler:     ConTeXt typesetting engine
-" Maintainer:   Nicola Vitacolonna <nvitacolonna@gmail.com>
-" Last Change:  2016 Oct 21
+vim9script
 
-if exists("current_compiler")
+# Language:           ConTeXt typesetting engine
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Former Maintainers: Nikolai Weibull <now@bitwi.se>
+# Latest Revision:    2022 Aug 12
+
+if exists("g:current_compiler")
   finish
 endif
-let s:keepcpo= &cpo
-set cpo&vim
 
-if exists(":CompilerSet") != 2    " older Vim always used :setlocal
+import autoload '../autoload/context.vim'
+
+if exists(":CompilerSet") != 2 # Older Vim always used :setlocal
   command -nargs=* CompilerSet setlocal <args>
 endif
 
-" If makefile exists and we are not asked to ignore it, we use standard make
-" (do not redefine makeprg)
+g:current_compiler = 'context'
+
 if get(b:, 'context_ignore_makefile', get(g:, 'context_ignore_makefile', 0)) ||
-      \ (!filereadable('Makefile') && !filereadable('makefile'))
-  let current_compiler = 'context'
-  " The following assumes that the current working directory is set to the
-  " directory of the file to be typeset
-  let &l:makeprg = get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun'))
-        \ . ' --script context --autogenerate --nonstopmode --synctex='
-        \ . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0')
-        \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', ''))
-        \ . ' ' . shellescape(expand('%:p:t'))
+  (!filereadable('Makefile') && !filereadable('makefile'))
+  &l:makeprg =  join(context.ConTeXtCmd(shellescape(expand('%:p:t'))), ' ')
 else
-  let current_compiler = 'make'
+  g:current_compiler = 'make'
 endif
 
-let b:context_errorformat = ''
-      \ . '%-Popen source%.%#> %f,'
-      \ . '%-Qclose source%.%#> %f,'
-      \ . "%-Popen source%.%#name '%f',"
-      \ . "%-Qclose source%.%#name '%f',"
-      \ . '%Etex %trror%.%#mp error on line %l in file %f:%.%#,'
-      \ . 'tex %trror%.%#error on line %l in file %f: %m,'
-      \ . '%Elua %trror%.%#error on line %l in file %f:,'
-      \ . '%+Emetapost %#> error: %#,'
-      \ . '! error: %#%m,'
-      \ . '%-C %#,'
-      \ . '%C! %m,'
-      \ . '%Z[ctxlua]%m,'
-      \ . '%+C<*> %.%#,'
-      \ . '%-C%.%#,'
-      \ . '%Z...%m,'
-      \ . '%-Zno-error,'
-      \ . '%-G%.%#' " Skip remaining lines
+const context_errorformat = join([
+  "%-Popen source%.%#> %f",
+  "%-Qclose source%.%#> %f",
+  "%-Popen source%.%#name '%f'",
+  "%-Qclose source%.%#name '%f'",
+  "tex %trror%.%#error on line %l in file %f: %m",
+  "%Elua %trror%.%#error on line %l in file %f:",
+  "%+Emetapost %#> error: %#",
+  "%Emetafun%.%#error: %m",
+  "! error: %#%m",
+  "%-C %#",
+  "%C! %m",
+  "%Z[ctxlua]%m",
+  "%+C<*> %.%#",
+  "%-C%.%#",
+  "%Z...%m",
+  "%-Zno-error",
+  "%-G%.%#"], ",")
 
-execute 'CompilerSet errorformat=' . escape(b:context_errorformat, ' ')
+execute 'CompilerSet errorformat=' .. escape(context_errorformat, ' ')
 
-let &cpo = s:keepcpo
-unlet s:keepcpo
+# vim: sw=2 fdm=marker
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1098,6 +1098,7 @@ a different type means the values are di
 	echo 0 is []
 	0
 "is#"/"isnot#" and "is?"/"isnot?" can be used to match and ignore case.
+In |Vim9| script this doesn't work, two strings are never identical.
 
 In legacy script, when comparing a String with a Number, the String is
 converted to a Number, and the comparison is done on Numbers.  This means
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -612,7 +612,8 @@ i)							*v_i)* *i)* *i(*
 i(							*vib* *v_ib* *v_i(* *ib*
 ib			"inner block", select [count] blocks, from "[count] [("
 			to the matching ')', excluding the '(' and ')' (see
-			|[(|).
+			|[(|).  If the cursor is not inside a () block, then
+			find the next "(".
 			When used in Visual mode it is made characterwise.
 
 a>						*v_a>* *v_a<* *a>* *a<*
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -814,7 +814,7 @@ A jump table for the options with a shor
 		if [[ -n "$VIM_TERMINAL" ]]; then
 		    PROMPT_COMMAND='_vim_sync_PWD'
 		    function _vim_sync_PWD() {
-			printf "\033]7;file://%s\033\\" "$PWD"
+			printf '\033]7;file://%s\033\\' "$PWD"
 		    }
 		fi
 <
@@ -823,14 +823,14 @@ A jump table for the options with a shor
 		    autoload -Uz add-zsh-hook
 		    add-zsh-hook -Uz chpwd _vim_sync_PWD
 		    function _vim_sync_PWD() {
-			printf "\033]7;file://%s\033\\" "$PWD"
+			printf '\033]7;file://%s\033\\' "$PWD"
 		    }
 		fi
 <
 	In a fish init file: >
 		if test -n "$VIM_TERMINAL"
 		    function _vim_sync_PWD --on-variable=PWD
-			printf "\033]7;file://%s\033\\" "$PWD"
+			printf '\033]7;file://%s\033\\' "$PWD"
 		    end
 		end
 <
@@ -1793,7 +1793,8 @@ A jump table for the options with a shor
 
 	When 'cmdheight' is zero, there is no command-line unless it is being
 	used.  Some informative messages will not be displayed, any other
-	messages will cause the |hit-enter| prompt.
+	messages will cause the |hit-enter| prompt.  Expect some other
+	unexpected behavior too.
 
 						*'cmdwinheight'* *'cwh'*
 'cmdwinheight' 'cwh'	number	(default 7)
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -4300,6 +4300,7 @@ E1290	change.txt	/*E1290*
 E1291	testing.txt	/*E1291*
 E1292	cmdline.txt	/*E1292*
 E1293	textprop.txt	/*E1293*
+E1294	textprop.txt	/*E1294*
 E13	message.txt	/*E13*
 E131	eval.txt	/*E131*
 E132	eval.txt	/*E132*
@@ -7933,6 +7934,7 @@ indentkeys-format	indent.txt	/*indentkey
 index	index.txt	/*index*
 index()	builtin.txt	/*index()*
 index.txt	index.txt	/*index.txt*
+indexof()	builtin.txt	/*indexof()*
 info-message	starting.txt	/*info-message*
 inform.vim	syntax.txt	/*inform.vim*
 informix	ft_sql.txt	/*informix*
--- a/runtime/doc/textprop.txt
+++ b/runtime/doc/textprop.txt
@@ -143,12 +143,16 @@ prop_add({lnum}, {col}, {props})
 				zero is used
 		   text		text to be displayed before {col}, or after the
 				line if {col} is zero
+		   					*E1294*
 		   text_align	when "text" is present and {col} is zero
 				specifies where to display the text:
 				   after   after the end of the line
-				   right   right aligned in the window
+				   right   right aligned in the window (unless
+					   the text wraps to the next screen
+					   line)
 				   below   in the next screen line
-				When omitted "after" is used.
+				When omitted "after" is used.  Only one
+				"right" property can fit in earch line.
 		   text_wrap	when "text" is present and {col} is zero,
 				specifies what happens if the text doesn't
 				fit:
@@ -186,9 +190,10 @@ prop_add({lnum}, {col}, {props})
 		buffer line, the cursor cannot be placed on it.  A mouse click
 		in the text will move the cursor to the first character after
 		the text, or the last character of the line.
+		Any Tab and other control character in the text will be
+		changed to a space (Rationale: otherwise the size of the text
+		is difficult to compute).
 		A negative "id" will be chosen and is returned.  Once a
-		Any Tab in the text will be changed to a space (Rationale:
-		otherwise the size of the text is difficult to compute).
 		property with "text" has been added for a buffer then using a
 		negative "id" for any other property will give an error:
 		*E1293*
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -38,6 +38,11 @@ browser use: https://github.com/vim/vim/
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
+Text props: Add "padding" argument - only for when using "text" and {col} is
+zero.  Use tp_len field and n_attr_skip. #10906
+
+Graduate FEAT_TEXTOBJ ?
+
 Further Vim9 improvements, possibly after launch:
 - Use Vim9 for more runtime files.
 - Check performance with callgrind and kcachegrind.
@@ -67,18 +72,6 @@ Further Vim9 improvements, possibly afte
     has(featureName), len(someString)
 - Implement as part of an expression: ++expr, --expr, expr++, expr--.
 
-Update list of features to vote on:
-- Remove Athena item (won't happen)
-- Remove "add open mode" (won't happen)
-- Remove "editing of a hidden buffer" (done)
-- Change "add IDE features" to "improve terminal debugger"
-- Change "diff/merge capability for CVS" to "CVS and git"
-- Remove "pre-compile them" from "improve the performance of Vim scripts"
-- Add: multiple cursors, edit text in more than one place at a time
-- Add: fast syntax highlighting with parser instead of regex patterns
-- Add: virtual text, text properties can insert text in the line
-- Add: start first line halfway, scroll per wrapped screen line
-
 Popup windows:
 - Preview popup not properly updated when it overlaps with completion menu.
   (Yegappan Lakshmanan, 2021 May 22)
@@ -192,6 +185,7 @@ Patches considered for including:
 - use int instead of char_ for index  #10818  needs a test
 - Add "-n" option to xxd. #10599  needs a test
 - allow for nesting of timeout, sketch in #10595
+- Add setcmdline()  #10869
 
 Add 'splitscroll'  #10682  Useful?  Any trouble? Null Chilly says it's OK.
     suggestion: names instead of numbers for the option value
@@ -3958,15 +3952,16 @@ 8   Have a prefix for a function to make
     can be the plugin name.
     Perhaps also have a way to remove everything that the package added?
     including autocommands.
-7   Pre-parse or compile Vim scripts into a bytecode.
+7   Pre-parse or compile Vim scripts into a bytecode, like :def functions.
+    Possibilities:
     1. Put the bytecode with the original script, with an ":if
-       has('bytecode')" around it, so that it's only used with a Vim that
-       supports it.  Update the code with a command, can be used in an
-       autocommand.
+       has('bytecode-1234')" around it, so that it's only used with a Vim that
+       supports the version.  Update the code with a command, can be used in
+       an autocommand.
     2. Use a ".vic" file (like Python use .pyc).  Create it when writing a
-       .vim file.  Problem: distribution.
-    3. Use a cache directory for each user.  How to recognize which cached
-       file belongs to a sourced script?
+       .vim file.  Problem: distribution, non-writable directory, etc.
+    3. Use a cache directory for each user.  Disadvantage: cache lookup may
+       cost more time than bytecode wins.
 7   Add argument to winwidth() to subtract the space taken by 'foldcolumn',
     signs and/or 'number'.
 6   Add ++ and -- operators?  They only work on variables (lvals), how to
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -913,6 +913,12 @@ Comparators ~
 The 'ignorecase' option is not used for comparators that use strings.
 Thus "=~" works like "=~#".
 
+"is" and "isnot" (|expr-is| and |expr-isnot|) when used on strings now return
+false.  In legacy script they just compare the strings, in |Vim9| script they
+check identity, and strings are copied when used, thus two strings are never
+the same (this might change some day if strings are not copied but reference
+counted).
+
 
 Abort after error ~
 
--- a/runtime/ftplugin/context.vim
+++ b/runtime/ftplugin/context.vim
@@ -1,117 +1,115 @@
-" Vim filetype plugin file
-" Language:           ConTeXt typesetting engine
-" Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
-" Former Maintainers: Nikolai Weibull <now@bitwi.se>
-" Latest Revision:    2021 Oct 15
+vim9script
+
+# Vim filetype plugin file
+# Language:           ConTeXt typesetting engine
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Former Maintainers: Nikolai Weibull <now@bitwi.se>
+# Latest Revision:    2022 Aug 12
 
 if exists("b:did_ftplugin")
   finish
 endif
-let b:did_ftplugin = 1
 
-let s:cpo_save = &cpo
-set cpo&vim
+import autoload '../autoload/context.vim'
+
+b:did_ftplugin = 1
 
 if !exists('current_compiler')
   compiler context
 endif
 
-let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<"
+b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<"
 
-setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2
-if get(b:, 'context_metapost', get(g:, 'context_metapost', 1))
-  setlocal omnifunc=contextcomplete#Complete
-  let g:omni_syntax_group_include_context = 'mf\w\+,mp\w\+'
-  let g:omni_syntax_group_exclude_context = 'mfTodoComment'
-endif
+setlocal comments=b:%D,b:%C,b:%M,:%
+setlocal commentstring=%\ %s
+setlocal formatoptions+=tjcroql2
+setlocal omnifunc=context.Complete
+setlocal suffixesadd=.tex,.mkxl,.mkvi,.mkiv,.mkii
 
-let &l:define='\\\%([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\='
-        \ .     'def\|\\font\|\\\%(future\)\=let'
-        \ . '\|\\new\%(count\|dimen\|skip\|muskip\|box\|toks\|read\|write'
-        \ .     '\|fam\|insert\|if\)'
-
-let &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)'
+&l:define = '\\\%([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\='
+..          'def\|\\font\|\\\%(future\)\=let'
+..          '\|\\new\%(count\|dimen\|skip\|muskip\|box\|toks\|read\|write'
+..          '\|fam\|insert\|if\)'
 
-setlocal suffixesadd=.tex
+&l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)'
 
-if exists("loaded_matchit") && !exists("b:match_words")
-  let b:match_ignorecase = 0
-  let b:match_skip = 'r:\\\@<!\%(\\\\\)*%'
-  let b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],' .
-        \ '\\start\(\a\+\):\\stop\1'
-  let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words b:match_skip"
+if exists("g:loaded_matchit") && !exists("b:match_words")
+  b:match_ignorecase = 0
+  b:match_skip = 'r:\\\@<!\%(\\\\\)*%'
+  b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],\\start\(\a\+\):\\stop\1'
+  b:undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words b:match_skip"
 endif
 
-let s:context_regex = {
-      \ 'beginsection' : '\\\%(start\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>',
-      \ 'endsection'   : '\\\%(stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>',
-      \ 'beginblock'   : '\\\%(start\|setup\|define\)',
-      \ 'endblock'     : '\\\%(stop\|setup\|define\)'
-      \ }
-
-function! s:move_around(count, what, flags, visual)
-  if a:visual
-    exe "normal! gv"
-  endif
-  call search(s:context_regex[a:what], a:flags.'s') " 's' sets previous context mark
-  call map(range(2, a:count), 'search(s:context_regex[a:what], a:flags)')
-endfunction
+if !get(g:, 'no_context_maps', 0) && !get(g:, 'no_plugin_maps', 0)
+  const context_regex = {
+    'beginsection': '\\\%(start\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>',
+    'endsection':   '\\\%(stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>',
+    'beginblock':   '\\\%(start\|setup\|define\)',
+    'endblock':     '\\\%(stop\|setup\|define\)',
+    }
 
-if !exists("no_plugin_maps") && !exists("no_context_maps")
-  " Move around macros.
-  nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR>
-  vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true)  <CR>
-  nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W",  v:false) <CR>
-  vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W",  v:true)  <CR>
-  nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection",   "bW", v:false) <CR>
-  vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection",   "bW", v:true)  <CR>
-  nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection",   "W",  v:false) <CR>
-  vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection",   "W",  v:true)  <CR>
-  nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock",   "bW", v:false) <CR>
-  vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock",   "bW", v:true)  <CR>
-  nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock",     "W",  v:false) <CR>
-  vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock",     "W",  v:true)  <CR>
+  def UndoMap(mapping: string, modes: string)
+    for mode in modes
+      b:undo_ftplugin ..= printf(" | silent! execute '%sunmap <buffer> %s'", mode, mapping)
+    endfor
+  enddef
+
+  def MoveAround(count: number, what: string, flags: string)
+    search(context_regex[what], flags .. 's')  # 's' sets previous context mark
+    var i = 2
+    while i <= count
+      search(context_regex[what], flags)
+      i += 1
+    endwhile
+  enddef
 
-  let b:undo_ftplugin .= " | sil! exe 'nunmap <buffer> [[' | sil! exe 'vunmap <buffer> [['" .
-	\                " | sil! exe 'nunmap <buffer> ]]' | sil! exe 'vunmap <buffer> ]]'" .
-	\                " | sil! exe 'nunmap <buffer> []' | sil! exe 'vunmap <buffer> []'" .
-	\                " | sil! exe 'nunmap <buffer> ][' | sil! exe 'vunmap <buffer> ]['" .
-	\                " | sil! exe 'nunmap <buffer> [{' | sil! exe 'vunmap <buffer> [{'" .
-	\                " | sil! exe 'nunmap <buffer> ]}' | sil! exe 'vunmap <buffer> ]}'"
-end
+  # Macros to move around
+  nnoremap <silent><buffer> [[ <scriptcmd>MoveAround(v:count1, "beginsection", "bW")<cr>
+  vnoremap <silent><buffer> [[ <scriptcmd>MoveAround(v:count1, "beginsection", "bW")<cr>
+  nnoremap <silent><buffer> ]] <scriptcmd>MoveAround(v:count1, "beginsection", "W") <cr>
+  vnoremap <silent><buffer> ]] <scriptcmd>MoveAround(v:count1, "beginsection", "W") <cr>
+  nnoremap <silent><buffer> [] <scriptcmd>MoveAround(v:count1, "endsection",   "bW")<cr>
+  vnoremap <silent><buffer> [] <scriptcmd>MoveAround(v:count1, "endsection",   "bW")<cr>
+  nnoremap <silent><buffer> ][ <scriptcmd>MoveAround(v:count1, "endsection",   "W") <cr>
+  vnoremap <silent><buffer> ][ <scriptcmd>MoveAround(v:count1, "endsection",   "W") <cr>
+  nnoremap <silent><buffer> [{ <scriptcmd>MoveAround(v:count1, "beginblock",   "bW")<cr>
+  vnoremap <silent><buffer> [{ <scriptcmd>MoveAround(v:count1, "beginblock",   "bW")<cr>
+  nnoremap <silent><buffer> ]} <scriptcmd>MoveAround(v:count1, "endblock",     "W") <cr>
+  vnoremap <silent><buffer> ]} <scriptcmd>MoveAround(v:count1, "endblock",     "W") <cr>
 
-" Other useful mappings
-if get(g:, 'context_mappings', 1)
-  let s:tp_regex = '?^$\|^\s*\\\(item\|start\|stop\|blank\|\%(sub\)*section\|chapter\|\%(sub\)*subject\|title\|part\)'
+  for mapping in ['[[', ']]', '[]', '][', '[{', ']}']
+    UndoMap(mapping, 'nv')
+  endfor
 
-  fun! s:tp()
-    call cursor(search(s:tp_regex, 'bcW') + 1, 1)
+  # Other useful mappings
+  const tp_regex = '?^$\|^\s*\\\(item\|start\|stop\|blank\|\%(sub\)*section\|chapter\|\%(sub\)*subject\|title\|part\)'
+
+  def TeXPar()
+    cursor(search(tp_regex, 'bcW') + 1, 1)
     normal! V
-    call cursor(search(s:tp_regex, 'W') - 1, 1)
-  endf
+    cursor(search(tp_regex, 'W') - 1, 1)
+  enddef
 
-  if !exists("no_plugin_maps") && !exists("no_context_maps")
-    " Reflow paragraphs with commands like gqtp ("gq TeX paragraph")
-    onoremap <silent><buffer> tp :<c-u>call <sid>tp()<cr>
-    " Select TeX paragraph
-    vnoremap <silent><buffer> tp <esc>:<c-u>call <sid>tp()<cr>
+  # Reflow paragraphs with mappings like gqtp ("gq TeX paragraph")
+  onoremap <silent><buffer> tp <scriptcmd>TeXPar()<cr>
+  # Select TeX paragraph
+  vnoremap <silent><buffer> tp <scriptcmd>TeXPar()<cr>
 
-    " $...$ text object
-    onoremap <silent><buffer> i$ :<c-u>normal! T$vt$<cr>
-    onoremap <silent><buffer> a$ :<c-u>normal! F$vf$<cr>
-    vnoremap <buffer> i$ T$ot$
-    vnoremap <buffer> a$ F$of$
+  # $...$ text object
+  onoremap <silent><buffer> i$ <scriptcmd>normal! T$vt$<cr>
+  onoremap <silent><buffer> a$ <scriptcmd>normal! F$vf$<cr>
+  vnoremap <buffer> i$ T$ot$
+  vnoremap <buffer> a$ F$of$
 
-    let b:undo_ftplugin .= " | sil! exe 'ounmap <buffer> tp' | sil! exe 'vunmap <buffer> tp'" .
-	  \                " | sil! exe 'ounmap <buffer> i$' | sil! exe 'vunmap <buffer> i$'" .
-	  \                " | sil! exe 'ounmap <buffer> a$' | sil! exe 'vunmap <buffer> a$'"
-    endif
+  for mapping in ['tp', 'i$', 'a$']
+    UndoMap(mapping, 'ov')
+  endfor
 endif
 
-" Commands for asynchronous typesetting
-command! -buffer -nargs=? -complete=file ConTeXt          call context#typeset(<q-args>)
-command!         -nargs=0                ConTeXtJobStatus call context#job_status()
-command!         -nargs=0                ConTeXtStopJobs  call context#stop_jobs()
+# Commands for asynchronous typesetting
+command! -buffer -nargs=? -complete=buffer ConTeXt          context.Typeset(<q-args>)
+command! -buffer -nargs=0                  ConTeXtLog       context.Log('%')
+command!         -nargs=0                  ConTeXtJobStatus context.JobStatus()
+command!         -nargs=0                  ConTeXtStopJobs  context.StopJobs()
 
-let &cpo = s:cpo_save
-unlet s:cpo_save
+# vim: sw=2 fdm=marker
--- a/runtime/ftplugin/elixir.vim
+++ b/runtime/ftplugin/elixir.vim
@@ -1,11 +1,29 @@
 " Elixir filetype plugin
 " Language: Elixir
 " Maintainer:	Mitchell Hanberg <vimNOSPAM@mitchellhanberg.com>
-" Last Change: 2022 Apr 20
+" Last Change: 2022 August 10
 
 if exists("b:did_ftplugin")
   finish
 endif
 let b:did_ftplugin = 1
 
+let s:save_cpo = &cpo
+set cpo&vim
+
+" Matchit support
+if exists('loaded_matchit') && !exists('b:match_words')
+  let b:match_ignorecase = 0
+
+  let b:match_words = '\:\@<!\<\%(do\|fn\)\:\@!\>' .
+        \ ':' .
+        \ '\<\%(else\|catch\|after\|rescue\)\:\@!\>' .
+        \ ':' .
+        \ '\:\@<!\<end\>' .
+        \ ',{:},\[:\],(:)'
+endif
+
 setlocal commentstring=#\ %s
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
--- a/runtime/ftplugin/mf.vim
+++ b/runtime/ftplugin/mf.vim
@@ -1,70 +1,82 @@
-" Vim filetype plugin file
-" Language:           METAFONT
-" Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
-" Former Maintainers: Nikolai Weibull <now@bitwi.se>
-" Latest Revision:    2016 Oct 2
+vim9script
+
+# Vim filetype plugin file
+# Language:           METAFONT
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Former Maintainers: Nikolai Weibull <now@bitwi.se>
+# Latest Revision:    2022 Aug 12
 
 if exists("b:did_ftplugin")
   finish
 endif
-let b:did_ftplugin = 1
 
-let s:cpo_save = &cpo
-set cpo&vim
+b:did_ftplugin = 1
+b:undo_ftplugin = "setl com< cms< fo< sua< inc< def< ofu<"
 
-let b:undo_ftplugin = "setl com< cms< fo< sua< inc< def< ofu<"
-      \ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
-
-setlocal comments=:% commentstring=%\ %s formatoptions-=t formatoptions+=cjroql2
+setlocal comments=:%
+setlocal commentstring=%\ %s
+setlocal formatoptions+=cjroql2
+setlocal formatoptions-=t
+setlocal omnifunc=syntaxcomplete#Complete
 setlocal suffixesadd=.mf
-let &l:include = '\<input\>'
-let &l:define = '\<\%(let\|newinternal\|interim\|def\|vardef\)\>\|\<\%(primary\|secondary\|tertiary\)def\>\s*[^ .]\+'
-setlocal omnifunc=syntaxcomplete#Complete
-let g:omni_syntax_group_include_mf = 'mf\w\+'
-let g:omni_syntax_group_exclude_mf = 'mfTodoComment'
-
-let s:mp_regex = {
-      \ 'beginsection' : '^\s*\%(\%(\|var\|primary\|secondary\|tertiary\)def\|beginchar\|beginlogochar\)\>',
-      \ 'endsection'   : '^\s*\%(enddef\|endchar\)\>',
-      \ 'beginblock'   : '^\s*\%(begingroup\|if\|for\%(\|suffixes\|ever\)\)\>',
-      \ 'endblock'     : '^\s*\%(endgroup\|fi\|endfor\)\>'
-      \ }
 
-function! s:move_around(count, what, flags, visual)
-  if a:visual
-    exe "normal! gv"
-  endif
-  call search(s:mp_regex[a:what], a:flags.'s') " 's' sets previous context mark
-  call map(range(2, a:count), 'search(s:mp_regex[a:what], a:flags)')
-endfunction
+&l:include = '\<input\>'
+&l:define = '\<\%(let\|newinternal\|interim\|def\|vardef\)\>\|\<\%(primary\|secondary\|tertiary\)def\>\s*[^ .]\+'
 
+g:omni_syntax_group_include_mf = 'mf\w\+'
+g:omni_syntax_group_exclude_mf = 'mfTodoComment'
 
-" Move around macros.
-nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR>
-vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true)  <CR>
-nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W",  v:false) <CR>
-vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W",  v:true)  <CR>
-nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection",   "bW", v:false) <CR>
-vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection",   "bW", v:true)  <CR>
-nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection",   "W",  v:false) <CR>
-vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection",   "W",  v:true)  <CR>
-nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock",   "bW", v:false) <CR>
-vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock",   "bW", v:true)  <CR>
-nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock",     "W",  v:false) <CR>
-vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock",     "W",  v:true)  <CR>
-
-if exists("loaded_matchit")
-  let b:match_ignorecase = 0
-  let b:match_words =
-        \ '\<if\>:\<else\%[if]\>:\<fi\>,' .
-        \ '\<for\%(\|suffixes\|ever\)\>:\<exit\%(if\|unless\)\>:\<endfor\>,' .
-        \ '\<\%(\|var\|primary\|secondary\|tertiary\)def\>:\<enddef\>,' .
-        \ '\<begingroup\>:\<endgroup\>,' .
-        \ '\<begin\%(logo\)\?char\>:\<endchar\>'
-  " Ignore comments and strings
-  let b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name")
-        \ =~# "mf\\(Comment\\|String\\)$"'
+if exists("g:loaded_matchit") && !exists("b:match_words")
+  b:match_ignorecase = 0
+  b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name") =~# "mf\\(Comment\\|String\\)$"'
+  b:match_words = '\<if\>:\<else\%[if]\>:\<fi\>,'
+  ..              '\<for\%(\|suffixes\|ever\)\>:\<exit\%(if\|unless\)\>:\<endfor\>,'
+  ..              '\<\%(\|var\|primary\|secondary\|tertiary\)def\>:\<enddef\>,'
+  ..              '\<begingroup\>:\<endgroup\>,'
+  ..              '\<begin\%(logo\)\?char\>:\<endchar\>'
+  b:undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words b:match_skip"
 endif
 
-let &cpo = s:cpo_save
-unlet s:cpo_save
+if !get(g:, 'no_mf_maps', 0) && !get(g:, 'no_plugin_maps', 0)
+  const mf_regex = {
+    'beginsection': '^\s*\%(\%(\|var\|primary\|secondary\|tertiary\)def\|beginchar\|beginlogochar\)\>',
+    'endsection':   '^\s*\%(enddef\|endchar\)\>',
+    'beginblock':   '^\s*\%(begingroup\|if\|for\%(\|suffixes\|ever\)\)\>',
+    'endblock':     '^\s*\%(endgroup\|fi\|endfor\)\>'}
+
+  def MoveAround(count: number, what: string, flags: string)
+    search(mf_regex[what], flags .. 's')  # 's' sets previous context mark
+    var i = 2
+    while i <= count
+      search(mf_regex[what], flags)
+      i += 1
+    endwhile
+  enddef
+
+  # Macros to move around
+  nnoremap <silent><buffer> [[ <scriptcmd>MoveAround(v:count1, "beginsection", "bW")<cr>
+  vnoremap <silent><buffer> [[ <scriptcmd>MoveAround(v:count1, "beginsection", "bW")<cr>
+  nnoremap <silent><buffer> ]] <scriptcmd>MoveAround(v:count1, "beginsection", "W") <cr>
+  vnoremap <silent><buffer> ]] <scriptcmd>MoveAround(v:count1, "beginsection", "W") <cr>
+  nnoremap <silent><buffer> [] <scriptcmd>MoveAround(v:count1, "endsection",   "bW")<cr>
+  vnoremap <silent><buffer> [] <scriptcmd>MoveAround(v:count1, "endsection",   "bW")<cr>
+  nnoremap <silent><buffer> ][ <scriptcmd>MoveAround(v:count1, "endsection",   "W") <cr>
+  vnoremap <silent><buffer> ][ <scriptcmd>MoveAround(v:count1, "endsection",   "W") <cr>
+  nnoremap <silent><buffer> [{ <scriptcmd>MoveAround(v:count1, "beginblock",   "bW")<cr>
+  vnoremap <silent><buffer> [{ <scriptcmd>MoveAround(v:count1, "beginblock",   "bW")<cr>
+  nnoremap <silent><buffer> ]} <scriptcmd>MoveAround(v:count1, "endblock",     "W") <cr>
+  vnoremap <silent><buffer> ]} <scriptcmd>MoveAround(v:count1, "endblock",     "W") <cr>
+
+  for mapping in ["[[", "]]", "[]", "][", "[{", "]}"]
+    b:undo_ftplugin ..= printf(" | silent! execute 'nunmap <buffer> %s'", mapping)
+    b:undo_ftplugin ..= printf(" | silent! execute 'vunmap <buffer> %s'", mapping)
+  endfor
+endif
+
+if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
+  b:browsefilter = "METAFONT Source Files (*.mf)\t*.mf\n"
+  ..                   "All Files (*.*)\t*.*\n"
+  b:undo_ftplugin ..= ' | unlet! b:browsefilter'
+endif
+
+# vim: sw=2 fdm=marker
--- a/runtime/ftplugin/mp.vim
+++ b/runtime/ftplugin/mp.vim
@@ -1,82 +1,91 @@
-" Vim filetype plugin file
-" Language:           MetaPost
-" Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
-" Former Maintainers: Nikolai Weibull <now@bitwi.se>
-" Latest Revision:    2016 Oct 2
+vim9script
+
+# Vim filetype plugin file
+# Language:           MetaPost
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Former Maintainers: Nikolai Weibull <now@bitwi.se>
+# Latest Revision:    2022 Aug 12
 
 if exists("b:did_ftplugin")
   finish
 endif
-let b:did_ftplugin = 1
+
+b:did_ftplugin = 1
+b:undo_ftplugin = "setl com< cms< fo< sua< inc< def< ofu<"
 
-let s:cpo_save = &cpo
-set cpo&vim
+setlocal comments=:%
+setlocal commentstring=%\ %s
+setlocal formatoptions+=cjroql2
+setlocal formatoptions-=t
+setlocal omnifunc=syntaxcomplete#Complete
+setlocal suffixesadd=.mp,.mpiv,.mpvi,.mpxl
 
-let b:undo_ftplugin = "setl com< cms< fo< sua< inc< def< ofu<"
-      \ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
+&l:include = '\<\%(input\|loadmodule\)\>'  # loadmodule is from MetaFun
+&l:define = '\<\%(let\|newinternal\|interim\|def\|vardef\)\>\|\<\%(primary\|secondary\|tertiary\)def\>\s*[^ .]\+'
+
+g:omni_syntax_group_include_mp = 'mf\w\+,mp\w\+,metafun\w\+'
+g:omni_syntax_group_exclude_mp = 'mfTodoComment'
 
-setlocal comments=:% commentstring=%\ %s formatoptions-=t formatoptions+=cjroql2
-setlocal suffixesadd=.mp,.mpiv
-let &l:include = '\<\%(input\|loadmodule\)\>' " loadmodule is in MetaFun
-let &l:define = '\<\%(let\|newinternal\|interim\|def\|vardef\)\>\|\<\%(primary\|secondary\|tertiary\)def\>\s*[^ .]\+'
-setlocal omnifunc=syntaxcomplete#Complete
-let g:omni_syntax_group_include_mp = 'mf\w\+,mp\w\+'
-let g:omni_syntax_group_exclude_mp = 'mfTodoComment'
+var fignum: number
+
+def FixBeginfigs()
+  fignum = 1
+  g/^\s*beginfig(\d*)\s*;\(\s*%.*\)\=$/s/^.\{-};/\='beginfig(' .. fignum .. ');'/ | ++fignum
+enddef
+
+command! -buffer -nargs=0 -bar FixBeginfigs FixBeginfigs()
 
-if exists(":FixBeginfigs") != 2
-  command -nargs=0 FixBeginfigs call s:fix_beginfigs()
-
-  function! s:fix_beginfigs()
-    let i = 1
-    g/^beginfig(\d*);$/s//\='beginfig('.i.');'/ | let i = i + 1
-  endfunction
+if exists("g:loaded_matchit") && !exists("b:match_words")
+  b:match_ignorecase = 0
+  b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name") =~# "^mf\\%(Comment\\|String\\|\\)$\\|^mpTeXinsert$"'
+  b:match_words = '\<if\>:\<else\%[if]\>:\<fi\>,'
+  ..              '\<for\%(\|suffixes\|ever\)\>:\<exit\%(if\|unless\)\>:\<endfor\>,'
+  ..              '\<\%(\|var\|primary\|secondary\|tertiary\)def\>:\<enddef\>,'
+  ..              '\<begin\(\a\+\)\>:end\1,'
+  ..              '\<beginlogochar\>:\<endchar\>'
+  b:undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words b:match_skip"
 endif
 
-let s:mp_regex = {
-      \ 'beginsection' : '^\s*\%(\%(\|var\|primary\|secondary\|tertiary\)def\|begin\%(fig\|char\|logochar\|glyph\|graph\)\)\>',
-      \ 'endsection'   : '^\s*\%(enddef\|end\%(fig\|char\|glyph\|graph\)\)\>',
-      \ 'beginblock'   : '^\s*\%(begingroup\|if\|for\%(\|suffixes\|ever\)\)\>',
-      \ 'endblock'     : '^\s*\%(endgroup\|fi\|endfor\)\>'
-      \ }
+if !get(g:, 'no_mp_maps', 0) && !get(g:, 'no_plugin_maps', 0)
+  const mp_regex = {
+    'beginsection': '^\s*\%(\%(\|var\|primary\|secondary\|tertiary\)def\|begin\%(fig\|char\|logochar\|glyph\|graph\)\)\>',
+    'endsection':   '^\s*\%(enddef\|end\%(fig\|char\|glyph\|graph\)\)\>',
+    'beginblock':   '^\s*\%(begingroup\|if\|for\%(\|suffixes\|ever\)\)\>',
+    'endblock':     '^\s*\%(endgroup\|fi\|endfor\)\>'}
 
-function! s:move_around(count, what, flags, visual)
-  if a:visual
-    exe "normal! gv"
-  endif
-  call search(s:mp_regex[a:what], a:flags.'s') " 's' sets previous context mark
-  call map(range(2, a:count), 'search(s:mp_regex[a:what], a:flags)')
-endfunction
-
+  def MoveAround(count: number, what: string, flags: string)
+    search(mp_regex[what], flags .. 's')  # 's' sets previous context mark
+    var i = 2
+    while i <= count
+      search(mp_regex[what], flags)
+      i += 1
+    endwhile
+  enddef
 
-" Move around macros.
-nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR>
-vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true)  <CR>
-nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W",  v:false) <CR>
-vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W",  v:true)  <CR>
-nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection",   "bW", v:false) <CR>
-vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection",   "bW", v:true)  <CR>
-nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection",   "W",  v:false) <CR>
-vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection",   "W",  v:true)  <CR>
-nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock",   "bW", v:false) <CR>
-vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock",   "bW", v:true)  <CR>
-nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock",     "W",  v:false) <CR>
-vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock",     "W",  v:true)  <CR>
+  # Macros to move around
+  nnoremap <silent><buffer> [[ <scriptcmd>MoveAround(v:count1, "beginsection", "bW")<cr>
+  vnoremap <silent><buffer> [[ <scriptcmd>MoveAround(v:count1, "beginsection", "bW")<cr>
+  nnoremap <silent><buffer> ]] <scriptcmd>MoveAround(v:count1, "beginsection", "W") <cr>
+  vnoremap <silent><buffer> ]] <scriptcmd>MoveAround(v:count1, "beginsection", "W") <cr>
+  nnoremap <silent><buffer> [] <scriptcmd>MoveAround(v:count1, "endsection",   "bW")<cr>
+  vnoremap <silent><buffer> [] <scriptcmd>MoveAround(v:count1, "endsection",   "bW")<cr>
+  nnoremap <silent><buffer> ][ <scriptcmd>MoveAround(v:count1, "endsection",   "W") <cr>
+  vnoremap <silent><buffer> ][ <scriptcmd>MoveAround(v:count1, "endsection",   "W") <cr>
+  nnoremap <silent><buffer> [{ <scriptcmd>MoveAround(v:count1, "beginblock",   "bW")<cr>
+  vnoremap <silent><buffer> [{ <scriptcmd>MoveAround(v:count1, "beginblock",   "bW")<cr>
+  nnoremap <silent><buffer> ]} <scriptcmd>MoveAround(v:count1, "endblock",     "W") <cr>
+  vnoremap <silent><buffer> ]} <scriptcmd>MoveAround(v:count1, "endblock",     "W") <cr>
 
-if exists("loaded_matchit")
-  let b:match_ignorecase = 0
-  let b:match_words =
-        \ '\<if\>:\<else\%[if]\>:\<fi\>,' .
-        \ '\<for\%(\|suffixes\|ever\)\>:\<exit\%(if\|unless\)\>:\<endfor\>,' .
-        \ '\<\%(\|var\|primary\|secondary\|tertiary\)def\>:\<enddef\>,' .
-        \ '\<beginfig\>:\<endfig\>,' .
-        \ '\<begingroup\>:\<endgroup\>,' .
-        \ '\<begin\%(logo\)\?char\>:\<endchar\>,' .
-        \ '\<beginglyph\>:\<endglyph\>,' .
-        \ '\<begingraph\>:\<endgraph\>'
-  " Ignore comments and strings
-  let b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name")
-        \ =~# "^mf\\%(Comment\\|String\\|\\)$\\|^mpTeXinsert$"'
+  for mapping in ["[[", "]]", "[]", "][", "[{", "]}"]
+    b:undo_ftplugin ..= printf(" | silent! execute 'nunmap <buffer> %s'", mapping)
+    b:undo_ftplugin ..= printf(" | silent! execute 'vunmap <buffer> %s'", mapping)
+  endfor
 endif
 
-let &cpo = s:cpo_save
-unlet s:cpo_save
+if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
+  b:browsefilter = "MetaPost Source Files (*.mp)\t*.mp\n"
+  ..               "All Files (*.*)\t*.*\n"
+  b:undo_ftplugin ..= ' | unlet! b:browsefilter'
+endif
+
+# vim: sw=2 fdm=marker
--- a/runtime/syntax/README.txt
+++ b/runtime/syntax/README.txt
@@ -13,6 +13,9 @@ synload.vim	Contains autocommands to loa
 nosyntax.vim	Used for the ":syntax off" command.  Undo the loading of
 		synload.vim.
 
+The "shared" directory contains generated files and what is used by more than
+one syntax.
+
 
 A few special files:
 
--- a/runtime/syntax/context.vim
+++ b/runtime/syntax/context.vim
@@ -1,141 +1,144 @@
-" Vim syntax file
-" Language:           ConTeXt typesetting engine
-" Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
-" Former Maintainers: Nikolai Weibull <now@bitwi.se>
-" Latest Revision:    2016 Oct 16
+vim9script
+
+# Vim syntax file
+# Language:           ConTeXt typesetting engine
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Former Maintainers: Nikolai Weibull <now@bitwi.se>
+# Latest Revision:    2022 Aug 12
 
 if exists("b:current_syntax")
   finish
 endif
 
-runtime! syntax/plaintex.vim
-unlet b:current_syntax
-
-let s:cpo_save = &cpo
-set cpo&vim
+# Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP.
+var context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': '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 }
-        \ )
+# Deprecation warning
+if type(context_include) ==# type([])
+  echomsg "[ConTeXt] b:context_include/g:context_include must be Dictionaries."
+  context_include = {'xml': 'XML'}
 endif
 
-syn iskeyword @,48-57,a-z,A-Z,192-255
+syn iskeyword @,48-57,_,!,?,a-z,A-Z,192-255
 
-syn spell   toplevel
+syn spell toplevel
 
-" ConTeXt options, i.e., [...] blocks
-syn region  contextOptions    matchgroup=contextDelimiter start='\['  end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=ALLBUT,contextBeginEndLua,@Spell
+runtime! syntax/shared/context-data-context.vim
+runtime! syntax/shared/context-data-interfaces.vim
+runtime! syntax/shared/context-data-tex.vim
 
-" Highlight braces
+syn match contextCommand '\\\k\+\>' display contains=@NoSpell
+
+# ConTeXt options, i.e., [...] blocks
+syn region  contextOptions    matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=TOP,@Spell
+
+# Highlight braces
 syn match   contextDelimiter  '[{}]'
 
-" Comments
-syn match   contextComment '\\\@<!\%(\\\\\)*\zs%.*$' display contains=initexTodo
-syn match   contextComment '^\s*%[CDM].*$'           display contains=initexTodo
+# Comments
+syn match   contextComment    '\%(\_^\|[^\\]\)\%(\\\\\)*\zs%.*$' display contains=contextTodo,contextMagicLine
+syn match   contextComment    '^\s*%[CDM].*$'                    display contains=contextTodo,contextMagicLine
+syn keyword contextTodo       TODO FIXME XXX NOTE                contained
+syn match   contextMagicLine  '^\s*%\s*!TEX.*$'                  contained
 
-syn match   contextBlockDelim '\\\%(start\|stop\)\a\+' contains=@NoSpell
+syn match   contextBlockDelim '\\\%(start\|stop\)\k\+' 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
+                              \ end='\\stop\z1' contains=contextComment keepend
 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\)\>'
+syn match   contextBuiltin    '\\unexpanded\>' display contains=@NoSpell
 
-syn match   contextPreProc    '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\)\>'
-                              \ contains=@NoSpell
+# \unprotect... \protect regions
+syn region  contextUnprotect  matchgroup=contextBuiltin start='\\unprotect' end='\\protect' contains=TOP
+syn match   contextSequence   '\\[a-zA-Z]*[@_!?]\+[a-zA-Z@_!?]*' contains=@NoSpell contained containedin=contextUnprotect
 
-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
+# Math
+syn match  contextMathCmd '\\m\%(ath\%(ematics\)\=\)\=\>'
+syn region contextInlineMath matchgroup=contextMathDelim start='\$' skip='\\\\\|\\\$' end='\$'
+syn region contextDisplayMath matchgroup=contextMathDelim start='\$\$' skip='\\\\\|\\\$' end='\$\$' keepend
+syn region contextDisplayMath matchgroup=contextBlockDelim start='\\startformula' end='\\stopformula' contains=TOP
 
-  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,@NoSpell
-endif
+# MetaFun
+b:mp_metafun = 1
+syn include @mpTop syntax/mp.vim
+unlet b:current_syntax
 
-if get(b:, 'context_lua', get(g:, 'context_lua', 1))
-  syn include @luaTop          syntax/lua.vim
-  unlet b:current_syntax
+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,@NoSpell
 
-  syn region  contextLuaCode    matchgroup=contextBlockDelim
-                                \ start='\\startluacode\>'
-                                \ end='\\stopluacode\>' keepend
-                                \ contains=@luaTop,@NoSpell
+# Lua
+syn include @luaTop syntax/lua.vim
+unlet b:current_syntax
 
-  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
+syn region  contextLuaCode    matchgroup=contextBlockDelim
+      \ start='\\startluacode\>'
+      \ end='\\stopluacode\>' keepend
+      \ contains=@luaTop,@NoSpell
+syn match   contextDirectLua  "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\="
+      \ nextgroup=contextBeginEndLua skipwhite skipempty
+      \ contains=contextComment
+syn region  contextBeginEndLua matchgroup=contextSpecial
+      \ start="{" end="}" skip="\\[{}]"
+      \ contained contains=@luaTop,@NoSpell
 
-for synname in keys(s:context_include)
-  execute 'syn include @' . synname . 'Top' 'syntax/' . synname . '.vim'
+for synname in keys(context_include)
+  execute 'syn include @' .. synname .. 'Top' 'syntax/' .. synname .. '.vim'
   unlet b:current_syntax
-  execute 'syn region context' . s:context_include[synname] . 'Code'
+  execute 'syn region context' .. context_include[synname] .. 'Code'
         \ 'matchgroup=contextBlockDelim'
-        \ 'start=+\\start' . s:context_include[synname] . '+'
-        \ 'end=+\\stop' . s:context_include[synname] . '+'
-        \ 'contains=@' . synname . 'Top,@NoSpell'
+        \ 'start=+\\start' .. context_include[synname] .. '\w*+'
+        \ 'end=+\\stop' .. context_include[synname] .. '\w*+'
+        \ 'contains=@' .. synname .. 'Top,@NoSpell'
 endfor
 
-syn match   contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>'
-                              \ contains=@NoSpell
+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
+syn match   contextSpecial    '\\par\>\|-\{2,3}\||[<>/]\=|'                     contains=@NoSpell
 syn match   contextSpecial    /\\[`'"]/
-syn match   contextSpecial    +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+
-                              \ contains=@NoSpell
+syn match   contextSpecial    +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+     contains=@NoSpell
 syn match   contextSpecial    '\^\^.'
 syn match   contextSpecial    '`\%(\\.\|\^\^.\|.\)'
 
-syn match   contextStyle      '\\\%(em\|ss\|hw\|cg\|mf\)\>'
-                              \ contains=@NoSpell
-syn match   contextFont       '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>'
-                              \ contains=@NoSpell
-syn match   contextFont       '\\\%(Word\|WORD\|Words\|WORDS\)\>'
-                              \ contains=@NoSpell
-syn match   contextFont       '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>'
-                              \ contains=@NoSpell
-syn match   contextFont       '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>'
-                              \ contains=@NoSpell
+syn match   contextStyle      '\\\%(em\|ss\|hw\|cg\|mf\)\>'                     contains=@NoSpell
+syn match   contextFont       '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>'        contains=@NoSpell
+syn match   contextFont       '\\\%(Word\|WORD\|Words\|WORDS\)\>'               contains=@NoSpell
+syn match   contextFont       '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>'                 contains=@NoSpell
+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 contextCommand    Keyword
+hi def link contextComment    Comment
 hi def link contextDelimiter  Delimiter
+hi def link contextDirectLua  Keyword
 hi def link contextEscaped    String
+hi def link contextFont       contextType
+hi def link contextKeyword    Keyword
+hi def link contextInlineMath String
+hi def link contextMagicLine  PreProc
+hi def link contextMathCmd    Identifier
+hi def link contextMathDelim  Delimiter
+hi def link contextOptions    Typedef
 hi def link contextPreProc    PreProc
 hi def link contextSectioning PreProc
+hi def link contextSequence   Identifier
 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
+hi def link contextTodo       Todo
+hi def link contextType       Type
 
-let b:current_syntax = "context"
+b:current_syntax = 'context'
 
-let &cpo = s:cpo_save
-unlet s:cpo_save
+# vim: sw=2 fdm=marker
--- a/runtime/syntax/mf.vim
+++ b/runtime/syntax/mf.vim
@@ -1,26 +1,39 @@
-" Vim syntax file
-" Language:           METAFONT
-" Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
-" Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com>
-" Last Change:        2016 Oct 1
+vim9script
+
+# Vim syntax file
+# Language:           METAFONT
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com>
+# Latest Revision:    2022 Aug 12
 
 if exists("b:current_syntax")
   finish
 endif
 
+# Deprecation warnings: to be removed eventually
+if exists("g:plain_mf_macros")
+  echomsg "[mf] g:plain_mf_macros is deprecated: use g:mf_plain_macros instead."
+endif
+if exists("g:plain_mf_modes")
+  echomsg "[mf] g:plain_mf_modes is deprecated: use g:mf_plain_modes instead."
+endif
+if exists("g:other_mf_macros")
+  echomsg "[mf] g:other_mf_macros is deprecated: use g:mf_other_macros instead."
+endif
+
 syn iskeyword @,_
 
-" METAFONT 'primitives' as defined in chapter 25 of 'The METAFONTbook'
-" Page 210: 'boolean expressions'
+# METAFONT 'primitives' as defined in chapter 25 of 'The METAFONTbook'
+# Page 210: 'boolean expressions'
 syn keyword mfBoolExp        and charexists false known not odd or true unknown
 
-" Page 210: 'numeric expression'
+# Page 210: 'numeric expression'
 syn keyword mfNumExp         ASCII angle cosd directiontime floor hex length
 syn keyword mfNumExp         mexp mlog normaldeviate oct sind sqrt totalweight
 syn keyword mfNumExp         turningnumber uniformdeviate xpart xxpart xypart
 syn keyword mfNumExp         ypart yxpart yypart
 
-" Page 211: 'internal quantities'
+# Page 211: 'internal quantities'
 syn keyword mfInternal       autorounding boundarychar charcode chardp chardx
 syn keyword mfInternal       chardy charext charht charic charwd day designsize
 syn keyword mfInternal       fillin fontmaking granularity hppp jobname month
@@ -32,25 +45,25 @@ syn keyword mfInternal       tracingrest
 syn keyword mfInternal       tracingtitles turningcheck vppp warningcheck
 syn keyword mfInternal       xoffset year yoffset
 
-" Page 212: 'pair expressions'
+# Page 212: 'pair expressions'
 syn keyword mfPairExp        of penoffset point postcontrol precontrol rotated
 syn keyword mfPairExp        scaled shifted slanted transformed xscaled yscaled
 syn keyword mfPairExp        zscaled
 
-" Page 213: 'path expressions'
+# Page 213: 'path expressions'
 syn keyword mfPathExp        atleast controls curl cycle makepath reverse
 syn keyword mfPathExp        subpath tension
 
-" Page 214: 'pen expressions'
+# Page 214: 'pen expressions'
 syn keyword mfPenExp         makepen nullpen pencircle
 
-" Page 214: 'picture expressions'
+# Page 214: 'picture expressions'
 syn keyword mfPicExp         nullpicture
 
-" Page 214: 'string expressions'
+# Page 214: 'string expressions'
 syn keyword mfStringExp      char decimal readstring str substring
 
-" Page 217: 'commands and statements'
+# Page 217: 'commands and statements'
 syn keyword mfCommand        addto also at batchmode contour cull delimiters
 syn keyword mfCommand        display doublepath dropping dump end errhelp
 syn keyword mfCommand        errmessage errorstopmode everyjob from interim
@@ -60,36 +73,36 @@ syn keyword mfCommand        save scroll
 syn keyword mfCommand        showstats showtoken showvariable special to withpen
 syn keyword mfCommand        withweight
 
-" Page 56: 'types'
+# Page 56: 'types'
 syn keyword mfType           boolean numeric pair path pen picture string
 syn keyword mfType           transform
 
-" Page 155: 'grouping'
+# Page 155: 'grouping'
 syn keyword mfStatement      begingroup endgroup
 
-" Page 165: 'definitions'
+# Page 165: 'definitions'
 syn keyword mfDefinition     def enddef expr primary primarydef secondary
 syn keyword mfDefinition     secondarydef suffix tertiary tertiarydef text
 syn keyword mfDefinition     vardef
 
-" Page 169: 'conditions and loops'
+# Page 169: 'conditions and loops'
 syn keyword mfCondition      else elseif endfor exitif fi for forever
 syn keyword mfCondition      forsuffixes if step until
 
-" Other primitives listed in the index
+# Other primitives listed in the index
 syn keyword mfPrimitive      charlist endinput expandafter extensible fontdimen
 syn keyword mfPrimitive      headerbyte inner input intersectiontimes kern
 syn keyword mfPrimitive      ligtable quote scantokens skipto
 
-" Implicit suffix parameters
+# Implicit suffix parameters
 syn match   mfSuffixParam    "@#\|#@\|@"
 
-" These are just tags, but given their special status, we
-" highlight them as variables
+# These are just tags, but given their special status, we
+# highlight them as variables
 syn keyword mfVariable       x y
 
-" Keywords defined by plain.mf (defined on pp.262-278)
-if get(g:, "plain_mf_macros", 1)
+# Keywords defined by plain.mf (defined on pp.262-278)
+if get(g:, "mf_plain_macros", get(g:, "plain_mf_macros", 1))
   syn keyword mfDef          addto_currentpicture beginchar capsule_def
   syn keyword mfDef          change_width clear_pen_memory clearit clearpen
   syn keyword mfDef          clearxy culldraw cullit cutdraw
@@ -117,8 +130,8 @@ if get(g:, "plain_mf_macros", 1)
   syn keyword mfVardef       bot byte ceiling counterclockwise cutoff decr dir
   syn keyword mfVardef       direction directionpoint grayfont hround incr
   syn keyword mfVardef       interpath inverse labelfont labels lft magstep
-  " Note: nodot is not a vardef, it is used as in makelabel.lft.nodot("5",z5)
-  " (METAFONT only)
+  # Note: nodot is not a vardef, it is used as in makelabel.lft.nodot("5",z5)
+  # (METAFONT only)
   syn keyword mfVardef       makelabel max min nodot penlabels penpos
   syn keyword mfVardef       proofrulethickness round rt savepen slantfont solve
   syn keyword mfVardef       tensepath titlefont top unitvector vround whatever
@@ -130,24 +143,24 @@ if get(g:, "plain_mf_macros", 1)
   syn keyword mfNewInternal  infinity join_radius number_of_modes o_correction
   syn keyword mfNewInternal  pen_bot pen_lft pen_rt pen_top pixels_per_inch
   syn keyword mfNewInternal  screen_cols screen_rows tolerance
-  " Predefined constants
+  # Predefined constants
   syn keyword mfConstant     base_name base_version blankpicture ditto down
   syn keyword mfConstant     fullcircle halfcircle identity left lowres origin
   syn keyword mfConstant     penspeck proof quartercircle right rulepen smoke
   syn keyword mfConstant     unitpixel unitsquare up
-  " Other predefined variables
+  # Other predefined variables
   syn keyword mfVariable     aspect_ratio currentpen extra_beginchar
   syn keyword mfVariable     extra_endchar currentpen_path currentpicture
   syn keyword mfVariable     currenttransform d extra_setup h localfont mag mode
   syn keyword mfVariable     mode_name w
-  " let statements:
+  # let statements:
   syn keyword mfnumExp       abs
   syn keyword mfPairExp      rotatedabout
   syn keyword mfCommand      bye relax
 endif
 
-" By default, METAFONT loads modes.mf, too
-if get(g:, "plain_mf_modes", 1)
+# By default, METAFONT loads modes.mf, too
+if get(g:, "plain_mf_modes", get(g:, "mf_plain_modes", 1))
   syn keyword mfConstant     APSSixMed AgfaFourZeroZero AgfaThreeFourZeroZero
   syn keyword mfConstant     AtariNineFive AtariNineSix AtariSLMEightZeroFour
   syn keyword mfConstant     AtariSMOneTwoFour CItohEightFiveOneZero
@@ -228,36 +241,36 @@ if get(g:, "plain_mf_modes", 1)
   syn keyword mfNewInternal  blacker_min
 endif
 
-" Some other basic macro names, e.g., from cmbase, logo, etc.
-if get(g:, "other_mf_macros", 1)
+# Some other basic macro names, e.g., from cmbase, logo, etc.
+if get(g:, "mf_other_macros", get(g:, "other_mf_macros", 1))
   syn keyword mfDef          beginlogochar
   syn keyword mfDef          font_setup
   syn keyword mfPrimitive    generate
 endif
 
-" Numeric tokens
+# Numeric tokens
 syn match     mfNumeric      "[-]\=\d\+"
 syn match     mfNumeric      "[-]\=\.\d\+"
 syn match     mfNumeric      "[-]\=\d\+\.\d\+"
 
-" METAFONT lengths
+# METAFONT lengths
 syn match     mfLength       "\<\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\>"
 syn match     mfLength       "[-]\=\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="
 syn match     mfLength       "[-]\=\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="
 syn match     mfLength       "[-]\=\d\+\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="
 
-" String constants
+# String constants
 syn match     mfOpenString   /"[^"]*/
 syn region    mfString       oneline keepend start=+"+ end=+"+
 
-" Comments:
+# Comments:
 syn keyword   mfTodoComment  contained TODO FIXME XXX DEBUG NOTE
 syn match     mfComment      "%.*$" contains=mfTodoComment,@Spell
 
-" synchronizing
-syn sync maxlines=50
+# synchronizing
+syn sync maxlines=100
 
-" Define the default highlighting
+# Define the default highlighting
 hi def link mfBoolExp      Statement
 hi def link mfNumExp       Statement
 hi def link mfPairExp      Statement
@@ -290,6 +303,6 @@ hi def link mfVariable     Identifier
 hi def link mfConstant     Constant
 hi def link mfTodoComment  Todo
 
-let b:current_syntax = "mf"
+b:current_syntax = "mf"
 
-" vim:sw=2
+# vim: sw=2 fdm=marker
--- a/runtime/syntax/mp.vim
+++ b/runtime/syntax/mp.vim
@@ -1,109 +1,106 @@
-" Vim syntax file
-" Language:           MetaPost
-" Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
-" Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com>
-" Last Change:        2016 Oct 14
+vim9script
+
+# Vim syntax file
+# Language:           MetaPost
+# Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
+# Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com>
+# Latest Revision:    2022 Aug 12
 
 if exists("b:current_syntax")
   finish
 endif
 
-let s:cpo_sav = &cpo
-set cpo&vim
-
-if exists("g:plain_mf_macros")
-  let s:plain_mf_macros = g:plain_mf_macros
+# Deprecation warnings: to be removed eventually
+if exists("g:plain_mp_macros")
+  echomsg "[mp] g:plain_mp_macros is deprecated: use g:mp_plain_macros instead."
 endif
-if exists("g:plain_mf_modes")
-  let s:plain_mf_modes = g:plain_mf_modes
+if exists("mfplain_mp_macros")
+  echomsg "[mp] g:mfplain_mp_macros is deprecated: use g:mp_mfplain_macros instead."
 endif
-if exists("g:other_mf_macros")
-  let s:other_mf_macros = g:other_mf_macros
+if exists("other_mp_macros")
+  echomsg "[mp] g:other_mp_macros is deprecated: use g:mp_other_macros instead."
 endif
 
-let g:plain_mf_macros = 0 " plain.mf has no special meaning for MetaPost
-let g:plain_mf_modes  = 0 " No METAFONT modes
-let g:other_mf_macros = 0 " cmbase.mf, logo.mf, ... neither
+# Store the current values of METAFONT global options
+const mf_plain_macros = get(g:, "mf_plain_macros", get(g:, "plain_mf_macros", -1))
+const mf_plain_modes  = get(g:, "mf_plain_modes",  get(g:, "plain_mf_modes",  -1))
+const mf_other_macros = get(g:, "mf_other_macros", get(g:, "other_mf_macros", -1))
 
-" Read the METAFONT syntax to start with
+g:mf_plain_macros = 0 # plain.mf has no special meaning for MetaPost
+g:mf_plain_modes  = 0 # No METAFONT modes
+g:mf_other_macros = 0 # cmbase.mf, logo.mf, ... neither
+
+# Read the METAFONT syntax to start with
 runtime! syntax/mf.vim
-unlet b:current_syntax " Necessary for syn include below
+unlet b:current_syntax # Necessary for syn include below
 
-" Restore the value of existing global variables
-if exists("s:plain_mf_macros")
-  let g:plain_mf_macros = s:plain_mf_macros
+# Restore the value of existing global variables
+if mf_plain_macros == -1
+  unlet g:mf_plain_macros
 else
-  unlet g:plain_mf_macros
+  g:plain_mf_macros = mf_plain_macros
 endif
-if exists("s:plain_mf_modes")
-  let g:plain_mf_modes = s:plain_mf_modes
+if mf_plain_modes == -1
+  unlet g:mf_plain_modes
 else
-  unlet g:plain_mf_modes
+  g:mf_plain_modes = mf_plain_modes
 endif
-if exists("s:other_mf_macros")
-  let g:other_mf_macros = s:other_mf_macros
+if mf_other_macros == -1
+  unlet g:mf_other_macros
 else
-  unlet g:other_mf_macros
+  g:mf_other_macros = mf_other_macros
 endif
 
-" Use TeX highlighting inside verbatimtex/btex... etex
+# Use TeX highlighting inside verbatimtex/btex... etex
 syn include @MPTeX syntax/tex.vim
 unlet b:current_syntax
-" These are defined as keywords rather than using matchgroup
-" in order to make them available to syntaxcomplete.
+# These are defined as keywords rather than using matchgroup
+# in order to make them available to syntaxcomplete.
 syn keyword mpTeXdelim       btex etex verbatimtex contained
-syn region mpTeXinsert
-      \ start=/\<verbatimtex\>\|\<btex\>/rs=e+1
-      \ end=/\<etex\>/re=s-1 keepend
-      \ contains=@MPTeX,mpTeXdelim
+syn region mpTeXinsert matchgroup=mpTeXdelim start=/\<verbatimtex\>\|\<btex\>/ end=/\<etex\>/ keepend contains=@MPTeX,mpTeXdelim
 
-" iskeyword must be set after the syn include above, because tex.vim sets `syn
-" iskeyword`. Note that keywords do not contain numbers (numbers are
-" subscripts)
+# iskeyword must be set after the syn include above, because tex.vim sets `syn
+# iskeyword`. Note that keywords do not contain numbers (numbers are
+# subscripts)
 syntax iskeyword @,_
 
-" MetaPost primitives not found in METAFONT
+# MetaPost primitives not found in METAFONT
 syn keyword mpBoolExp        bounded clipped filled stroked textual arclength
 syn keyword mpNumExp         arctime blackpart bluepart colormodel cyanpart
 syn keyword mpNumExp         fontsize greenpart greypart magentapart redpart
 syn keyword mpPairExp        yellowpart llcorner lrcorner ulcorner urcorner
-" envelope is seemingly undocumented, but it exists since mpost 1.003.
-" The syntax is: envelope <polygonal pen> of <path primary>. For example,
-"     path p;
-"     p := envelope pensquare of (up--left);
-" (Thanks to Daniel H. Luecking for the example!)
 syn keyword mpPathExp        envelope pathpart
 syn keyword mpPenExp         penpart
 syn keyword mpPicExp         dashpart glyph infont
 syn keyword mpStringExp      fontpart readfrom textpart
 syn keyword mpType           cmykcolor color rgbcolor
-" Other MetaPost primitives listed in the manual
+# Other MetaPost primitives listed in the manual
 syn keyword mpPrimitive      mpxbreak within
-" Internal quantities not found in METAFONT
-" (Table 6 in MetaPost: A User's Manual)
+# Internal quantities not found in METAFONT
+# (Table 6 in MetaPost: A User's Manual)
 syn keyword mpInternal       defaultcolormodel hour minute linecap linejoin
 syn keyword mpInternal       miterlimit mpprocset mpversion numberprecision
 syn keyword mpInternal       numbersystem outputfilename outputformat
 syn keyword mpInternal       outputformatoptions outputtemplate prologues
 syn keyword mpInternal       restoreclipcolor tracinglostchars troffmode
 syn keyword mpInternal       truecorners
-" List of commands not found in METAFONT (from MetaPost: A User's Manual)
+# List of commands not found in METAFONT (from MetaPost: A User's Manual)
 syn keyword mpCommand        clip closefrom dashed filenametemplate fontmapfile
 syn keyword mpCommand        fontmapline setbounds withcmykcolor withcolor
 syn keyword mpCommand        withgreyscale withoutcolor withpostscript
 syn keyword mpCommand        withprescript withrgbcolor write
-" METAFONT internal variables not found in MetaPost
+# METAFONT internal variables not found in MetaPost
 syn keyword notDefined       autorounding chardx chardy fillin granularity
 syn keyword notDefined       proofing smoothing tracingedges tracingpens
 syn keyword notDefined       turningcheck xoffset yoffset
-" Suffix defined only in METAFONT:
+# Suffix defined only in METAFONT:
 syn keyword notDefined       nodot
-" Other not implemented primitives (see MetaPost: A User's Manual, §C.1)
+# Other not implemented primitives (see MetaPost: A User's Manual, §C.1)
 syn keyword notDefined       cull display openwindow numspecial totalweight
 syn keyword notDefined       withweight
 
-" Keywords defined by plain.mp
-if get(g:, "plain_mp_macros", 1) || get(g:, "mp_metafun_macros", 0)
+# Keywords defined by plain.mp
+if get(g:, "mp_plain_macros", get(g:, "plain_mp_macros", 1)) || get(b:, "mp_metafun", get(g:, "mp_metafun", 0))
   syn keyword mpDef          beginfig clear_pen_memory clearit clearpen clearpen
   syn keyword mpDef          clearxy colorpart cutdraw downto draw drawarrow
   syn keyword mpDef          drawdblarrow drawdot drawoptions endfig erase
@@ -126,33 +123,30 @@ if get(g:, "plain_mp_macros", 1) || get(
   syn keyword mpNewInternal  defaultscale dotlabeldiam eps epsilon infinity
   syn keyword mpNewInternal  join_radius labeloffset mitered pen_bot pen_lft
   syn keyword mpNewInternal  pen_rt pen_top rounded squared tolerance
-  " Predefined constants
+  # Predefined constants
   syn keyword mpConstant     EOF background base_name base_version black
   syn keyword mpConstant     blankpicture blue ditto down evenly fullcircle
   syn keyword mpConstant     green halfcircle identity left origin penrazor
   syn keyword mpConstant     penspeck pensquare quartercircle red right
   syn keyword mpConstant     unitsquare up white withdots
-  " Other predefined variables
+  # Other predefined variables
   syn keyword mpVariable     currentpen currentpen_path currentpicture cuttings
   syn keyword mpVariable     defaultfont extra_beginfig extra_endfig
-  syn match   mpVariable     /\<\%(laboff\|labxf\|labyf\)\>/
-  syn match   mpVariable     /\<\%(laboff\|labxf\|labyf\)\.\%(lft\|rt\|bot\|top\|ulft\|urt\|llft\|lrt\)\>/
-  " let statements:
+  syn keyword mpVariable     laboff labxf labyf laboff labxf labyf
+  syn match   mpVariable     /\.\%(lft\|rt\|bot\|top\|ulft\|urt\|llft\|lrt\)\>/
+  # let statements:
   syn keyword mpnumExp       abs
   syn keyword mpDef          rotatedabout
   syn keyword mpCommand      bye relax
-  " on and off are not technically keywords, but it is nice to highlight them
-  " inside dashpattern().
+  # on and off are not technically keywords, but it is nice to highlight them
+  # inside dashpattern().
   syn keyword mpOnOff        off on contained
   syn keyword mpDash         dashpattern contained
-  syn region  mpDashPattern
-        \ start="dashpattern\s*"
-        \ end=")"he=e-1
-        \ contains=mfNumeric,mfLength,mpOnOff,mpDash
+  syn region  mpDashPattern start="dashpattern\s*" end=")"he=e-1 contains=mfNumeric,mfLength,mpOnOff,mpDash
 endif
 
-" Keywords defined by mfplain.mp
-if get(g:, "mfplain_mp_macros", 0)
+# Keywords defined by mfplain.mp
+if get(g:, "mp_mfplain_macros", get(g:, "mfplain_mp_macros", 0))
   syn keyword mpDef          beginchar capsule_def change_width
   syn keyword mpDef          define_blacker_pixels define_corrected_pixels
   syn keyword mpDef          define_good_x_pixels define_good_y_pixels
@@ -169,15 +163,15 @@ if get(g:, "mfplain_mp_macros", 0)
   syn keyword mpVardef       hround proofrulethickness vround
   syn keyword mpNewInternal  blacker o_correction
   syn keyword mpVariable     extra_beginchar extra_endchar extra_setup rulepen
-  " plus some no-ops, also from mfplain.mp
+  # plus some no-ops, also from mfplain.mp
   syn keyword mpDef          cull cullit gfcorners imagerules nodisplays
   syn keyword mpDef          notransforms openit proofoffset screenchars
   syn keyword mpDef          screenrule screenstrokes showit
   syn keyword mpVardef       grayfont slantfont titlefont
   syn keyword mpVariable     currenttransform
   syn keyword mpConstant     unitpixel
-  " These are not listed in the MetaPost manual, and some are ignored by
-  " MetaPost, but are nonetheless defined in mfplain.mp
+  # These are not listed in the MetaPost manual, and some are ignored by
+  # MetaPost, but are nonetheless defined in mfplain.mp
   syn keyword mpDef          killtext
   syn match   mpVardef       "\<good\.\%(x\|y\|lft\|rt\|top\|bot\)\>"
   syn keyword mpVariable     aspect_ratio localfont mag mode mode_name
@@ -187,25 +181,25 @@ if get(g:, "mfplain_mp_macros", 0)
   syn keyword mpNewInternal  number_of_modes proofing smoothing turningcheck
 endif
 
-" Keywords defined by all base macro packages:
-" - (r)boxes.mp
-" - format.mp
-" - graph.mp
-" - marith.mp
-" - sarith.mp
-" - string.mp
-" - TEX.mp
-if get(g:, "other_mp_macros", 1)
-  " boxes and rboxes
+# Keywords defined by all base macro packages:
+# - (r)boxes.mp
+# - format.mp
+# - graph.mp
+# - marith.mp
+# - sarith.mp
+# - string.mp
+# - TEX.mp
+if get(g:, "mp_other_macros", get(g:, "other_mp_macros", 1))
+  # boxes and rboxes
   syn keyword mpDef          boxjoin drawboxed drawboxes drawunboxed
   syn keyword mpNewInternal  circmargin defaultdx defaultdy rbox_radius
   syn keyword mpVardef       boxit bpath circleit fixpos fixsize generic_declare
   syn keyword mpVardef       generic_redeclare generisize pic rboxit str_prefix
-  " format
+  # format
   syn keyword mpVardef       Mformat format init_numbers roundd
   syn keyword mpVariable     Fe_base Fe_plus
   syn keyword mpConstant     Ten_to
-  " graph
+  # graph
   syn keyword mpDef          Gfor Gxyscale OUT auto begingraph endgraph gdata
   syn keyword mpDef          gdraw gdrawarrow gdrawdblarrow gfill plot
   syn keyword mpVardef       augment autogrid frame gdotlabel glabel grid itick
@@ -215,528 +209,41 @@ if get(g:, "other_mp_macros", 1)
   syn keyword mpVariable     Autoform Gemarks Glmarks Gumarks
   syn keyword mpConstant     Gtemplate
   syn match   mpVariable     /Gmargin\.\%(low\|high\)/
-  " marith
+  # marith
   syn keyword mpVardef       Mabs Meform Mexp Mexp_str Mlog Mlog_Str Mlog_str
   syn keyword mpPrimaryDef   Mdiv Mmul
   syn keyword mpSecondaryDef Madd Msub
   syn keyword mpTertiaryDef  Mleq
   syn keyword mpNewInternal  Mten Mzero
-  " sarith
+  # sarith
   syn keyword mpVardef       Sabs Scvnum
   syn keyword mpPrimaryDef   Sdiv Smul
   syn keyword mpSecondaryDef Sadd Ssub
   syn keyword mpTertiaryDef  Sleq Sneq
-  " string
+  # string
   syn keyword mpVardef       cspan isdigit loptok
-  " TEX
+  # TEX
   syn keyword mpVardef       TEX TEXPOST TEXPRE
 endif
 
-" Up to date as of 23-Sep-2016.
-if get(b:, 'mp_metafun_macros', get(g:, 'mp_metafun_macros', 0))
-  " Highlight TeX keywords (for use in ConTeXt documents)
+if get(b:, "mp_metafun", get(g:, "mp_metafun", 0))
+  # MetaFun additions to MetaPost base file
+  syn keyword mpConstant cyan magenta yellow
+  syn keyword mpConstant penspec
+  syn keyword mpNumExp   graypart greycolor graycolor
+
+  # Highlight TeX keywords (for MetaPost embedded in ConTeXt documents)
   syn match   mpTeXKeyword  '\\[a-zA-Z@]\+'
 
-  " These keywords have been added manually.
   syn keyword mpPrimitive runscript
 
-  " The following MetaFun keywords have been extracted automatically from
-  " ConTeXt source code. They include all "public" macros (where a macro is
-  " considered public if and only if it does not start with _, mfun_, mlib_, or
-  " do_, and it does not end with _), all "public" unsaved variables, and all
-  " `let` statements.
+  runtime! syntax/shared/context-data-metafun.vim
 
-  " mp-abck.mpiv
-  syn keyword mpDef          abck_grid_line anchor_box box_found boxfilloptions
-  syn keyword mpDef          boxgridoptions boxlineoptions draw_multi_pars
-  syn keyword mpDef          draw_multi_side draw_multi_side_path freeze_box
-  syn keyword mpDef          initialize_box initialize_box_pos
-  syn keyword mpDef          multi_side_draw_options show_multi_kind
-  syn keyword mpDef          show_multi_pars
-  syn keyword mpVardef       abck_baseline_grid abck_draw_path abck_graphic_grid
-  syn keyword mpVariable     boxdashtype boxfilloffset boxfilltype
-  syn keyword mpVariable     boxgriddirection boxgriddistance boxgridshift
-  syn keyword mpVariable     boxgridtype boxgridwidth boxlineoffset
-  syn keyword mpVariable     boxlineradius boxlinetype boxlinewidth multikind
-  syn keyword mpConstant     context_abck
-  " mp-apos.mpiv
-  syn keyword mpDef          anch_sidebars_draw boxfilloptions boxlineoptions
-  syn keyword mpDef          connect_positions
-  syn keyword mpConstant     context_apos
-  " mp-asnc.mpiv
-  syn keyword mpDef          FlushSyncTasks ProcessSyncTask ResetSyncTasks
-  syn keyword mpDef          SetSyncColor SetSyncThreshold SyncTask
-  syn keyword mpVardef       PrepareSyncTasks SyncBox TheSyncColor
-  syn keyword mpVardef       TheSyncThreshold
-  syn keyword mpVariable     CurrentSyncClass NOfSyncPaths SyncColor
-  syn keyword mpVariable     SyncLeftOffset SyncPaths SyncTasks SyncThreshold
-  syn keyword mpVariable     SyncThresholdMethod SyncWidth
-  syn keyword mpConstant     context_asnc
-  " mp-back.mpiv
-  syn keyword mpDef          some_double_back some_hash
-  syn keyword mpVariable     back_nillcolor
-  syn keyword mpConstant     context_back
-  " mp-bare.mpiv
-  syn keyword mpVardef       colordecimals rawtextext
-  syn keyword mpPrimaryDef   infont
-  syn keyword mpConstant     context_bare
-  " mp-base.mpiv
-  " This is essentially plain.mp with only a few keywords added
-  syn keyword mpNumExp       graypart
-  syn keyword mpType         graycolor greycolor
-  syn keyword mpConstant     cyan magenta yellow
-  " mp-butt.mpiv
-  syn keyword mpDef          predefinedbutton some_button
-  syn keyword mpConstant     context_butt
-  " mp-char.mpiv
-  syn keyword mpDef          flow_begin_chart flow_begin_sub_chart
-  syn keyword mpDef          flow_chart_draw_comment flow_chart_draw_exit
-  syn keyword mpDef          flow_chart_draw_label flow_chart_draw_text
-  syn keyword mpDef          flow_clip_chart flow_collapse_points
-  syn keyword mpDef          flow_connect_bottom_bottom flow_connect_bottom_left
-  syn keyword mpDef          flow_connect_bottom_right flow_connect_bottom_top
-  syn keyword mpDef          flow_connect_left_bottom flow_connect_left_left
-  syn keyword mpDef          flow_connect_left_right flow_connect_left_top
-  syn keyword mpDef          flow_connect_right_bottom flow_connect_right_left
-  syn keyword mpDef          flow_connect_right_right flow_connect_right_top
-  syn keyword mpDef          flow_connect_top_bottom flow_connect_top_left
-  syn keyword mpDef          flow_connect_top_right flow_connect_top_top
-  syn keyword mpDef          flow_draw_connection flow_draw_connection_point
-  syn keyword mpDef          flow_draw_midpoint flow_draw_shape
-  syn keyword mpDef          flow_draw_test_area flow_draw_test_shape
-  syn keyword mpDef          flow_draw_test_shapes flow_end_chart
-  syn keyword mpDef          flow_end_sub_chart flow_flush_connections
-  syn keyword mpDef          flow_flush_picture flow_flush_pictures
-  syn keyword mpDef          flow_flush_shape flow_flush_shapes
-  syn keyword mpDef          flow_initialize_grid flow_new_chart flow_new_shape
-  syn keyword mpDef          flow_scaled_to_grid flow_show_connection
-  syn keyword mpDef          flow_show_connections flow_show_shapes
-  syn keyword mpDef          flow_xy_offset flow_y_pos
-  syn keyword mpVardef       flow_connection_path flow_down_on_grid
-  syn keyword mpVardef       flow_down_to_grid flow_i_point flow_left_on_grid
-  syn keyword mpVardef       flow_left_to_grid flow_offset
-  syn keyword mpVardef       flow_points_initialized flow_right_on_grid
-  syn keyword mpVardef       flow_right_to_grid flow_smooth_connection
-  syn keyword mpVardef       flow_trim_points flow_trimmed flow_up_on_grid
-  syn keyword mpVardef       flow_up_to_grid flow_valid_connection
-  syn keyword mpVardef       flow_x_on_grid flow_xy_bottom flow_xy_left
-  syn keyword mpVardef       flow_xy_on_grid flow_xy_right flow_xy_top
-  syn keyword mpVardef       flow_y_on_grid
-  syn keyword mpVariable     flow_arrowtip flow_chart_background_color
-  syn keyword mpVariable     flow_chart_offset flow_comment_offset
-  syn keyword mpVariable     flow_connection_arrow_size
-  syn keyword mpVariable     flow_connection_dash_size
-  syn keyword mpVariable     flow_connection_line_color
-  syn keyword mpVariable     flow_connection_line_width
-  syn keyword mpVariable     flow_connection_smooth_size flow_connections
-  syn keyword mpVariable     flow_cpath flow_dash_pattern flow_dashline
-  syn keyword mpVariable     flow_exit_offset flow_forcevalid flow_grid_height
-  syn keyword mpVariable     flow_grid_width flow_label_offset flow_max_x
-  syn keyword mpVariable     flow_max_y flow_peepshape flow_reverse_connection
-  syn keyword mpVariable     flow_reverse_y flow_shape_action flow_shape_archive
-  syn keyword mpVariable     flow_shape_decision flow_shape_down
-  syn keyword mpVariable     flow_shape_fill_color flow_shape_height
-  syn keyword mpVariable     flow_shape_left flow_shape_line_color
-  syn keyword mpVariable     flow_shape_line_width flow_shape_loop
-  syn keyword mpVariable     flow_shape_multidocument flow_shape_node
-  syn keyword mpVariable     flow_shape_procedure flow_shape_product
-  syn keyword mpVariable     flow_shape_right flow_shape_singledocument
-  syn keyword mpVariable     flow_shape_subprocedure flow_shape_up
-  syn keyword mpVariable     flow_shape_wait flow_shape_width
-  syn keyword mpVariable     flow_show_all_points flow_show_con_points
-  syn keyword mpVariable     flow_show_mid_points flow_showcrossing flow_smooth
-  syn keyword mpVariable     flow_touchshape flow_xypoint flow_zfactor
-  syn keyword mpConstant     context_flow
-  " mp-chem.mpiv
-  syn keyword mpDef          chem_init_all chem_reset chem_start_structure
-  syn keyword mpDef          chem_transformed
-  syn keyword mpVardef       chem_ad chem_adj chem_align chem_arrow chem_au
-  syn keyword mpVardef       chem_b chem_bb chem_bd chem_bw chem_c chem_cc
-  syn keyword mpVardef       chem_ccd chem_cd chem_crz chem_cz chem_dash chem_db
-  syn keyword mpVardef       chem_diff chem_dir chem_do chem_dr chem_draw
-  syn keyword mpVardef       chem_drawarrow chem_eb chem_ed chem_ep chem_er
-  syn keyword mpVardef       chem_es chem_et chem_fill chem_hb chem_init_some
-  syn keyword mpVardef       chem_label chem_ldb chem_ldd chem_line chem_lr
-  syn keyword mpVardef       chem_lrb chem_lrbd chem_lrd chem_lrh chem_lrn
-  syn keyword mpVardef       chem_lrt chem_lrz chem_lsr chem_lsub chem_mark
-  syn keyword mpVardef       chem_marked chem_mid chem_mids chem_midz chem_mir
-  syn keyword mpVardef       chem_mov chem_move chem_number chem_oe chem_off
-  syn keyword mpVardef       chem_pb chem_pe chem_r chem_r_fragment chem_rb
-  syn keyword mpVardef       chem_rbd chem_rd chem_rdb chem_rdd chem_restore
-  syn keyword mpVardef       chem_rh chem_rm chem_rn chem_rot chem_rr chem_rrb
-  syn keyword mpVardef       chem_rrbd chem_rrd chem_rrh chem_rrn chem_rrt
-  syn keyword mpVardef       chem_rrz chem_rsr chem_rsub chem_rt chem_rz chem_s
-  syn keyword mpVardef       chem_save chem_sb chem_sd chem_set chem_sr chem_ss
-  syn keyword mpVardef       chem_start_component chem_stop_component
-  syn keyword mpVardef       chem_stop_structure chem_sub chem_symbol chem_tb
-  syn keyword mpVardef       chem_text chem_z chem_zln chem_zlt chem_zn chem_zrn
-  syn keyword mpVardef       chem_zrt chem_zt
-  syn keyword mpVariable     chem_mark_pair chem_stack_mirror chem_stack_origin
-  syn keyword mpVariable     chem_stack_p chem_stack_previous
-  syn keyword mpVariable     chem_stack_rotation chem_trace_boundingbox
-  syn keyword mpVariable     chem_trace_nesting chem_trace_text
-  syn keyword mpConstant     context_chem
-  " mp-core.mpiv
-  syn keyword mpDef          FlushSyncTasks ProcessSyncTask
-  syn keyword mpDef          RegisterLocalTextArea RegisterPlainTextArea
-  syn keyword mpDef          RegisterRegionTextArea RegisterTextArea
-  syn keyword mpDef          ResetLocalTextArea ResetSyncTasks ResetTextAreas
-  syn keyword mpDef          SaveTextAreas SetSyncColor SetSyncThreshold
-  syn keyword mpDef          SyncTask anchor_box box_found boxfilloptions
-  syn keyword mpDef          boxgridoptions boxlineoptions collapse_multi_pars
-  syn keyword mpDef          draw_box draw_multi_pars draw_par freeze_box
-  syn keyword mpDef          initialize_area initialize_area_par initialize_box
-  syn keyword mpDef          initialize_box_pos initialize_par
-  syn keyword mpDef          prepare_multi_pars relocate_multipars save_multipar
-  syn keyword mpDef          set_par_line_height show_multi_pars show_par
-  syn keyword mpDef          simplify_multi_pars sort_multi_pars
-  syn keyword mpVardef       InsideSavedTextArea InsideSomeSavedTextArea
-  syn keyword mpVardef       InsideSomeTextArea InsideTextArea PrepareSyncTasks
-  syn keyword mpVardef       SyncBox TextAreaH TextAreaW TextAreaWH TextAreaX
-  syn keyword mpVardef       TextAreaXY TextAreaY TheSyncColor TheSyncThreshold
-  syn keyword mpVardef       baseline_grid graphic_grid multi_par_at_top
-  syn keyword mpVariable     CurrentSyncClass NOfSavedTextAreas
-  syn keyword mpVariable     NOfSavedTextColumns NOfSyncPaths NOfTextAreas
-  syn keyword mpVariable     NOfTextColumns PlainTextArea RegionTextArea
-  syn keyword mpVariable     SavedTextColumns SyncColor SyncLeftOffset SyncPaths
-  syn keyword mpVariable     SyncTasks SyncThreshold SyncThresholdMethod
-  syn keyword mpVariable     SyncWidth TextAreas TextColumns
-  syn keyword mpVariable     auto_multi_par_hsize boxdashtype boxfilloffset
-  syn keyword mpVariable     boxfilltype boxgriddirection boxgriddistance
-  syn keyword mpVariable     boxgridshift boxgridtype boxgridwidth boxlineradius
-  syn keyword mpVariable     boxlinetype boxlinewidth check_multi_par_chain
-  syn keyword mpVariable     compensate_multi_par_topskip
-  syn keyword mpVariable     enable_multi_par_fallback force_multi_par_chain
-  syn keyword mpVariable     ignore_multi_par_page last_multi_par_shift lefthang
-  syn keyword mpVariable     local_multi_par_area multi_column_first_page_hack
-  syn keyword mpVariable     multi_par_pages multiloc multilocs multipar
-  syn keyword mpVariable     multipars multiref multirefs nofmultipars
-  syn keyword mpVariable     obey_multi_par_hang obey_multi_par_more
-  syn keyword mpVariable     one_piece_multi_par par_hang_after par_hang_indent
-  syn keyword mpVariable     par_indent par_left_skip par_line_height
-  syn keyword mpVariable     par_right_skip par_start_pos par_stop_pos
-  syn keyword mpVariable     par_strut_depth par_strut_height ppos righthang
-  syn keyword mpVariable     snap_multi_par_tops somehang span_multi_column_pars
-  syn keyword mpVariable     use_multi_par_region
-  syn keyword mpConstant     context_core
-  syn keyword LET            anchor_area anchor_par draw_area
-  " mp-cows.mpiv
-  syn keyword mpConstant     context_cows cow
-  " mp-crop.mpiv
-  syn keyword mpDef          page_marks_add_color page_marks_add_lines
-  syn keyword mpDef          page_marks_add_marking page_marks_add_number
-  syn keyword mpVardef       crop_color crop_gray crop_marks_cmyk
-  syn keyword mpVardef       crop_marks_cmykrgb crop_marks_gray crop_marks_lines
-  syn keyword mpVariable     crop_colors more page
-  syn keyword mpConstant     context_crop
-  " mp-figs.mpiv
-  syn keyword mpDef          naturalfigure registerfigure
-  syn keyword mpVardef       figuredimensions figureheight figuresize
-  syn keyword mpVardef       figurewidth
-  syn keyword mpConstant     context_figs
-  " mp-fobg.mpiv
-  syn keyword mpDef          DrawFoFrame
-  syn keyword mpVardef       equalpaths
-  syn keyword mpPrimaryDef   inset outset
-  syn keyword mpVariable     FoBackground FoBackgroundColor FoFrame FoLineColor
-  syn keyword mpVariable     FoLineStyle FoLineWidth FoSplit
-  syn keyword mpConstant     FoAll FoBottom FoDash FoDotted FoDouble FoGroove
-  syn keyword mpConstant     FoHidden FoInset FoLeft FoMedium FoNoColor FoNone
-  syn keyword mpConstant     FoOutset FoRidge FoRight FoSolid FoThick FoThin
-  syn keyword mpConstant     FoTop context_fobg
-  " mp-form.mpiv
-  syn keyword mpConstant     context_form
-  " mp-func.mpiv
-  syn keyword mpDef          constructedfunction constructedpairs
-  syn keyword mpDef          constructedpath curvedfunction curvedpairs
-  syn keyword mpDef          curvedpath function pathconnectors straightfunction
-  syn keyword mpDef          straightpairs straightpath
-  syn keyword mpConstant     context_func
-  " mp-grap.mpiv
-  syn keyword mpDef          Gfor OUT auto begingraph circles crosses diamonds
-  syn keyword mpDef          downtriangles endgraph gdata gdraw gdrawarrow
-  syn keyword mpDef          gdrawdblarrow gfill graph_addto
-  syn keyword mpDef          graph_addto_currentpicture graph_comma
-  syn keyword mpDef          graph_coordinate_multiplication graph_draw
-  syn keyword mpDef          graph_draw_label graph_errorbar_text graph_fill
-  syn keyword mpDef          graph_generate_exponents
-  syn keyword mpDef          graph_generate_label_position
-  syn keyword mpDef          graph_generate_numbers graph_label_location
-  syn keyword mpDef          graph_scan_mark graph_scan_marks graph_setbounds
-  syn keyword mpDef          graph_suffix graph_tick_label
-  syn keyword mpDef          graph_with_pen_and_color graph_withlist
-  syn keyword mpDef          graph_xyscale lefttriangles makefunctionpath plot
-  syn keyword mpDef          plotsymbol points rainbow righttriangles smoothpath
-  syn keyword mpDef          squares stars uptriangles witherrorbars
-  syn keyword mpVardef       addtopath augment autogrid constant_fit
-  syn keyword mpVardef       constant_function det escaped_format exp
-  syn keyword mpVardef       exponential_fit exponential_function format
-  syn keyword mpVardef       formatted frame functionpath gaussian_fit
-  syn keyword mpVardef       gaussian_function gdotlabel glabel graph_Feform
-  syn keyword mpVardef       graph_Meform graph_arrowhead_extent graph_bounds
-  syn keyword mpVardef       graph_clear_bounds
-  syn keyword mpVardef       graph_convert_user_path_to_internal graph_cspan
-  syn keyword mpVardef       graph_draw_arrowhead graph_error graph_errorbars
-  syn keyword mpVardef       graph_exp graph_factor_and_exponent_to_string
-  syn keyword mpVardef       graph_gridline_picture graph_is_null
-  syn keyword mpVardef       graph_label_convert_user_to_internal graph_loptok
-  syn keyword mpVardef       graph_match_exponents graph_mlog
-  syn keyword mpVardef       graph_modified_exponent_ypart graph_pair_adjust
-  syn keyword mpVardef       graph_picture_conversion graph_post_draw
-  syn keyword mpVardef       graph_read_line graph_readpath graph_remap
-  syn keyword mpVardef       graph_scan_path graph_select_exponent_mark
-  syn keyword mpVardef       graph_select_mark graph_set_bounds
-  syn keyword mpVardef       graph_set_default_bounds graph_shapesize
-  syn keyword mpVardef       graph_stash_label graph_tick_mark_spacing
-  syn keyword mpVardef       graph_unknown_pair_bbox grid isdigit itick
-  syn keyword mpVardef       linear_fit linear_function ln logten lorentzian_fit
-  syn keyword mpVardef       lorentzian_function otick polynomial_fit
-  syn keyword mpVardef       polynomial_function power_law_fit
-  syn keyword mpVardef       power_law_function powten setcoords setrange
-  syn keyword mpVardef       sortpath strfmt tick varfmt
-  syn keyword mpNewInternal  Mzero doubleinfinity graph_log_minimum
-  syn keyword mpNewInternal  graph_minimum_number_of_marks largestmantissa
-  syn keyword mpNewInternal  linear lntwo log mlogten singleinfinity
-  syn keyword mpVariable     Autoform determinant fit_chi_squared
-  syn keyword mpVariable     graph_errorbar_picture graph_exp_marks
-  syn keyword mpVariable     graph_frame_pair_a graph_frame_pair_b
-  syn keyword mpVariable     graph_lin_marks graph_log_marks graph_modified_bias
-  syn keyword mpVariable     graph_modified_higher graph_modified_lower
-  syn keyword mpVariable     graph_shape r_s resistance_color resistance_name
-  syn keyword mpConstant     context_grap
-  " mp-grid.mpiv
-  syn keyword mpDef          hlingrid hloggrid vlingrid vloggrid
-  syn keyword mpVardef       hlinlabel hlintext hlogtext linlin linlinpath
-  syn keyword mpVardef       linlog linlogpath loglin loglinpath loglog
-  syn keyword mpVardef       loglogpath processpath vlinlabel vlintext vlogtext
-  syn keyword mpVariable     fmt_initialize fmt_pictures fmt_precision
-  syn keyword mpVariable     fmt_separator fmt_zerocheck grid_eps
-  syn keyword mpConstant     context_grid
-  " mp-grph.mpiv
-  syn keyword mpDef          beginfig begingraphictextfig data_mpo_file
-  syn keyword mpDef          data_mpy_file doloadfigure draw endfig
-  syn keyword mpDef          endgraphictextfig fill fixedplace graphictext
-  syn keyword mpDef          loadfigure new_graphictext normalwithshade number
-  syn keyword mpDef          old_graphictext outlinefill protectgraphicmacros
-  syn keyword mpDef          resetfig reversefill withdrawcolor withfillcolor
-  syn keyword mpDef          withshade
-  syn keyword mpVariable     currentgraphictext figureshift
-  syn keyword mpConstant     context_grph
-  " mp-idea.mpiv
-  syn keyword mpVardef       bcomponent ccomponent gcomponent mcomponent
-  syn keyword mpVardef       rcomponent somecolor ycomponent
-  " mp-luas.mpiv
-  syn keyword mpDef          luacall message
-  syn keyword mpVardef       MP lua lualist
-  syn keyword mpConstant     context_luas
-  " mp-mlib.mpiv
-  syn keyword mpDef          autoalign bitmapimage circular_shade cmyk comment
-  syn keyword mpDef          defineshade eofill eofillup externalfigure figure
-  syn keyword mpDef          fillup label linear_shade multitonecolor namedcolor
-  syn keyword mpDef          nofill onlayer passarrayvariable passvariable
-  syn keyword mpDef          plain_label register resolvedcolor scantokens
-  syn keyword mpDef          set_circular_vector set_linear_vector shaded
-  syn keyword mpDef          spotcolor startpassingvariable stoppassingvariable
-  syn keyword mpDef          thelabel transparent[] usemetafunlabels
-  syn keyword mpDef          useplainlabels withcircularshade withlinearshade
-  syn keyword mpDef          withmask withproperties withshadecenter
-  syn keyword mpDef          withshadecolors withshadedirection withshadedomain
-  syn keyword mpDef          withshadefactor withshadefraction withshadeorigin
-  syn keyword mpDef          withshaderadius withshadestep withshadetransform
-  syn keyword mpDef          withshadevector withtransparency
-  syn keyword mpVardef       anchored checkbounds checkedbounds
-  syn keyword mpVardef       define_circular_shade define_linear_shade dotlabel
-  syn keyword mpVardef       escaped_format fmttext fontsize format formatted
-  syn keyword mpVardef       installlabel onetimefmttext onetimetextext
-  syn keyword mpVardef       outlinetext plain_thelabel properties rawfmttext
-  syn keyword mpVardef       rawtexbox rawtextext rule strfmt strut texbox
-  syn keyword mpVardef       textext thefmttext thelabel thetexbox thetextext
-  syn keyword mpVardef       tostring transparency_alternative_to_number
-  syn keyword mpVardef       validtexbox varfmt verbatim
-  syn keyword mpPrimaryDef   asgroup infont normalinfont shadedinto
-  syn keyword mpPrimaryDef   shownshadecenter shownshadedirection
-  syn keyword mpPrimaryDef   shownshadeorigin shownshadevector withshade
-  syn keyword mpPrimaryDef   withshademethod
-  syn keyword mpNewInternal  colorburntransparent colordodgetransparent
-  syn keyword mpNewInternal  colortransparent darkentransparent
-  syn keyword mpNewInternal  differencetransparent exclusiontransparent
-  syn keyword mpNewInternal  hardlighttransparent huetransparent
-  syn keyword mpNewInternal  lightentransparent luminositytransparent
-  syn keyword mpNewInternal  multiplytransparent normaltransparent
-  syn keyword mpNewInternal  overlaytransparent saturationtransparent
-  syn keyword mpNewInternal  screentransparent shadefactor softlighttransparent
-  syn keyword mpNewInternal  textextoffset
-  syn keyword mpType         property transparency
-  syn keyword mpVariable     currentoutlinetext shadeddown shadedleft
-  syn keyword mpVariable     shadedright shadedup shadeoffset trace_shades
-  syn keyword mpConstant     context_mlib
-  " mp-page.mpiv
-  syn keyword mpDef          BoundCoverAreas BoundPageAreas Enlarged FakeRule
-  syn keyword mpDef          FakeWord LoadPageState OverlayBox RuleColor
-  syn keyword mpDef          SetAreaVariables SetPageArea SetPageBackPage
-  syn keyword mpDef          SetPageCoverPage SetPageField SetPageFrontPage
-  syn keyword mpDef          SetPageHsize SetPageHstep SetPageLocation
-  syn keyword mpDef          SetPagePage SetPageSpine SetPageVariables
-  syn keyword mpDef          SetPageVsize SetPageVstep StartCover StartPage
-  syn keyword mpDef          StopCover StopPage SwapPageState innerenlarged
-  syn keyword mpDef          llEnlarged lrEnlarged outerenlarged ulEnlarged
-  syn keyword mpDef          urEnlarged
-  syn keyword mpVardef       BackPageHeight BackPageWidth BackSpace BaseLineSkip
-  syn keyword mpVardef       BodyFontSize BottomDistance BottomHeight
-  syn keyword mpVardef       BottomSpace CoverHeight CoverWidth CurrentColumn
-  syn keyword mpVardef       CurrentHeight CurrentWidth CutSpace EmWidth
-  syn keyword mpVardef       ExHeight FooterDistance FooterHeight
-  syn keyword mpVardef       FrontPageHeight FrontPageWidth HSize HeaderDistance
-  syn keyword mpVardef       HeaderHeight InPageBody InnerEdgeDistance
-  syn keyword mpVardef       InnerEdgeWidth InnerMarginDistance InnerMarginWidth
-  syn keyword mpVardef       InnerSpaceWidth LastPageNumber LayoutColumnDistance
-  syn keyword mpVardef       LayoutColumnWidth LayoutColumns LeftEdgeDistance
-  syn keyword mpVardef       LeftEdgeWidth LeftMarginDistance LeftMarginWidth
-  syn keyword mpVardef       LineHeight MakeupHeight MakeupWidth NOfColumns
-  syn keyword mpVardef       NOfPages OnOddPage OnRightPage OuterEdgeDistance
-  syn keyword mpVardef       OuterEdgeWidth OuterMarginDistance OuterMarginWidth
-  syn keyword mpVardef       OuterSpaceWidth OverlayDepth OverlayHeight
-  syn keyword mpVardef       OverlayLineWidth OverlayOffset OverlayWidth
-  syn keyword mpVardef       PageDepth PageFraction PageNumber PageOffset
-  syn keyword mpVardef       PaperBleed PaperHeight PaperWidth PrintPaperHeight
-  syn keyword mpVardef       PrintPaperWidth RealPageNumber RightEdgeDistance
-  syn keyword mpVardef       RightEdgeWidth RightMarginDistance RightMarginWidth
-  syn keyword mpVardef       SpineHeight SpineWidth StrutDepth StrutHeight
-  syn keyword mpVardef       TextHeight TextWidth TopDistance TopHeight TopSkip
-  syn keyword mpVardef       TopSpace VSize defaultcolormodel
-  syn keyword mpVariable     Area BackPage CoverPage CurrentLayout Field
-  syn keyword mpVariable     FrontPage HorPos Hsize Hstep Location Page
-  syn keyword mpVariable     PageStateAvailable RuleDepth RuleDirection
-  syn keyword mpVariable     RuleFactor RuleH RuleHeight RuleOffset RuleOption
-  syn keyword mpVariable     RuleThickness RuleV RuleWidth Spine VerPos Vsize
-  syn keyword mpVariable     Vstep
-  syn keyword mpConstant     context_page
-  " mp-shap.mpiv
-  syn keyword mpDef          drawline drawshape some_shape
-  syn keyword mpDef          start_predefined_shape_definition
-  syn keyword mpDef          stop_predefined_shape_definition
-  syn keyword mpVardef       drawpredefinedline drawpredefinedshape
-  syn keyword mpVardef       some_shape_path
-  syn keyword mpVariable     predefined_shapes predefined_shapes_xradius
-  syn keyword mpVariable     predefined_shapes_xxradius
-  syn keyword mpVariable     predefined_shapes_yradius
-  syn keyword mpVariable     predefined_shapes_yyradius
-  syn keyword mpConstant     context_shap
-  " mp-step.mpiv
-  syn keyword mpDef          initialize_step_variables midbottomboundary
-  syn keyword mpDef          midtopboundary step_begin_cell step_begin_chart
-  syn keyword mpDef          step_cell_ali step_cell_bot step_cell_top
-  syn keyword mpDef          step_cells step_end_cell step_end_chart
-  syn keyword mpDef          step_text_bot step_text_mid step_text_top
-  syn keyword mpDef          step_texts
-  syn keyword mpVariable     cell_distance_x cell_distance_y cell_fill_color
-  syn keyword mpVariable     cell_line_color cell_line_width cell_offset
-  syn keyword mpVariable     chart_align chart_category chart_vertical
-  syn keyword mpVariable     line_distance line_height line_line_color
-  syn keyword mpVariable     line_line_width line_offset nofcells
-  syn keyword mpVariable     text_distance_set text_fill_color text_line_color
-  syn keyword mpVariable     text_line_width text_offset
-  syn keyword mpConstant     context_cell
-  " mp-symb.mpiv
-  syn keyword mpDef          finishglyph prepareglyph
-  syn keyword mpConstant     lefttriangle midbar onebar righttriangle sidebar
-  syn keyword mpConstant     sublefttriangle subrighttriangle twobar
-  " mp-text.mpiv
-  syn keyword mpDef          build_parshape
-  syn keyword mpVardef       found_point
-  syn keyword mpVariable     trace_parshape
-  syn keyword mpConstant     context_text
-  " mp-tool.mpiv
-  syn keyword mpCommand      dump
-  syn keyword mpDef          addbackground b_color beginglyph break centerarrow
-  syn keyword mpDef          clearxy condition data_mpd_file detaileddraw
-  syn keyword mpDef          detailpaths dowithpath draw drawboundary
-  syn keyword mpDef          drawboundingbox drawcontrollines drawcontrolpoints
-  syn keyword mpDef          drawfill draworigin drawpath drawpathonly
-  syn keyword mpDef          drawpathwithpoints drawpoint drawpointlabels
-  syn keyword mpDef          drawpoints drawticks drawwholepath drawxticks
-  syn keyword mpDef          drawyticks endglyph fill finishsavingdata g_color
-  syn keyword mpDef          inner_boundingbox job_name leftarrow loadmodule
-  syn keyword mpDef          midarrowhead naturalizepaths newboolean newcolor
-  syn keyword mpDef          newnumeric newpair newpath newpicture newstring
-  syn keyword mpDef          newtransform normalcolors normaldraw normalfill
-  syn keyword mpDef          normalwithcolor outer_boundingbox pop_boundingbox
-  syn keyword mpDef          popboundingbox popcurrentpicture push_boundingbox
-  syn keyword mpDef          pushboundingbox pushcurrentpicture r_color readfile
-  syn keyword mpDef          recolor redraw refill register_dirty_chars
-  syn keyword mpDef          remapcolor remapcolors remappedcolor reprocess
-  syn keyword mpDef          resetarrows resetcolormap resetdrawoptions
-  syn keyword mpDef          resolvedcolor restroke retext rightarrow savedata
-  syn keyword mpDef          saveoptions scale_currentpicture set_ahlength
-  syn keyword mpDef          set_grid showgrid startplaincompatibility
-  syn keyword mpDef          startsavingdata stopplaincompatibility
-  syn keyword mpDef          stopsavingdata stripe_path_a stripe_path_n undashed
-  syn keyword mpDef          undrawfill untext visualizeddraw visualizedfill
-  syn keyword mpDef          visualizepaths withcolor withgray
-  syn keyword mpDef          xscale_currentpicture xshifted
-  syn keyword mpDef          xyscale_currentpicture yscale_currentpicture
-  syn keyword mpDef          yshifted
-  syn keyword mpVardef       acos acosh anglebetween area arrowhead
-  syn keyword mpVardef       arrowheadonpath arrowpath asciistring asin asinh
-  syn keyword mpVardef       atan basiccolors bbheight bbwidth bcomponent
-  syn keyword mpVardef       blackcolor bottomboundary boundingbox c_phantom
-  syn keyword mpVardef       ccomponent center cleanstring colorcircle
-  syn keyword mpVardef       colordecimals colordecimalslist colorlike colorpart
-  syn keyword mpVardef       colortype complementary complemented copylist cos
-  syn keyword mpVardef       cosh cot cotd curved ddddecimal dddecimal ddecimal
-  syn keyword mpVardef       decorated drawarrowpath epsed exp freedotlabel
-  syn keyword mpVardef       freelabel gcomponent getunstringed grayed greyed
-  syn keyword mpVardef       hsvtorgb infinite innerboundingbox interpolated inv
-  syn keyword mpVardef       invcos inverted invsin invtan laddered leftboundary
-  syn keyword mpVardef       leftpath leftrightpath listsize listtocurves
-  syn keyword mpVardef       listtolines ln log mcomponent new_on_grid
-  syn keyword mpVardef       outerboundingbox paired pen_size penpoint phantom
-  syn keyword mpVardef       pointarrow pow punked rangepath rcomponent
-  syn keyword mpVardef       redecorated repathed rightboundary rightpath
-  syn keyword mpVardef       rotation roundedsquare set_inner_boundingbox
-  syn keyword mpVardef       set_outer_boundingbox setunstringed shapedlist
-  syn keyword mpVardef       simplified sin sinh sortlist sqr straightpath tan
-  syn keyword mpVardef       tand tanh tensecircle thefreelabel topboundary
-  syn keyword mpVardef       tripled undecorated unitvector unspiked unstringed
-  syn keyword mpVardef       whitecolor ycomponent
-  syn keyword mpPrimaryDef   along blownup bottomenlarged cornered crossed
-  syn keyword mpPrimaryDef   enlarged enlonged leftenlarged llenlarged llmoved
-  syn keyword mpPrimaryDef   lrenlarged lrmoved on paralleled randomized
-  syn keyword mpPrimaryDef   randomizedcontrols randomshifted rightenlarged
-  syn keyword mpPrimaryDef   shortened sized smoothed snapped softened squeezed
-  syn keyword mpPrimaryDef   stretched superellipsed topenlarged ulenlarged
-  syn keyword mpPrimaryDef   ulmoved uncolored urenlarged urmoved xsized
-  syn keyword mpPrimaryDef   xstretched xyscaled xysized ysized ystretched zmod
-  syn keyword mpSecondaryDef anglestriped intersection_point numberstriped
-  syn keyword mpSecondaryDef peepholed
-  syn keyword mpTertiaryDef  cutends
-  syn keyword mpNewInternal  ahdimple ahvariant anglelength anglemethod
-  syn keyword mpNewInternal  angleoffset charscale cmykcolormodel graycolormodel
-  syn keyword mpNewInternal  greycolormodel maxdimensions metapostversion
-  syn keyword mpNewInternal  nocolormodel rgbcolormodel striped_normal_inner
-  syn keyword mpNewInternal  striped_normal_outer striped_reverse_inner
-  syn keyword mpNewInternal  striped_reverse_outer
-  syn keyword mpType         grayscale greyscale quadruplet triplet
-  syn keyword mpVariable     ahfactor collapse_data color_map drawoptionsfactor
-  syn keyword mpVariable     freedotlabelsize freelabeloffset grid grid_full
-  syn keyword mpVariable     grid_h grid_left grid_nx grid_ny grid_w grid_x
-  syn keyword mpVariable     grid_y intersection_found originlength
-  syn keyword mpVariable     plain_compatibility_data pointlabelfont
-  syn keyword mpVariable     pointlabelscale refillbackground savingdata
-  syn keyword mpVariable     savingdatadone swappointlabels ticklength tickstep
-  syn keyword mpConstant     CRLF DQUOTE PERCENT SPACE bcircle context_tool crlf
-  syn keyword mpConstant     darkblue darkcyan darkgray darkgreen darkmagenta
-  syn keyword mpConstant     darkred darkyellow downtriangle dquote freesquare
-  syn keyword mpConstant     fulldiamond fullsquare fulltriangle lcircle
-  syn keyword mpConstant     lefttriangle lightgray llcircle lltriangle lrcircle
-  syn keyword mpConstant     lrtriangle mpversion nocolor noline oddly
-  syn keyword mpConstant     originpath percent rcircle righttriangle space
-  syn keyword mpConstant     tcircle triangle ulcircle ultriangle unitcircle
-  syn keyword mpConstant     unitdiamond unittriangle uptriangle urcircle
-  syn keyword mpConstant     urtriangle
-endif " MetaFun macros
+  hi def link metafunCommands   Statement
+  hi def link metafunInternals  Identifier
+endif
 
-" Define the default highlighting
+# Define the default highlighting
 hi def link mpTeXdelim     mpPrimitive
 hi def link mpBoolExp      mfBoolExp
 hi def link mpNumExp       mfNumExp
@@ -761,9 +268,6 @@ hi def link mpOnOff        mpPrimitive
 hi def link mpDash         mpPrimitive
 hi def link mpTeXKeyword   Identifier
 
-let b:current_syntax = "mp"
+b:current_syntax = "mp"
 
-let &cpo = s:cpo_sav
-unlet! s:cpo_sav
-
-" vim:sw=2
+# vim: sw=2 fdm=marker
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/shared/README.txt
@@ -0,0 +1,2 @@
+This directory "runtime/syntax/shared" contains Vim script files that are
+generated or used by more then one syntax file.
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/shared/typescriptcommon.vim
@@ -0,0 +1,2099 @@
+" Vim syntax file
+" Language:     TypeScript and TypeScriptReact
+" Maintainer:   Bram Moolenaar, Herrington Darkholme
+" Last Change:	2021 Sep 22
+" Based On:     Herrington Darkholme's yats.vim
+" Changes:      See https:github.com/HerringtonDarkholme/yats.vim
+" Credits:      See yats.vim on github
+
+if &cpo =~ 'C'
+  let s:cpo_save = &cpo
+  set cpo&vim
+endif
+
+
+" NOTE: this results in accurate highlighting, but can be slow.
+syntax sync fromstart
+
+"Dollar sign is permitted anywhere in an identifier
+setlocal iskeyword-=$
+if main_syntax == 'typescript' || main_syntax == 'typescriptreact'
+  setlocal iskeyword+=$
+  " syntax cluster htmlJavaScript                 contains=TOP
+endif
+" For private field added from TypeScript 3.8
+setlocal iskeyword+=#
+
+" lowest priority on least used feature
+syntax match   typescriptLabel                /[a-zA-Z_$]\k*:/he=e-1 contains=typescriptReserved nextgroup=@typescriptStatement skipwhite skipempty
+
+" other keywords like return,case,yield uses containedin
+syntax region  typescriptBlock                 matchgroup=typescriptBraces start=/{/ end=/}/ contains=@typescriptStatement,@typescriptComments fold
+syntax cluster afterIdentifier contains=
+  \ typescriptDotNotation,
+  \ typescriptFuncCallArg,
+  \ typescriptTemplate,
+  \ typescriptIndexExpr,
+  \ @typescriptSymbols,
+  \ typescriptTypeArguments
+
+syntax match   typescriptIdentifierName        /\<\K\k*/
+  \ nextgroup=@afterIdentifier
+  \ transparent
+  \ contains=@_semantic
+  \ skipnl skipwhite
+
+syntax match   typescriptProp contained /\K\k*!\?/
+  \ transparent
+  \ contains=@props
+  \ nextgroup=@afterIdentifier
+  \ skipwhite skipempty
+
+syntax region  typescriptIndexExpr      contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty
+
+syntax match   typescriptDotNotation           /\.\|?\.\|!\./ nextgroup=typescriptProp skipnl
+syntax match   typescriptDotStyleNotation      /\.style\./ nextgroup=typescriptDOMStyle transparent
+" syntax match   typescriptFuncCall              contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg
+syntax region  typescriptParenExp              matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty
+syntax region  typescriptFuncCallArg           contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl
+syntax region  typescriptEventFuncCallArg      contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression
+syntax region  typescriptEventString           contained start=/\z(["']\)/  skip=/\\\\\|\\\z1\|\\\n/  end=/\z1\|$/ contains=typescriptASCII,@events
+
+syntax region  typescriptDestructureString
+  \ start=/\z(["']\)/  skip=/\\\\\|\\\z1\|\\\n/  end=/\z1\|$/
+  \ contains=typescriptASCII
+  \ nextgroup=typescriptDestructureAs
+  \ contained skipwhite skipempty
+
+syntax cluster typescriptVariableDeclarations
+  \ contains=typescriptVariableDeclaration,@typescriptDestructures
+
+syntax match typescriptVariableDeclaration /[A-Za-z_$]\k*/
+  \ nextgroup=typescriptTypeAnnotation,typescriptAssign
+  \ contained skipwhite skipempty
+
+syntax cluster typescriptDestructureVariables contains=
+  \ typescriptRestOrSpread,
+  \ typescriptDestructureComma,
+  \ typescriptDestructureLabel,
+  \ typescriptDestructureVariable,
+  \ @typescriptDestructures
+
+syntax match typescriptDestructureVariable    /[A-Za-z_$]\k*/ contained
+  \ nextgroup=typescriptDefaultParam
+  \ contained skipwhite skipempty
+
+syntax match typescriptDestructureLabel       /[A-Za-z_$]\k*\ze\_s*:/
+  \ nextgroup=typescriptDestructureAs
+  \ contained skipwhite skipempty
+
+syntax match typescriptDestructureAs /:/
+  \ nextgroup=typescriptDestructureVariable,@typescriptDestructures
+  \ contained skipwhite skipempty
+
+syntax match typescriptDestructureComma /,/ contained
+
+syntax cluster typescriptDestructures contains=
+  \ typescriptArrayDestructure,
+  \ typescriptObjectDestructure
+
+syntax region typescriptArrayDestructure matchgroup=typescriptBraces
+  \ start=/\[/ end=/]/
+  \ contains=@typescriptDestructureVariables,@typescriptComments
+  \ nextgroup=typescriptTypeAnnotation,typescriptAssign
+  \ transparent contained skipwhite skipempty fold
+
+syntax region typescriptObjectDestructure matchgroup=typescriptBraces
+  \ start=/{/ end=/}/
+  \ contains=typescriptDestructureString,@typescriptDestructureVariables,@typescriptComments
+  \ nextgroup=typescriptTypeAnnotation,typescriptAssign
+  \ transparent contained skipwhite skipempty fold
+
+"Syntax in the JavaScript code
+
+" String
+syntax match   typescriptASCII                 contained /\\\d\d\d/
+
+syntax region  typescriptTemplateSubstitution matchgroup=typescriptTemplateSB
+  \ start=/\${/ end=/}/
+  \ contains=@typescriptValue
+  \ contained
+
+
+syntax region  typescriptString 
+  \ start=+\z(["']\)+  skip=+\\\%(\z1\|$\)+  end=+\z1+ end=+$+
+  \ contains=typescriptSpecial,@Spell
+  \ extend
+
+syntax match   typescriptSpecial            contained "\v\\%(x\x\x|u%(\x{4}|\{\x{1,6}})|c\u|.)"
+
+" From vim runtime
+" <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48>
+syntax region  typescriptRegexpString          start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimuy]\{0,5\}\s*$+ end=+/[gimuy]\{0,5\}\s*[;.,)\]}:]+me=e-1 nextgroup=typescriptDotNotation oneline
+
+syntax region  typescriptTemplate
+  \ start=/`/  skip=/\\\\\|\\`\|\n/  end=/`\|$/
+  \ contains=typescriptTemplateSubstitution,typescriptSpecial,@Spell
+  \ nextgroup=@typescriptSymbols
+  \ skipwhite skipempty
+
+"Array
+syntax region  typescriptArray matchgroup=typescriptBraces
+  \ start=/\[/ end=/]/
+  \ contains=@typescriptValue,@typescriptComments
+  \ nextgroup=@typescriptSymbols,typescriptDotNotation
+  \ skipwhite skipempty fold
+
+" Number
+syntax match typescriptNumber /\<0[bB][01][01_]*\>/        nextgroup=@typescriptSymbols skipwhite skipempty
+syntax match typescriptNumber /\<0[oO][0-7][0-7_]*\>/       nextgroup=@typescriptSymbols skipwhite skipempty
+syntax match typescriptNumber /\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty
+syntax match typescriptNumber /\<\%(\d[0-9_]*\%(\.\d[0-9_]*\)\=\|\.\d[0-9_]*\)\%([eE][+-]\=\d[0-9_]*\)\=\>/
+  \ nextgroup=typescriptSymbols skipwhite skipempty
+
+syntax region  typescriptObjectLiteral         matchgroup=typescriptBraces
+  \ start=/{/ end=/}/
+  \ contains=@typescriptComments,typescriptObjectLabel,typescriptStringProperty,typescriptComputedPropertyName,typescriptObjectAsyncKeyword
+  \ fold contained
+
+syntax keyword typescriptObjectAsyncKeyword async contained
+
+syntax match   typescriptObjectLabel  contained /\k\+\_s*/
+  \ nextgroup=typescriptObjectColon,@typescriptCallImpl
+  \ skipwhite skipempty
+
+syntax region  typescriptStringProperty   contained
+  \ start=/\z(["']\)/  skip=/\\\\\|\\\z1\|\\\n/  end=/\z1/
+  \ nextgroup=typescriptObjectColon,@typescriptCallImpl
+  \ skipwhite skipempty
+
+" syntax region  typescriptPropertyName    contained start=/\z(["']\)/  skip=/\\\\\|\\\z1\|\\\n/  end=/\z1(/me=e-1 nextgroup=@typescriptCallSignature skipwhite skipempty oneline
+syntax region  typescriptComputedPropertyName  contained matchgroup=typescriptBraces
+  \ start=/\[/rs=s+1 end=/]/
+  \ contains=@typescriptValue
+  \ nextgroup=typescriptObjectColon,@typescriptCallImpl
+  \ skipwhite skipempty
+
+" syntax region  typescriptComputedPropertyName  contained matchgroup=typescriptPropertyName start=/\[/rs=s+1 end=/]\_s*:/he=e-1 contains=@typescriptValue nextgroup=@typescriptValue skipwhite skipempty
+" syntax region  typescriptComputedPropertyName  contained matchgroup=typescriptPropertyName start=/\[/rs=s+1 end=/]\_s*(/me=e-1 contains=@typescriptValue nextgroup=@typescriptCallSignature skipwhite skipempty
+" Value for object, statement for label statement
+syntax match typescriptRestOrSpread /\.\.\./ contained
+syntax match typescriptObjectSpread /\.\.\./ contained containedin=typescriptObjectLiteral,typescriptArray nextgroup=@typescriptValue
+
+syntax match typescriptObjectColon contained /:/ nextgroup=@typescriptValue skipwhite skipempty
+
+" + - ^ ~
+syntax match typescriptUnaryOp /[+\-~!]/
+ \ nextgroup=@typescriptValue
+ \ skipwhite
+
+syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?[.?]\@!/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty
+
+syntax match   typescriptAssign  /=/ nextgroup=@typescriptValue
+  \ skipwhite skipempty
+
+" 2: ==, ===
+syntax match   typescriptBinaryOp contained /===\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 6: >>>=, >>>, >>=, >>, >=, >
+syntax match   typescriptBinaryOp contained />\(>>=\|>>\|>=\|>\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 4: <<=, <<, <=, <
+syntax match   typescriptBinaryOp contained /<\(<=\|<\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 3: ||, |=, |, ||=
+syntax match   typescriptBinaryOp contained /||\?=\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 4: &&, &=, &, &&=
+syntax match   typescriptBinaryOp contained /&&\?=\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 2: ??, ??=
+syntax match   typescriptBinaryOp contained /??=\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 2: *=, *
+syntax match   typescriptBinaryOp contained /\*=\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 2: %=, %
+syntax match   typescriptBinaryOp contained /%=\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 2: /=, /
+syntax match   typescriptBinaryOp contained +/\(=\|[^\*/]\@=\)+ nextgroup=@typescriptValue skipwhite skipempty
+syntax match   typescriptBinaryOp contained /!==\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 2: !=, !==
+syntax match   typescriptBinaryOp contained /+\(+\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 3: +, ++, +=
+syntax match   typescriptBinaryOp contained /-\(-\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty
+" 3: -, --, -=
+
+" exponentiation operator
+" 2: **, **=
+syntax match typescriptBinaryOp contained /\*\*=\?/ nextgroup=@typescriptValue
+
+syntax cluster typescriptSymbols               contains=typescriptBinaryOp,typescriptKeywordOp,typescriptTernary,typescriptAssign,typescriptCastKeyword
+
+" runtime syntax/basic/reserved.vim
+"Import
+syntax keyword typescriptImport                from as
+syntax keyword typescriptImport                import
+  \ nextgroup=typescriptImportType
+  \ skipwhite
+syntax keyword typescriptImportType            type
+  \ contained
+syntax keyword typescriptExport                export
+  \ nextgroup=typescriptExportType
+  \ skipwhite
+syntax match typescriptExportType              /\<type\s*{\@=/
+  \ contained skipwhite skipempty skipnl
+syntax keyword typescriptModule                namespace module
+
+"this
+
+"JavaScript Prototype
+syntax keyword typescriptPrototype             prototype
+  \ nextgroup=@afterIdentifier
+
+syntax keyword typescriptCastKeyword           as
+  \ nextgroup=@typescriptType
+  \ skipwhite
+
+"Program Keywords
+syntax keyword typescriptIdentifier            arguments this super
+  \ nextgroup=@afterIdentifier
+
+syntax keyword typescriptVariable              let var
+  \ nextgroup=@typescriptVariableDeclarations
+  \ skipwhite skipempty
+
+syntax keyword typescriptVariable const
+  \ nextgroup=typescriptEnum,@typescriptVariableDeclarations
+  \ skipwhite skipempty
+
+syntax region typescriptEnum matchgroup=typescriptEnumKeyword start=/enum / end=/\ze{/
+  \ nextgroup=typescriptBlock
+  \ skipwhite
+
+syntax keyword typescriptKeywordOp
+  \ contained in instanceof nextgroup=@typescriptValue
+syntax keyword typescriptOperator              delete new typeof void
+  \ nextgroup=@typescriptValue
+  \ skipwhite skipempty
+
+syntax keyword typescriptForOperator           contained in of
+syntax keyword typescriptBoolean               true false nextgroup=@typescriptSymbols skipwhite skipempty
+syntax keyword typescriptNull                  null undefined nextgroup=@typescriptSymbols skipwhite skipempty
+syntax keyword typescriptMessage               alert confirm prompt status
+  \ nextgroup=typescriptDotNotation,typescriptFuncCallArg
+syntax keyword typescriptGlobal                self top parent
+  \ nextgroup=@afterIdentifier
+
+"Statement Keywords
+syntax keyword typescriptConditional           if else switch
+  \ nextgroup=typescriptConditionalParen
+  \ skipwhite skipempty skipnl
+syntax keyword typescriptConditionalElse       else
+syntax keyword typescriptRepeat                do while for nextgroup=typescriptLoopParen skipwhite skipempty
+syntax keyword typescriptRepeat                for nextgroup=typescriptLoopParen,typescriptAsyncFor skipwhite skipempty
+syntax keyword typescriptBranch                break continue containedin=typescriptBlock
+syntax keyword typescriptCase                  case nextgroup=@typescriptPrimitive skipwhite containedin=typescriptBlock
+syntax keyword typescriptDefault               default containedin=typescriptBlock nextgroup=@typescriptValue,typescriptClassKeyword,typescriptInterfaceKeyword skipwhite oneline
+syntax keyword typescriptStatementKeyword      with
+syntax keyword typescriptStatementKeyword      yield skipwhite nextgroup=@typescriptValue containedin=typescriptBlock
+syntax keyword typescriptStatementKeyword      return skipwhite contained nextgroup=@typescriptValue containedin=typescriptBlock
+
+syntax keyword typescriptTry                   try
+syntax keyword typescriptExceptions            catch throw finally
+syntax keyword typescriptDebugger              debugger
+
+syntax keyword typescriptAsyncFor              await nextgroup=typescriptLoopParen skipwhite skipempty contained
+
+syntax region  typescriptLoopParen             contained matchgroup=typescriptParens
+  \ start=/(/ end=/)/
+  \ contains=typescriptVariable,typescriptForOperator,typescriptEndColons,@typescriptValue,@typescriptComments
+  \ nextgroup=typescriptBlock
+  \ skipwhite skipempty
+syntax region  typescriptConditionalParen             contained matchgroup=typescriptParens
+  \ start=/(/ end=/)/
+  \ contains=@typescriptValue,@typescriptComments
+  \ nextgroup=typescriptBlock
+  \ skipwhite skipempty
+syntax match   typescriptEndColons             /[;,]/ contained
+
+syntax keyword typescriptAmbientDeclaration declare nextgroup=@typescriptAmbients
+  \ skipwhite skipempty
+
+syntax cluster typescriptAmbients contains=
+  \ typescriptVariable,
+  \ typescriptFuncKeyword,
+  \ typescriptClassKeyword,
+  \ typescriptAbstract,
+  \ typescriptEnumKeyword,typescriptEnum,
+  \ typescriptModule
+
+"Syntax coloring for Node.js shebang line
+syntax match   shellbang "^#!.*node\>"
+syntax match   shellbang "^#!.*iojs\>"
+
+
+"JavaScript comments
+syntax keyword typescriptCommentTodo TODO FIXME XXX TBD
+syntax match typescriptMagicComment "@ts-\%(ignore\|expect-error\)\>"
+syntax match   typescriptLineComment "//.*"
+  \ contains=@Spell,typescriptCommentTodo,typescriptRef,typescriptMagicComment
+syntax region  typescriptComment
+  \ start="/\*"  end="\*/"
+  \ contains=@Spell,typescriptCommentTodo extend
+syntax cluster typescriptComments
+  \ contains=typescriptDocComment,typescriptComment,typescriptLineComment
+
+syntax match   typescriptRef  +///\s*<reference\s\+.*\/>$+
+  \ contains=typescriptString
+syntax match   typescriptRef  +///\s*<amd-dependency\s\+.*\/>$+
+  \ contains=typescriptString
+syntax match   typescriptRef  +///\s*<amd-module\s\+.*\/>$+
+  \ contains=typescriptString
+
+"JSDoc
+syntax case ignore
+
+syntax region  typescriptDocComment            matchgroup=typescriptComment
+  \ start="/\*\*"  end="\*/"
+  \ contains=typescriptDocNotation,typescriptCommentTodo,@Spell
+  \ fold keepend
+syntax match   typescriptDocNotation           contained /@/ nextgroup=typescriptDocTags
+
+syntax keyword typescriptDocTags               contained constant constructor constructs function ignore inner private public readonly static
+syntax keyword typescriptDocTags               contained const dict expose inheritDoc interface nosideeffects override protected struct internal
+syntax keyword typescriptDocTags               contained example global
+syntax keyword typescriptDocTags               contained alpha beta defaultValue eventProperty experimental label
+syntax keyword typescriptDocTags               contained packageDocumentation privateRemarks remarks sealed typeParam
+
+" syntax keyword typescriptDocTags               contained ngdoc nextgroup=typescriptDocNGDirective
+syntax keyword typescriptDocTags               contained ngdoc scope priority animations
+syntax keyword typescriptDocTags               contained ngdoc restrict methodOf propertyOf eventOf eventType nextgroup=typescriptDocParam skipwhite
+syntax keyword typescriptDocNGDirective        contained overview service object function method property event directive filter inputType error
+
+syntax keyword typescriptDocTags               contained abstract virtual access augments
+
+syntax keyword typescriptDocTags               contained arguments callback lends memberOf name type kind link mixes mixin tutorial nextgroup=typescriptDocParam skipwhite
+syntax keyword typescriptDocTags               contained variation nextgroup=typescriptDocNumParam skipwhite
+
+syntax keyword typescriptDocTags               contained author class classdesc copyright default defaultvalue nextgroup=typescriptDocDesc skipwhite
+syntax keyword typescriptDocTags               contained deprecated description external host nextgroup=typescriptDocDesc skipwhite
+syntax keyword typescriptDocTags               contained file fileOverview overview namespace requires since version nextgroup=typescriptDocDesc skipwhite
+syntax keyword typescriptDocTags               contained summary todo license preserve nextgroup=typescriptDocDesc skipwhite
+
+syntax keyword typescriptDocTags               contained borrows exports nextgroup=typescriptDocA skipwhite
+syntax keyword typescriptDocTags               contained param arg argument property prop module nextgroup=typescriptDocNamedParamType,typescriptDocParamName skipwhite
+syntax keyword typescriptDocTags               contained define enum extends implements this typedef nextgroup=typescriptDocParamType skipwhite
+syntax keyword typescriptDocTags               contained return returns throws exception nextgroup=typescriptDocParamType,typescriptDocParamName skipwhite
+syntax keyword typescriptDocTags               contained see nextgroup=typescriptDocRef skipwhite
+
+syntax keyword typescriptDocTags               contained function func method nextgroup=typescriptDocName skipwhite
+syntax match   typescriptDocName               contained /\h\w*/
+
+syntax keyword typescriptDocTags               contained fires event nextgroup=typescriptDocEventRef skipwhite
+syntax match   typescriptDocEventRef           contained /\h\w*#\(\h\w*\:\)\?\h\w*/
+
+syntax match   typescriptDocNamedParamType     contained /{.\+}/ nextgroup=typescriptDocParamName skipwhite
+syntax match   typescriptDocParamName          contained /\[\?0-9a-zA-Z_\.]\+\]\?/ nextgroup=typescriptDocDesc skipwhite
+syntax match   typescriptDocParamType          contained /{.\+}/ nextgroup=typescriptDocDesc skipwhite
+syntax match   typescriptDocA                  contained /\%(#\|\w\|\.\|:\|\/\)\+/ nextgroup=typescriptDocAs skipwhite
+syntax match   typescriptDocAs                 contained /\s*as\s*/ nextgroup=typescriptDocB skipwhite
+syntax match   typescriptDocB                  contained /\%(#\|\w\|\.\|:\|\/\)\+/
+syntax match   typescriptDocParam              contained /\%(#\|\w\|\.\|:\|\/\|-\)\+/
+syntax match   typescriptDocNumParam           contained /\d\+/
+syntax match   typescriptDocRef                contained /\%(#\|\w\|\.\|:\|\/\)\+/
+syntax region  typescriptDocLinkTag            contained matchgroup=typescriptDocLinkTag start=/{/ end=/}/ contains=typescriptDocTags
+
+syntax cluster typescriptDocs                  contains=typescriptDocParamType,typescriptDocNamedParamType,typescriptDocParam
+
+if exists("main_syntax") && main_syntax == "typescript"
+  syntax sync clear
+  syntax sync ccomment typescriptComment minlines=200
+endif
+
+syntax case match
+
+" Types
+syntax match typescriptOptionalMark /?/ contained
+
+syntax cluster typescriptTypeParameterCluster contains=
+  \ typescriptTypeParameter,
+  \ typescriptGenericDefault
+
+syntax region typescriptTypeParameters matchgroup=typescriptTypeBrackets
+  \ start=/</ end=/>/
+  \ contains=@typescriptTypeParameterCluster
+  \ contained
+
+syntax match typescriptTypeParameter /\K\k*/
+  \ nextgroup=typescriptConstraint
+  \ contained skipwhite skipnl
+
+syntax keyword typescriptConstraint extends
+  \ nextgroup=@typescriptType
+  \ contained skipwhite skipnl
+
+syntax match typescriptGenericDefault /=/
+  \ nextgroup=@typescriptType
+  \ contained skipwhite
+
+"><
+" class A extend B<T> {} // ClassBlock
+" func<T>() // FuncCallArg
+syntax region typescriptTypeArguments matchgroup=typescriptTypeBrackets
+  \ start=/\></ end=/>/
+  \ contains=@typescriptType
+  \ nextgroup=typescriptFuncCallArg,@typescriptTypeOperator
+  \ contained skipwhite
+
+
+syntax cluster typescriptType contains=
+  \ @typescriptPrimaryType,
+  \ typescriptUnion,
+  \ @typescriptFunctionType,
+  \ typescriptConstructorType
+
+" array type: A[]
+" type indexing A['key']
+syntax region typescriptTypeBracket contained
+  \ start=/\[/ end=/\]/
+  \ contains=typescriptString,typescriptNumber
+  \ nextgroup=@typescriptTypeOperator
+  \ skipwhite skipempty
+
+syntax cluster typescriptPrimaryType contains=
+  \ typescriptParenthesizedType,
+  \ typescriptPredefinedType,
+  \ typescriptTypeReference,
+  \ typescriptObjectType,
+  \ typescriptTupleType,
+  \ typescriptTypeQuery,
+  \ typescriptStringLiteralType,
+  \ typescriptTemplateLiteralType,
+  \ typescriptReadonlyArrayKeyword,
+  \ typescriptAssertType
+
+syntax region  typescriptStringLiteralType contained
+  \ start=/\z(["']\)/  skip=/\\\\\|\\\z1\|\\\n/  end=/\z1\|$/
+  \ nextgroup=typescriptUnion
+  \ skipwhite skipempty
+
+syntax region  typescriptTemplateLiteralType contained
+  \ start=/`/  skip=/\\\\\|\\`\|\n/  end=/`\|$/
+  \ contains=typescriptTemplateSubstitutionType
+  \ nextgroup=typescriptTypeOperator
+  \ skipwhite skipempty
+
+syntax region  typescriptTemplateSubstitutionType matchgroup=typescriptTemplateSB
+  \ start=/\${/ end=/}/
+  \ contains=@typescriptType
+  \ contained
+
+syntax region typescriptParenthesizedType matchgroup=typescriptParens
+  \ start=/(/ end=/)/
+  \ contains=@typescriptType
+  \ nextgroup=@typescriptTypeOperator
+  \ contained skipwhite skipempty fold
+
+syntax match typescriptTypeReference /\K\k*\(\.\K\k*\)*/
+  \ nextgroup=typescriptTypeArguments,@typescriptTypeOperator,typescriptUserDefinedType
+  \ skipwhite contained skipempty
+
+syntax keyword typescriptPredefinedType any number boolean string void never undefined null object unknown
+  \ nextgroup=@typescriptTypeOperator
+  \ contained skipwhite skipempty
+
+syntax match typescriptPredefinedType /unique symbol/
+  \ nextgroup=@typescriptTypeOperator
+  \ contained skipwhite skipempty
+
+syntax region typescriptObjectType matchgroup=typescriptBraces
+  \ start=/{/ end=/}/
+  \ contains=@typescriptTypeMember,typescriptEndColons,@typescriptComments,typescriptAccessibilityModifier,typescriptReadonlyModifier
+  \ nextgroup=@typescriptTypeOperator
+  \ contained skipwhite skipnl fold
+
+syntax cluster typescriptTypeMember contains=
+  \ @typescriptCallSignature,
+  \ typescriptConstructSignature,
+  \ typescriptIndexSignature,
+  \ @typescriptMembers
+
+syntax match typescriptTupleLable /\K\k*?\?:/
+    \ contained
+
+syntax region typescriptTupleType matchgroup=typescriptBraces
+  \ start=/\[/ end=/\]/
+  \ contains=@typescriptType,@typescriptComments,typescriptRestOrSpread,typescriptTupleLable
+  \ contained skipwhite
+
+syntax cluster typescriptTypeOperator
+  \ contains=typescriptUnion,typescriptTypeBracket,typescriptConstraint,typescriptConditionalType
+
+syntax match typescriptUnion /|\|&/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty
+
+syntax match typescriptConditionalType /?\|:/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty
+
+syntax cluster typescriptFunctionType contains=typescriptGenericFunc,typescriptFuncType
+syntax region typescriptGenericFunc matchgroup=typescriptTypeBrackets
+  \ start=/</ end=/>/
+  \ contains=typescriptTypeParameter
+  \ nextgroup=typescriptFuncType
+  \ containedin=typescriptFunctionType
+  \ contained skipwhite skipnl
+
+syntax region typescriptFuncType matchgroup=typescriptParens
+  \ start=/(/ end=/)\s*=>/me=e-2
+  \ contains=@typescriptParameterList
+  \ nextgroup=typescriptFuncTypeArrow
+  \ contained skipwhite skipnl oneline
+
+syntax match typescriptFuncTypeArrow /=>/
+  \ nextgroup=@typescriptType
+  \ containedin=typescriptFuncType
+  \ contained skipwhite skipnl
+
+
+syntax keyword typescriptConstructorType new
+  \ nextgroup=@typescriptFunctionType
+  \ contained skipwhite skipnl
+
+syntax keyword typescriptUserDefinedType is
+  \ contained nextgroup=@typescriptType skipwhite skipempty
+
+syntax keyword typescriptTypeQuery typeof keyof
+  \ nextgroup=typescriptTypeReference
+  \ contained skipwhite skipnl
+
+syntax keyword typescriptAssertType asserts
+  \ nextgroup=typescriptTypeReference
+  \ contained skipwhite skipnl
+
+syntax cluster typescriptCallSignature contains=typescriptGenericCall,typescriptCall
+syntax region typescriptGenericCall matchgroup=typescriptTypeBrackets
+  \ start=/</ end=/>/
+  \ contains=typescriptTypeParameter
+  \ nextgroup=typescriptCall
+  \ contained skipwhite skipnl
+syntax region typescriptCall matchgroup=typescriptParens
+  \ start=/(/ end=/)/
+  \ contains=typescriptDecorator,@typescriptParameterList,@typescriptComments
+  \ nextgroup=typescriptTypeAnnotation,typescriptBlock
+  \ contained skipwhite skipnl
+
+syntax match typescriptTypeAnnotation /:/
+  \ nextgroup=@typescriptType
+  \ contained skipwhite skipnl
+
+syntax cluster typescriptParameterList contains=
+  \ typescriptTypeAnnotation,
+  \ typescriptAccessibilityModifier,
+  \ typescriptReadonlyModifier,
+  \ typescriptOptionalMark,
+  \ typescriptRestOrSpread,
+  \ typescriptFuncComma,
+  \ typescriptDefaultParam
+
+syntax match typescriptFuncComma /,/ contained
+
+syntax match typescriptDefaultParam /=/
+  \ nextgroup=@typescriptValue
+  \ contained skipwhite
+
+syntax keyword typescriptConstructSignature new
+  \ nextgroup=@typescriptCallSignature
+  \ contained skipwhite
+
+syntax region typescriptIndexSignature matchgroup=typescriptBraces
+  \ start=/\[/ end=/\]/
+  \ contains=typescriptPredefinedType,typescriptMappedIn,typescriptString
+  \ nextgroup=typescriptTypeAnnotation
+  \ contained skipwhite oneline
+
+syntax keyword typescriptMappedIn in
+  \ nextgroup=@typescriptType
+  \ contained skipwhite skipnl skipempty
+
+syntax keyword typescriptAliasKeyword type
+  \ nextgroup=typescriptAliasDeclaration
+  \ skipwhite skipnl skipempty
+
+syntax region typescriptAliasDeclaration matchgroup=typescriptUnion
+  \ start=/ / end=/=/
+  \ nextgroup=@typescriptType
+  \ contains=typescriptConstraint,typescriptTypeParameters
+  \ contained skipwhite skipempty
+
+syntax keyword typescriptReadonlyArrayKeyword readonly
+  \ nextgroup=@typescriptPrimaryType
+  \ skipwhite
+
+
+" extension
+if get(g:, 'yats_host_keyword', 1)
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function Boolean
+  " use of nextgroup Suggested by Doug Kearns
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Error EvalError nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName InternalError
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName RangeError ReferenceError
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName StopIteration
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName SyntaxError TypeError
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName URIError Date
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float32Array
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float64Array
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int16Array Int32Array
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int8Array Uint16Array
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint32Array Uint8Array
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint8ClampedArray
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName ParallelArray
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName ArrayBuffer DataView
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Iterator Generator
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Reflect Proxy
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName arguments
+  hi def link typescriptGlobal Structure
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName eval uneval nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName isFinite nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName isNaN parseFloat nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName parseInt nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName decodeURI nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName decodeURIComponent nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName encodeURI nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName encodeURIComponent nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptGlobalMethod
+  hi def link typescriptGlobalMethod Structure
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Number nextgroup=typescriptGlobalNumberDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalNumberDot /\./ contained nextgroup=typescriptNumberStaticProp,typescriptNumberStaticMethod,typescriptProp
+  syntax keyword typescriptNumberStaticProp contained EPSILON MAX_SAFE_INTEGER MAX_VALUE
+  syntax keyword typescriptNumberStaticProp contained MIN_SAFE_INTEGER MIN_VALUE NEGATIVE_INFINITY
+  syntax keyword typescriptNumberStaticProp contained NaN POSITIVE_INFINITY
+  hi def link typescriptNumberStaticProp Keyword
+  syntax keyword typescriptNumberStaticMethod contained isFinite isInteger isNaN isSafeInteger nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptNumberStaticMethod contained parseFloat parseInt nextgroup=typescriptFuncCallArg
+  hi def link typescriptNumberStaticMethod Keyword
+  syntax keyword typescriptNumberMethod contained toExponential toFixed toLocaleString nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptNumberMethod contained toPrecision toSource toString valueOf nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptNumberMethod
+  hi def link typescriptNumberMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName String nextgroup=typescriptGlobalStringDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalStringDot /\./ contained nextgroup=typescriptStringStaticMethod,typescriptProp
+  syntax keyword typescriptStringStaticMethod contained fromCharCode fromCodePoint raw nextgroup=typescriptFuncCallArg
+  hi def link typescriptStringStaticMethod Keyword
+  syntax keyword typescriptStringMethod contained anchor charAt charCodeAt codePointAt nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptStringMethod contained concat endsWith includes indexOf lastIndexOf nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptStringMethod contained link localeCompare match normalize nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptStringMethod contained padStart padEnd repeat replace search nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptStringMethod contained slice split startsWith substr substring nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptStringMethod contained toLocaleLowerCase toLocaleUpperCase nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptStringMethod contained toLowerCase toString toUpperCase trim nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptStringMethod contained valueOf nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptStringMethod
+  hi def link typescriptStringMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Array nextgroup=typescriptGlobalArrayDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalArrayDot /\./ contained nextgroup=typescriptArrayStaticMethod,typescriptProp
+  syntax keyword typescriptArrayStaticMethod contained from isArray of nextgroup=typescriptFuncCallArg
+  hi def link typescriptArrayStaticMethod Keyword
+  syntax keyword typescriptArrayMethod contained concat copyWithin entries every fill nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptArrayMethod contained filter find findIndex forEach indexOf nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptArrayMethod contained includes join keys lastIndexOf map nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptArrayMethod contained pop push reduce reduceRight reverse nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptArrayMethod contained shift slice some sort splice toLocaleString nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptArrayMethod contained toSource toString unshift nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptArrayMethod
+  hi def link typescriptArrayMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Object nextgroup=typescriptGlobalObjectDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalObjectDot /\./ contained nextgroup=typescriptObjectStaticMethod,typescriptProp
+  syntax keyword typescriptObjectStaticMethod contained create defineProperties defineProperty nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptObjectStaticMethod contained entries freeze getOwnPropertyDescriptors nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptObjectStaticMethod contained getOwnPropertyDescriptor getOwnPropertyNames nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptObjectStaticMethod contained getOwnPropertySymbols getPrototypeOf nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptObjectStaticMethod contained is isExtensible isFrozen isSealed nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptObjectStaticMethod contained keys preventExtensions values nextgroup=typescriptFuncCallArg
+  hi def link typescriptObjectStaticMethod Keyword
+  syntax keyword typescriptObjectMethod contained getOwnPropertyDescriptors hasOwnProperty nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptObjectMethod contained isPrototypeOf propertyIsEnumerable nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptObjectMethod contained toLocaleString toString valueOf seal nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptObjectMethod contained setPrototypeOf nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptObjectMethod
+  hi def link typescriptObjectMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Symbol nextgroup=typescriptGlobalSymbolDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalSymbolDot /\./ contained nextgroup=typescriptSymbolStaticProp,typescriptSymbolStaticMethod,typescriptProp
+  syntax keyword typescriptSymbolStaticProp contained length iterator match replace
+  syntax keyword typescriptSymbolStaticProp contained search split hasInstance isConcatSpreadable
+  syntax keyword typescriptSymbolStaticProp contained unscopables species toPrimitive
+  syntax keyword typescriptSymbolStaticProp contained toStringTag
+  hi def link typescriptSymbolStaticProp Keyword
+  syntax keyword typescriptSymbolStaticMethod contained for keyFor nextgroup=typescriptFuncCallArg
+  hi def link typescriptSymbolStaticMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function
+  syntax keyword typescriptFunctionMethod contained apply bind call nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptFunctionMethod
+  hi def link typescriptFunctionMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Math nextgroup=typescriptGlobalMathDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalMathDot /\./ contained nextgroup=typescriptMathStaticProp,typescriptMathStaticMethod,typescriptProp
+  syntax keyword typescriptMathStaticProp contained E LN10 LN2 LOG10E LOG2E PI SQRT1_2
+  syntax keyword typescriptMathStaticProp contained SQRT2
+  hi def link typescriptMathStaticProp Keyword
+  syntax keyword typescriptMathStaticMethod contained abs acos acosh asin asinh atan nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptMathStaticMethod contained atan2 atanh cbrt ceil clz32 cos nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptMathStaticMethod contained cosh exp expm1 floor fround hypot nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptMathStaticMethod contained imul log log10 log1p log2 max nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptMathStaticMethod contained min pow random round sign sin nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptMathStaticMethod contained sinh sqrt tan tanh trunc nextgroup=typescriptFuncCallArg
+  hi def link typescriptMathStaticMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Date nextgroup=typescriptGlobalDateDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalDateDot /\./ contained nextgroup=typescriptDateStaticMethod,typescriptProp
+  syntax keyword typescriptDateStaticMethod contained UTC now parse nextgroup=typescriptFuncCallArg
+  hi def link typescriptDateStaticMethod Keyword
+  syntax keyword typescriptDateMethod contained getDate getDay getFullYear getHours nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained getMilliseconds getMinutes getMonth nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained getSeconds getTime getTimezoneOffset nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained getUTCDate getUTCDay getUTCFullYear nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained getUTCHours getUTCMilliseconds getUTCMinutes nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained getUTCMonth getUTCSeconds setDate setFullYear nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained setHours setMilliseconds setMinutes nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained setMonth setSeconds setTime setUTCDate nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained setUTCFullYear setUTCHours setUTCMilliseconds nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained setUTCMinutes setUTCMonth setUTCSeconds nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained toDateString toISOString toJSON toLocaleDateString nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained toLocaleFormat toLocaleString toLocaleTimeString nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained toSource toString toTimeString toUTCString nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDateMethod contained valueOf nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptDateMethod
+  hi def link typescriptDateMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName JSON nextgroup=typescriptGlobalJSONDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalJSONDot /\./ contained nextgroup=typescriptJSONStaticMethod,typescriptProp
+  syntax keyword typescriptJSONStaticMethod contained parse stringify nextgroup=typescriptFuncCallArg
+  hi def link typescriptJSONStaticMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName RegExp nextgroup=typescriptGlobalRegExpDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalRegExpDot /\./ contained nextgroup=typescriptRegExpStaticProp,typescriptProp
+  syntax keyword typescriptRegExpStaticProp contained lastIndex
+  hi def link typescriptRegExpStaticProp Keyword
+  syntax keyword typescriptRegExpProp contained global ignoreCase multiline source sticky
+  syntax cluster props add=typescriptRegExpProp
+  hi def link typescriptRegExpProp Keyword
+  syntax keyword typescriptRegExpMethod contained exec test nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptRegExpMethod
+  hi def link typescriptRegExpMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Map WeakMap
+  syntax keyword typescriptES6MapProp contained size
+  syntax cluster props add=typescriptES6MapProp
+  hi def link typescriptES6MapProp Keyword
+  syntax keyword typescriptES6MapMethod contained clear delete entries forEach get has nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptES6MapMethod contained keys set values nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptES6MapMethod
+  hi def link typescriptES6MapMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Set WeakSet
+  syntax keyword typescriptES6SetProp contained size
+  syntax cluster props add=typescriptES6SetProp
+  hi def link typescriptES6SetProp Keyword
+  syntax keyword typescriptES6SetMethod contained add clear delete entries forEach has nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptES6SetMethod contained values nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptES6SetMethod
+  hi def link typescriptES6SetMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Proxy
+  syntax keyword typescriptProxyAPI contained getOwnPropertyDescriptor getOwnPropertyNames
+  syntax keyword typescriptProxyAPI contained defineProperty deleteProperty freeze seal
+  syntax keyword typescriptProxyAPI contained preventExtensions has hasOwn get set enumerate
+  syntax keyword typescriptProxyAPI contained iterate ownKeys apply construct
+  hi def link typescriptProxyAPI Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Promise nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalPromiseDot /\./ contained nextgroup=typescriptPromiseStaticMethod,typescriptProp
+  syntax keyword typescriptPromiseStaticMethod contained resolve reject all race nextgroup=typescriptFuncCallArg
+  hi def link typescriptPromiseStaticMethod Keyword
+  syntax keyword typescriptPromiseMethod contained then catch finally nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptPromiseMethod
+  hi def link typescriptPromiseMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Reflect
+  syntax keyword typescriptReflectMethod contained apply construct defineProperty deleteProperty nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptReflectMethod contained enumerate get getOwnPropertyDescriptor nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptReflectMethod contained getPrototypeOf has isExtensible ownKeys nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptReflectMethod contained preventExtensions set setPrototypeOf nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptReflectMethod
+  hi def link typescriptReflectMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Intl
+  syntax keyword typescriptIntlMethod contained Collator DateTimeFormat NumberFormat nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptIntlMethod contained PluralRules nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptIntlMethod
+  hi def link typescriptIntlMethod Keyword
+
+  syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName global process
+  syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName console Buffer
+  syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName module exports
+  syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName setTimeout
+  syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearTimeout
+  syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName setInterval
+  syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearInterval
+  hi def link typescriptNodeGlobal Structure
+
+  syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName describe
+  syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName it test before
+  syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName after beforeEach
+  syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName afterEach
+  syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName beforeAll
+  syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName afterAll
+  syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName expect assert
+
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName AbortController
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName AbstractWorker AnalyserNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName App Apps ArrayBuffer
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ArrayBufferView
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Attr AudioBuffer
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioBufferSourceNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioContext AudioDestinationNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioListener AudioNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioParam BatteryManager
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName BiquadFilterNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName BlobEvent BluetoothAdapter
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName BluetoothDevice
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName BluetoothManager
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CameraCapabilities
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CameraControl CameraManager
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CanvasGradient CanvasImageSource
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CanvasPattern CanvasRenderingContext2D
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CaretPosition CDATASection
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ChannelMergerNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ChannelSplitterNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CharacterData ChildNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ChromeWorker Comment
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Connection Console
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ContactManager Contacts
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ConvolverNode Coordinates
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSS CSSConditionRule
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSGroupingRule
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSKeyframeRule
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSKeyframesRule
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSMediaRule CSSNamespaceRule
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSPageRule CSSRule
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSRuleList CSSStyleDeclaration
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSStyleRule CSSStyleSheet
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSSupportsRule
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DataTransfer DataView
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DedicatedWorkerGlobalScope
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DelayNode DeviceAcceleration
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DeviceRotationRate
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DeviceStorage DirectoryEntry
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryEntrySync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryReader
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryReaderSync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Document DocumentFragment
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DocumentTouch DocumentType
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMCursor DOMError
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMException DOMHighResTimeStamp
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMImplementation
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMImplementationRegistry
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMParser DOMRequest
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMString DOMStringList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMStringMap DOMTimeStamp
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMTokenList DynamicsCompressorNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Element Entry EntrySync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Extensions FileException
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Float32Array Float64Array
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName FMRadio FormData
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName GainNode Gamepad
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName GamepadButton Geolocation
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName History HTMLAnchorElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLAreaElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLAudioElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBaseElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBodyElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBRElement HTMLButtonElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLCanvasElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLCollection HTMLDataElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDataListElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDivElement HTMLDListElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDocument HTMLElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLEmbedElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFieldSetElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFormControlsCollection
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFormElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHeadElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHeadingElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHRElement HTMLHtmlElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLIFrameElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLImageElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLInputElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLKeygenElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLabelElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLegendElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLIElement HTMLLinkElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMapElement HTMLMediaElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMetaElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMeterElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLModElement HTMLObjectElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOListElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptGroupElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptionElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptionsCollection
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOutputElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLParagraphElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLParamElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLPreElement HTMLProgressElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLQuoteElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLScriptElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSelectElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSourceElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSpanElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLStyleElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableCaptionElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableCellElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableColElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableDataCellElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableHeaderCellElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableRowElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableSectionElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTextAreaElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTimeElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTitleElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTrackElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLUListElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLUnknownElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLVideoElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBCursor IDBCursorSync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBCursorWithValue
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBDatabase IDBDatabaseSync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBEnvironment IDBEnvironmentSync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBFactory IDBFactorySync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBIndex IDBIndexSync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBKeyRange IDBObjectStore
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBObjectStoreSync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBOpenDBRequest
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBRequest IDBTransaction
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBTransactionSync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBVersionChangeEvent
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ImageData IndexedDB
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Int16Array Int32Array
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Int8Array L10n LinkStyle
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName LocalFileSystem
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName LocalFileSystemSync
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Location LockedFile
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaQueryList MediaQueryListListener
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaRecorder MediaSource
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaStream MediaStreamTrack
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName MutationObserver
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Navigator NavigatorGeolocation
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorID NavigatorLanguage
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorOnLine
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorPlugins
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Node NodeFilter
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName NodeIterator NodeList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Notification OfflineAudioContext
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName OscillatorNode PannerNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ParentNode Performance
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName PerformanceNavigation
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName PerformanceTiming
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Permissions PermissionSettings
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Plugin PluginArray
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Position PositionError
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName PositionOptions
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName PowerManager ProcessingInstruction
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName PromiseResolver
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName PushManager Range
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCConfiguration
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCPeerConnection
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCPeerConnectionErrorCallback
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCSessionDescription
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCSessionDescriptionCallback
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ScriptProcessorNode
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Selection SettingsLock
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SettingsManager
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SharedWorker StyleSheet
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName StyleSheetList SVGAElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAngle SVGAnimateColorElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedAngle
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedBoolean
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedEnumeration
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedInteger
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedLength
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedLengthList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedNumber
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedNumberList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedPoints
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedPreserveAspectRatio
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedRect
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedString
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedTransformList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateMotionElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateTransformElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimationElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGCircleElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGClipPathElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGCursorElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGDefsElement SVGDescElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGElement SVGEllipseElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFilterElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontElement SVGFontFaceElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceFormatElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceNameElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceSrcElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceUriElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGForeignObjectElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGGElement SVGGlyphElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGGradientElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGHKernElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGImageElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLength SVGLengthList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLinearGradientElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLineElement SVGMaskElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGMatrix SVGMissingGlyphElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGMPathElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGNumber SVGNumberList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPathElement SVGPatternElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPoint SVGPolygonElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPolylineElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPreserveAspectRatio
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGRadialGradientElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGRect SVGRectElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGScriptElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSetElement SVGStopElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGStringList SVGStylable
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGStyleElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSVGElement SVGSwitchElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSymbolElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTests SVGTextElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTextPositioningElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTitleElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTransform SVGTransformable
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTransformList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTRefElement SVGTSpanElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGUseElement SVGViewElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGVKernElement
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName TCPServerSocket
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName TCPSocket Telephony
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName TelephonyCall Text
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName TextDecoder TextEncoder
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName TextMetrics TimeRanges
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Touch TouchList
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Transferable TreeWalker
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Uint16Array Uint32Array
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Uint8Array Uint8ClampedArray
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName URLSearchParams
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName URLUtilsReadOnly
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName UserProximityEvent
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName ValidityState VideoPlaybackQuality
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName WaveShaperNode WebBluetooth
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName WebGLRenderingContext
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName WebSMS WebSocket
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName WebVTT WifiManager
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName Window Worker WorkerConsole
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName WorkerLocation WorkerNavigator
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName XDomainRequest XMLDocument
+  syntax keyword typescriptBOM containedin=typescriptIdentifierName XMLHttpRequestEventTarget
+  hi def link typescriptBOM Structure
+
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName applicationCache
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName closed
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName Components
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName controllers
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName dialogArguments
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName document
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName frameElement
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName frames
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName fullScreen
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName history
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName innerHeight
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName innerWidth
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName length
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName location
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName locationbar
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName menubar
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName messageManager
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName name navigator
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName opener
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName outerHeight
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName outerWidth
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName pageXOffset
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName pageYOffset
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName parent
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName performance
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName personalbar
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName returnValue
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screen
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screenX
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screenY
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollbars
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollMaxX
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollMaxY
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollX
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollY
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName self sidebar
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName status
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName statusbar
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName toolbar
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName top visualViewport
+  syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName window
+  syntax cluster props add=typescriptBOMWindowProp
+  hi def link typescriptBOMWindowProp Structure
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName alert nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName atob nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName blur nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName btoa nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearImmediate nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearInterval nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearTimeout nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName close nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName confirm nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName dispatchEvent nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName find nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName focus nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getAttention nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getAttentionWithCycleCount nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getComputedStyle nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getDefaulComputedStyle nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getSelection nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName matchMedia nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName maximize nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName moveBy nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName moveTo nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName open nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName openDialog nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName postMessage nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName print nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName prompt nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName removeEventListener nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName resizeBy nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName resizeTo nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName restore nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scroll nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollBy nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollByLines nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollByPages nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollTo nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setCursor nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setImmediate nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setInterval nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setResizable nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setTimeout nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName showModalDialog nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName sizeToContent nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName stop nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName updateCommands nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptBOMWindowMethod
+  hi def link typescriptBOMWindowMethod Structure
+  syntax keyword typescriptBOMWindowEvent contained onabort onbeforeunload onblur onchange
+  syntax keyword typescriptBOMWindowEvent contained onclick onclose oncontextmenu ondevicelight
+  syntax keyword typescriptBOMWindowEvent contained ondevicemotion ondeviceorientation
+  syntax keyword typescriptBOMWindowEvent contained ondeviceproximity ondragdrop onerror
+  syntax keyword typescriptBOMWindowEvent contained onfocus onhashchange onkeydown onkeypress
+  syntax keyword typescriptBOMWindowEvent contained onkeyup onload onmousedown onmousemove
+  syntax keyword typescriptBOMWindowEvent contained onmouseout onmouseover onmouseup
+  syntax keyword typescriptBOMWindowEvent contained onmozbeforepaint onpaint onpopstate
+  syntax keyword typescriptBOMWindowEvent contained onreset onresize onscroll onselect
+  syntax keyword typescriptBOMWindowEvent contained onsubmit onunload onuserproximity
+  syntax keyword typescriptBOMWindowEvent contained onpageshow onpagehide
+  hi def link typescriptBOMWindowEvent Keyword
+  syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName DOMParser
+  syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName QueryInterface
+  syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName XMLSerializer
+  hi def link typescriptBOMWindowCons Structure
+
+  syntax keyword typescriptBOMNavigatorProp contained battery buildID connection cookieEnabled
+  syntax keyword typescriptBOMNavigatorProp contained doNotTrack maxTouchPoints oscpu
+  syntax keyword typescriptBOMNavigatorProp contained productSub push serviceWorker
+  syntax keyword typescriptBOMNavigatorProp contained vendor vendorSub
+  syntax cluster props add=typescriptBOMNavigatorProp
+  hi def link typescriptBOMNavigatorProp Keyword
+  syntax keyword typescriptBOMNavigatorMethod contained addIdleObserver geolocation nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMNavigatorMethod contained getDeviceStorage getDeviceStorages nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMNavigatorMethod contained getGamepads getUserMedia registerContentHandler nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMNavigatorMethod contained removeIdleObserver requestWakeLock nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMNavigatorMethod contained share vibrate watch registerProtocolHandler nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptBOMNavigatorMethod contained sendBeacon nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptBOMNavigatorMethod
+  hi def link typescriptBOMNavigatorMethod Keyword
+  syntax keyword typescriptServiceWorkerMethod contained register nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptServiceWorkerMethod
+  hi def link typescriptServiceWorkerMethod Keyword
+
+  syntax keyword typescriptBOMLocationProp contained href protocol host hostname port
+  syntax keyword typescriptBOMLocationProp contained pathname search hash username password
+  syntax keyword typescriptBOMLocationProp contained origin
+  syntax cluster props add=typescriptBOMLocationProp
+  hi def link typescriptBOMLocationProp Keyword
+  syntax keyword typescriptBOMLocationMethod contained assign reload replace toString nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptBOMLocationMethod
+  hi def link typescriptBOMLocationMethod Keyword
+
+  syntax keyword typescriptBOMHistoryProp contained length current next previous state
+  syntax keyword typescriptBOMHistoryProp contained scrollRestoration
+  syntax cluster props add=typescriptBOMHistoryProp
+  hi def link typescriptBOMHistoryProp Keyword
+  syntax keyword typescriptBOMHistoryMethod contained back forward go pushState replaceState nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptBOMHistoryMethod
+  hi def link typescriptBOMHistoryMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName console
+  syntax keyword typescriptConsoleMethod contained count dir error group groupCollapsed nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptConsoleMethod contained groupEnd info log time timeEnd trace nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptConsoleMethod contained warn nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptConsoleMethod
+  hi def link typescriptConsoleMethod Keyword
+
+  syntax keyword typescriptXHRGlobal containedin=typescriptIdentifierName XMLHttpRequest
+  hi def link typescriptXHRGlobal Structure
+  syntax keyword typescriptXHRProp contained onreadystatechange readyState response
+  syntax keyword typescriptXHRProp contained responseText responseType responseXML status
+  syntax keyword typescriptXHRProp contained statusText timeout ontimeout upload withCredentials
+  syntax cluster props add=typescriptXHRProp
+  hi def link typescriptXHRProp Keyword
+  syntax keyword typescriptXHRMethod contained abort getAllResponseHeaders getResponseHeader nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptXHRMethod contained open overrideMimeType send setRequestHeader nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptXHRMethod
+  hi def link typescriptXHRMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Blob BlobBuilder
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName File FileReader
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName FileReaderSync
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName URL nextgroup=typescriptGlobalURLDot,typescriptFuncCallArg
+  syntax match   typescriptGlobalURLDot /\./ contained nextgroup=typescriptURLStaticMethod,typescriptProp
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName URLUtils
+  syntax keyword typescriptFileMethod contained readAsArrayBuffer readAsBinaryString nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptFileMethod contained readAsDataURL readAsText nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptFileMethod
+  hi def link typescriptFileMethod Keyword
+  syntax keyword typescriptFileReaderProp contained error readyState result
+  syntax cluster props add=typescriptFileReaderProp
+  hi def link typescriptFileReaderProp Keyword
+  syntax keyword typescriptFileReaderMethod contained abort readAsArrayBuffer readAsBinaryString nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptFileReaderMethod contained readAsDataURL readAsText nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptFileReaderMethod
+  hi def link typescriptFileReaderMethod Keyword
+  syntax keyword typescriptFileListMethod contained item nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptFileListMethod
+  hi def link typescriptFileListMethod Keyword
+  syntax keyword typescriptBlobMethod contained append getBlob getFile nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptBlobMethod
+  hi def link typescriptBlobMethod Keyword
+  syntax keyword typescriptURLUtilsProp contained hash host hostname href origin password
+  syntax keyword typescriptURLUtilsProp contained pathname port protocol search searchParams
+  syntax keyword typescriptURLUtilsProp contained username
+  syntax cluster props add=typescriptURLUtilsProp
+  hi def link typescriptURLUtilsProp Keyword
+  syntax keyword typescriptURLStaticMethod contained createObjectURL revokeObjectURL nextgroup=typescriptFuncCallArg
+  hi def link typescriptURLStaticMethod Keyword
+
+  syntax keyword typescriptCryptoGlobal containedin=typescriptIdentifierName crypto
+  hi def link typescriptCryptoGlobal Structure
+  syntax keyword typescriptSubtleCryptoMethod contained encrypt decrypt sign verify nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptSubtleCryptoMethod contained digest nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptSubtleCryptoMethod
+  hi def link typescriptSubtleCryptoMethod Keyword
+  syntax keyword typescriptCryptoProp contained subtle
+  syntax cluster props add=typescriptCryptoProp
+  hi def link typescriptCryptoProp Keyword
+  syntax keyword typescriptCryptoMethod contained getRandomValues nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptCryptoMethod
+  hi def link typescriptCryptoMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Headers Request
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Response
+  syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName fetch nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptGlobalMethod
+  hi def link typescriptGlobalMethod Structure
+  syntax keyword typescriptHeadersMethod contained append delete get getAll has set nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptHeadersMethod
+  hi def link typescriptHeadersMethod Keyword
+  syntax keyword typescriptRequestProp contained method url headers context referrer
+  syntax keyword typescriptRequestProp contained mode credentials cache
+  syntax cluster props add=typescriptRequestProp
+  hi def link typescriptRequestProp Keyword
+  syntax keyword typescriptRequestMethod contained clone nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptRequestMethod
+  hi def link typescriptRequestMethod Keyword
+  syntax keyword typescriptResponseProp contained type url status statusText headers
+  syntax keyword typescriptResponseProp contained redirected
+  syntax cluster props add=typescriptResponseProp
+  hi def link typescriptResponseProp Keyword
+  syntax keyword typescriptResponseMethod contained clone nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptResponseMethod
+  hi def link typescriptResponseMethod Keyword
+
+  syntax keyword typescriptServiceWorkerProp contained controller ready
+  syntax cluster props add=typescriptServiceWorkerProp
+  hi def link typescriptServiceWorkerProp Keyword
+  syntax keyword typescriptServiceWorkerMethod contained register getRegistration nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptServiceWorkerMethod
+  hi def link typescriptServiceWorkerMethod Keyword
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Cache
+  syntax keyword typescriptCacheMethod contained match matchAll add addAll put delete nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptCacheMethod contained keys nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptCacheMethod
+  hi def link typescriptCacheMethod Keyword
+
+  syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextEncoder
+  syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextDecoder
+  hi def link typescriptEncodingGlobal Structure
+  syntax keyword typescriptEncodingProp contained encoding fatal ignoreBOM
+  syntax cluster props add=typescriptEncodingProp
+  hi def link typescriptEncodingProp Keyword
+  syntax keyword typescriptEncodingMethod contained encode decode nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptEncodingMethod
+  hi def link typescriptEncodingMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName Geolocation
+  syntax keyword typescriptGeolocationMethod contained getCurrentPosition watchPosition nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptGeolocationMethod contained clearWatch nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptGeolocationMethod
+  hi def link typescriptGeolocationMethod Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName NetworkInformation
+  syntax keyword typescriptBOMNetworkProp contained downlink downlinkMax effectiveType
+  syntax keyword typescriptBOMNetworkProp contained rtt type
+  syntax cluster props add=typescriptBOMNetworkProp
+  hi def link typescriptBOMNetworkProp Keyword
+
+  syntax keyword typescriptGlobal containedin=typescriptIdentifierName PaymentRequest
+  syntax keyword typescriptPaymentMethod contained show abort canMakePayment nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptPaymentMethod
+  hi def link typescriptPaymentMethod Keyword
+  syntax keyword typescriptPaymentProp contained shippingAddress shippingOption result
+  syntax cluster props add=typescriptPaymentProp
+  hi def link typescriptPaymentProp Keyword
+  syntax keyword typescriptPaymentEvent contained onshippingaddresschange onshippingoptionchange
+  hi def link typescriptPaymentEvent Keyword
+  syntax keyword typescriptPaymentResponseMethod contained complete nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptPaymentResponseMethod
+  hi def link typescriptPaymentResponseMethod Keyword
+  syntax keyword typescriptPaymentResponseProp contained details methodName payerEmail
+  syntax keyword typescriptPaymentResponseProp contained payerPhone shippingAddress
+  syntax keyword typescriptPaymentResponseProp contained shippingOption
+  syntax cluster props add=typescriptPaymentResponseProp
+  hi def link typescriptPaymentResponseProp Keyword
+  syntax keyword typescriptPaymentAddressProp contained addressLine careOf city country
+  syntax keyword typescriptPaymentAddressProp contained country dependentLocality languageCode
+  syntax keyword typescriptPaymentAddressProp contained organization phone postalCode
+  syntax keyword typescriptPaymentAddressProp contained recipient region sortingCode
+  syntax cluster props add=typescriptPaymentAddressProp
+  hi def link typescriptPaymentAddressProp Keyword
+  syntax keyword typescriptPaymentShippingOptionProp contained id label amount selected
+  syntax cluster props add=typescriptPaymentShippingOptionProp
+  hi def link typescriptPaymentShippingOptionProp Keyword
+
+  syntax keyword typescriptDOMNodeProp contained attributes baseURI baseURIObject childNodes
+  syntax keyword typescriptDOMNodeProp contained firstChild lastChild localName namespaceURI
+  syntax keyword typescriptDOMNodeProp contained nextSibling nodeName nodePrincipal
+  syntax keyword typescriptDOMNodeProp contained nodeType nodeValue ownerDocument parentElement
+  syntax keyword typescriptDOMNodeProp contained parentNode prefix previousSibling textContent
+  syntax cluster props add=typescriptDOMNodeProp
+  hi def link typescriptDOMNodeProp Keyword
+  syntax keyword typescriptDOMNodeMethod contained appendChild cloneNode compareDocumentPosition nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMNodeMethod contained getUserData hasAttributes hasChildNodes nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMNodeMethod contained insertBefore isDefaultNamespace isEqualNode nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMNodeMethod contained isSameNode isSupported lookupNamespaceURI nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMNodeMethod contained lookupPrefix normalize removeChild nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMNodeMethod contained replaceChild setUserData nextgroup=typescriptFuncCallArg
+  syntax match typescriptDOMNodeMethod contained /contains/
+  syntax cluster props add=typescriptDOMNodeMethod
+  hi def link typescriptDOMNodeMethod Keyword
+  syntax keyword typescriptDOMNodeType contained ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE
+  syntax keyword typescriptDOMNodeType contained CDATA_SECTION_NODEN_NODE ENTITY_REFERENCE_NODE
+  syntax keyword typescriptDOMNodeType contained ENTITY_NODE PROCESSING_INSTRUCTION_NODEN_NODE
+  syntax keyword typescriptDOMNodeType contained COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE
+  syntax keyword typescriptDOMNodeType contained DOCUMENT_FRAGMENT_NODE NOTATION_NODE
+  hi def link typescriptDOMNodeType Keyword
+
+  syntax keyword typescriptDOMElemAttrs contained accessKey clientHeight clientLeft
+  syntax keyword typescriptDOMElemAttrs contained clientTop clientWidth id innerHTML
+  syntax keyword typescriptDOMElemAttrs contained length onafterscriptexecute onbeforescriptexecute
+  syntax keyword typescriptDOMElemAttrs contained oncopy oncut onpaste onwheel scrollHeight
+  syntax keyword typescriptDOMElemAttrs contained scrollLeft scrollTop scrollWidth tagName
+  syntax keyword typescriptDOMElemAttrs contained classList className name outerHTML
+  syntax keyword typescriptDOMElemAttrs contained style
+  hi def link typescriptDOMElemAttrs Keyword
+  syntax keyword typescriptDOMElemFuncs contained getAttributeNS getAttributeNode getAttributeNodeNS
+  syntax keyword typescriptDOMElemFuncs contained getBoundingClientRect getClientRects
+  syntax keyword typescriptDOMElemFuncs contained getElementsByClassName getElementsByTagName
+  syntax keyword typescriptDOMElemFuncs contained getElementsByTagNameNS hasAttribute
+  syntax keyword typescriptDOMElemFuncs contained hasAttributeNS insertAdjacentHTML
+  syntax keyword typescriptDOMElemFuncs contained matches querySelector querySelectorAll
+  syntax keyword typescriptDOMElemFuncs contained removeAttribute removeAttributeNS
+  syntax keyword typescriptDOMElemFuncs contained removeAttributeNode requestFullscreen
+  syntax keyword typescriptDOMElemFuncs contained requestPointerLock scrollIntoView
+  syntax keyword typescriptDOMElemFuncs contained setAttribute setAttributeNS setAttributeNode
+  syntax keyword typescriptDOMElemFuncs contained setAttributeNodeNS setCapture supports
+  syntax keyword typescriptDOMElemFuncs contained getAttribute
+  hi def link typescriptDOMElemFuncs Keyword
+
+  syntax keyword typescriptDOMDocProp contained activeElement body cookie defaultView
+  syntax keyword typescriptDOMDocProp contained designMode dir domain embeds forms head
+  syntax keyword typescriptDOMDocProp contained images lastModified links location plugins
+  syntax keyword typescriptDOMDocProp contained postMessage readyState referrer registerElement
+  syntax keyword typescriptDOMDocProp contained scripts styleSheets title vlinkColor
+  syntax keyword typescriptDOMDocProp contained xmlEncoding characterSet compatMode
+  syntax keyword typescriptDOMDocProp contained contentType currentScript doctype documentElement
+  syntax keyword typescriptDOMDocProp contained documentURI documentURIObject firstChild
+  syntax keyword typescriptDOMDocProp contained implementation lastStyleSheetSet namespaceURI
+  syntax keyword typescriptDOMDocProp contained nodePrincipal ononline pointerLockElement
+  syntax keyword typescriptDOMDocProp contained popupNode preferredStyleSheetSet selectedStyleSheetSet
+  syntax keyword typescriptDOMDocProp contained styleSheetSets textContent tooltipNode
+  syntax cluster props add=typescriptDOMDocProp
+  hi def link typescriptDOMDocProp Keyword
+  syntax keyword typescriptDOMDocMethod contained caretPositionFromPoint close createNodeIterator nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained createRange createTreeWalker elementFromPoint nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained getElementsByName adoptNode createAttribute nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained createCDATASection createComment createDocumentFragment nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained createElement createElementNS createEvent nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained createExpression createNSResolver nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained createProcessingInstruction createTextNode nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained enableStyleSheetsForSet evaluate execCommand nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained exitPointerLock getBoxObjectFor getElementById nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained getElementsByClassName getElementsByTagName nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained getElementsByTagNameNS getSelection nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained hasFocus importNode loadOverlay open nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained queryCommandSupported querySelector nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMDocMethod contained querySelectorAll write writeln nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptDOMDocMethod
+  hi def link typescriptDOMDocMethod Keyword
+
+  syntax keyword typescriptDOMEventTargetMethod contained addEventListener removeEventListener nextgroup=typescriptEventFuncCallArg
+  syntax keyword typescriptDOMEventTargetMethod contained dispatchEvent waitUntil nextgroup=typescriptEventFuncCallArg
+  syntax cluster props add=typescriptDOMEventTargetMethod
+  hi def link typescriptDOMEventTargetMethod Keyword
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName AnimationEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName AudioProcessingEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BeforeInputEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BeforeUnloadEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BlobEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ClipboardEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CloseEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CompositionEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CSSFontFaceLoadEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CustomEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceLightEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceMotionEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceOrientationEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceProximityEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DOMTransactionEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DragEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName EditingBeforeInputEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ErrorEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName FocusEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName GamepadEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName HashChangeEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName IDBVersionChangeEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName KeyboardEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MediaStreamEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MessageEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MouseEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MutationEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName OfflineAudioCompletionEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PageTransitionEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PointerEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PopStateEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ProgressEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName RelatedEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName RTCPeerConnectionIceEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SensorEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName StorageEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SVGEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SVGZoomEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TimeEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TouchEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TrackEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TransitionEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName UIEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName UserProximityEvent
+  syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName WheelEvent
+  hi def link typescriptDOMEventCons Structure
+  syntax keyword typescriptDOMEventProp contained bubbles cancelable currentTarget defaultPrevented
+  syntax keyword typescriptDOMEventProp contained eventPhase target timeStamp type isTrusted
+  syntax keyword typescriptDOMEventProp contained isReload
+  syntax cluster props add=typescriptDOMEventProp
+  hi def link typescriptDOMEventProp Keyword
+  syntax keyword typescriptDOMEventMethod contained initEvent preventDefault stopImmediatePropagation nextgroup=typescriptEventFuncCallArg
+  syntax keyword typescriptDOMEventMethod contained stopPropagation respondWith default nextgroup=typescriptEventFuncCallArg
+  syntax cluster props add=typescriptDOMEventMethod
+  hi def link typescriptDOMEventMethod Keyword
+
+  syntax keyword typescriptDOMStorage contained sessionStorage localStorage
+  hi def link typescriptDOMStorage Keyword
+  syntax keyword typescriptDOMStorageProp contained length
+  syntax cluster props add=typescriptDOMStorageProp
+  hi def link typescriptDOMStorageProp Keyword
+  syntax keyword typescriptDOMStorageMethod contained getItem key setItem removeItem nextgroup=typescriptFuncCallArg
+  syntax keyword typescriptDOMStorageMethod contained clear nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptDOMStorageMethod
+  hi def link typescriptDOMStorageMethod Keyword
+
+  syntax keyword typescriptDOMFormProp contained acceptCharset action elements encoding
+  syntax keyword typescriptDOMFormProp contained enctype length method name target
+  syntax cluster props add=typescriptDOMFormProp
+  hi def link typescriptDOMFormProp Keyword
+  syntax keyword typescriptDOMFormMethod contained reportValidity reset submit nextgroup=typescriptFuncCallArg
+  syntax cluster props add=typescriptDOMFormMethod
+  hi def link typescriptDOMFormMethod Keyword
+
+  syntax keyword typescriptDOMStyle contained alignContent alignItems alignSelf animation
+  syntax keyword typescriptDOMStyle contained animationDelay animationDirection animationDuration
+  syntax keyword typescriptDOMStyle contained animationFillMode animationIterationCount
+  syntax keyword typescriptDOMStyle contained animationName animationPlayState animationTimingFunction
+  syntax keyword typescriptDOMStyle contained appearance backfaceVisibility background
+  syntax keyword typescriptDOMStyle contained backgroundAttachment backgroundBlendMode
+  syntax keyword typescriptDOMStyle contained backgroundClip backgroundColor backgroundImage
+  syntax keyword typescriptDOMStyle contained backgroundOrigin backgroundPosition backgroundRepeat
+  syntax keyword typescriptDOMStyle contained backgroundSize border borderBottom borderBottomColor
+  syntax keyword typescriptDOMStyle contained borderBottomLeftRadius borderBottomRightRadius
+  syntax keyword typescriptDOMStyle contained borderBottomStyle borderBottomWidth borderCollapse
+  syntax keyword typescriptDOMStyle contained borderColor borderImage borderImageOutset
+  syntax keyword typescriptDOMStyle contained borderImageRepeat borderImageSlice borderImageSource
+  syntax keyword typescriptDOMStyle contained borderImageWidth borderLeft borderLeftColor
+  syntax keyword typescriptDOMStyle contained borderLeftStyle borderLeftWidth borderRadius
+  syntax keyword typescriptDOMStyle contained borderRight borderRightColor borderRightStyle
+  syntax keyword typescriptDOMStyle contained borderRightWidth borderSpacing borderStyle
+  syntax keyword typescriptDOMStyle contained borderTop borderTopColor borderTopLeftRadius
+  syntax keyword typescriptDOMStyle contained borderTopRightRadius borderTopStyle borderTopWidth
+  syntax keyword typescriptDOMStyle contained borderWidth bottom boxDecorationBreak
+  syntax keyword typescriptDOMStyle contained boxShadow boxSizing breakAfter breakBefore
+  syntax keyword typescriptDOMStyle contained breakInside captionSide caretColor caretShape
+  syntax keyword typescriptDOMStyle contained caret clear clip clipPath color columns
+  syntax keyword typescriptDOMStyle contained columnCount columnFill columnGap columnRule
+  syntax keyword typescriptDOMStyle contained columnRuleColor columnRuleStyle columnRuleWidth
+  syntax keyword typescriptDOMStyle contained columnSpan columnWidth content counterIncrement
+  syntax keyword typescriptDOMStyle contained counterReset cursor direction display
+  syntax keyword typescriptDOMStyle contained emptyCells flex flexBasis flexDirection
+  syntax keyword typescriptDOMStyle contained flexFlow flexGrow flexShrink flexWrap
+  syntax keyword typescriptDOMStyle contained float font fontFamily fontFeatureSettings
+  syntax keyword typescriptDOMStyle contained fontKerning fontLanguageOverride fontSize
+  syntax keyword typescriptDOMStyle contained fontSizeAdjust fontStretch fontStyle fontSynthesis
+  syntax keyword typescriptDOMStyle contained fontVariant fontVariantAlternates fontVariantCaps
+  syntax keyword typescriptDOMStyle contained fontVariantEastAsian fontVariantLigatures
+  syntax keyword typescriptDOMStyle contained fontVariantNumeric fontVariantPosition
+  syntax keyword typescriptDOMStyle contained fontWeight grad grid gridArea gridAutoColumns
+  syntax keyword typescriptDOMStyle contained gridAutoFlow gridAutoPosition gridAutoRows
+  syntax keyword typescriptDOMStyle contained gridColumn gridColumnStart gridColumnEnd
+  syntax keyword typescriptDOMStyle contained gridRow gridRowStart gridRowEnd gridTemplate
+  syntax keyword typescriptDOMStyle contained gridTemplateAreas gridTemplateRows gridTemplateColumns
+  syntax keyword typescriptDOMStyle contained height hyphens imageRendering imageResolution
+  syntax keyword typescriptDOMStyle contained imageOrientation imeMode inherit justifyContent
+  syntax keyword typescriptDOMStyle contained left letterSpacing lineBreak lineHeight
+  syntax keyword typescriptDOMStyle contained listStyle listStyleImage listStylePosition
+  syntax keyword typescriptDOMStyle contained listStyleType margin marginBottom marginLeft
+  syntax keyword typescriptDOMStyle contained marginRight marginTop marks mask maskType
+  syntax keyword typescriptDOMStyle contained maxHeight maxWidth minHeight minWidth
+  syntax keyword typescriptDOMStyle contained mixBlendMode objectFit objectPosition
+  syntax keyword typescriptDOMStyle contained opacity order orphans outline outlineColor
+  syntax keyword typescriptDOMStyle contained outlineOffset outlineStyle outlineWidth
+  syntax keyword typescriptDOMStyle contained overflow overflowWrap overflowX overflowY
+  syntax keyword typescriptDOMStyle contained overflowClipBox padding paddingBottom
+  syntax keyword typescriptDOMStyle contained paddingLeft paddingRight paddingTop pageBreakAfter
+  syntax keyword typescriptDOMStyle contained pageBreakBefore pageBreakInside perspective
+  syntax keyword typescriptDOMStyle contained perspectiveOrigin pointerEvents position
+  syntax keyword typescriptDOMStyle contained quotes resize right shapeImageThreshold
+  syntax keyword typescriptDOMStyle contained shapeMargin shapeOutside tableLayout tabSize
+  syntax keyword typescriptDOMStyle contained textAlign textAlignLast textCombineHorizontal
+  syntax keyword typescriptDOMStyle contained textDecoration textDecorationColor textDecorationLine
+  syntax keyword typescriptDOMStyle contained textDecorationStyle textIndent textOrientation
+  syntax keyword typescriptDOMStyle contained textOverflow textRendering textShadow
+  syntax keyword typescriptDOMStyle contained textTransform textUnderlinePosition top
+  syntax keyword typescriptDOMStyle contained touchAction transform transformOrigin
+  syntax keyword typescriptDOMStyle contained transformStyle transition transitionDelay
+  syntax keyword typescriptDOMStyle contained transitionDuration transitionProperty
+  syntax keyword typescriptDOMStyle contained transitionTimingFunction unicodeBidi unicodeRange
+  syntax keyword typescriptDOMStyle contained userSelect userZoom verticalAlign visibility
+  syntax keyword typescriptDOMStyle contained whiteSpace width willChange wordBreak
+  syntax keyword typescriptDOMStyle contained wordSpacing wordWrap writingMode zIndex
+  hi def link typescriptDOMStyle Keyword
+
+
+
+  let typescript_props = 1
+  syntax keyword typescriptAnimationEvent contained animationend animationiteration
+  syntax keyword typescriptAnimationEvent contained animationstart beginEvent endEvent
+  syntax keyword typescriptAnimationEvent contained repeatEvent
+  syntax cluster events add=typescriptAnimationEvent
+  hi def link typescriptAnimationEvent Title
+  syntax keyword typescriptCSSEvent contained CssRuleViewRefreshed CssRuleViewChanged
+  syntax keyword typescriptCSSEvent contained CssRuleViewCSSLinkClicked transitionend
+  syntax cluster events add=typescriptCSSEvent
+  hi def link typescriptCSSEvent Title
+  syntax keyword typescriptDatabaseEvent contained blocked complete error success upgradeneeded
+  syntax keyword typescriptDatabaseEvent contained versionchange
+  syntax cluster events add=typescriptDatabaseEvent
+  hi def link typescriptDatabaseEvent Title
+  syntax keyword typescriptDocumentEvent contained DOMLinkAdded DOMLinkRemoved DOMMetaAdded
+  syntax keyword typescriptDocumentEvent contained DOMMetaRemoved DOMWillOpenModalDialog
+  syntax keyword typescriptDocumentEvent contained DOMModalDialogClosed unload
+  syntax cluster events add=typescriptDocumentEvent
+  hi def link typescriptDocumentEvent Title
+  syntax keyword typescriptDOMMutationEvent contained DOMAttributeNameChanged DOMAttrModified
+  syntax keyword typescriptDOMMutationEvent contained DOMCharacterDataModified DOMContentLoaded
+  syntax keyword typescriptDOMMutationEvent contained DOMElementNameChanged DOMNodeInserted
+  syntax keyword typescriptDOMMutationEvent contained DOMNodeInsertedIntoDocument DOMNodeRemoved
+  syntax keyword typescriptDOMMutationEvent contained DOMNodeRemovedFromDocument DOMSubtreeModified
+  syntax cluster events add=typescriptDOMMutationEvent
+  hi def link typescriptDOMMutationEvent Title
+  syntax keyword typescriptDragEvent contained drag dragdrop dragend dragenter dragexit
+  syntax keyword typescriptDragEvent contained draggesture dragleave dragover dragstart
+  syntax keyword typescriptDragEvent contained drop
+  syntax cluster events add=typescriptDragEvent
+  hi def link typescriptDragEvent Title
+  syntax keyword typescriptElementEvent contained invalid overflow underflow DOMAutoComplete
+  syntax keyword typescriptElementEvent contained command commandupdate
+  syntax cluster events add=typescriptElementEvent
+  hi def link typescriptElementEvent Title
+  syntax keyword typescriptFocusEvent contained blur change DOMFocusIn DOMFocusOut focus
+  syntax keyword typescriptFocusEvent contained focusin focusout
+  syntax cluster events add=typescriptFocusEvent
+  hi def link typescriptFocusEvent Title
+  syntax keyword typescriptFormEvent contained reset submit
+  syntax cluster events add=typescriptFormEvent
+  hi def link typescriptFormEvent Title
+  syntax keyword typescriptFrameEvent contained DOMFrameContentLoaded
+  syntax cluster events add=typescriptFrameEvent
+  hi def link typescriptFrameEvent Title
+  syntax keyword typescriptInputDeviceEvent contained click contextmenu DOMMouseScroll
+  syntax keyword typescriptInputDeviceEvent contained dblclick gamepadconnected gamepaddisconnected
+  syntax keyword typescriptInputDeviceEvent contained keydown keypress keyup MozGamepadButtonDown
+  syntax keyword typescriptInputDeviceEvent contained MozGamepadButtonUp mousedown mouseenter
+  syntax keyword typescriptInputDeviceEvent contained mouseleave mousemove mouseout
+  syntax keyword typescriptInputDeviceEvent contained mouseover mouseup mousewheel MozMousePixelScroll
+  syntax keyword typescriptInputDeviceEvent contained pointerlockchange pointerlockerror
+  syntax keyword typescriptInputDeviceEvent contained wheel
+  syntax cluster events add=typescriptInputDeviceEvent
+  hi def link typescriptInputDeviceEvent Title
+  syntax keyword typescriptMediaEvent contained audioprocess canplay canplaythrough
+  syntax keyword typescriptMediaEvent contained durationchange emptied ended ended loadeddata
+  syntax keyword typescriptMediaEvent contained loadedmetadata MozAudioAvailable pause
+  syntax keyword typescriptMediaEvent contained play playing ratechange seeked seeking
+  syntax keyword typescriptMediaEvent contained stalled suspend timeupdate volumechange
+  syntax keyword typescriptMediaEvent contained waiting complete
+  syntax cluster events add=typescriptMediaEvent
+  hi def link typescriptMediaEvent Title
+  syntax keyword typescriptMenuEvent contained DOMMenuItemActive DOMMenuItemInactive
+  syntax cluster events add=typescriptMenuEvent
+  hi def link typescriptMenuEvent Title
+  syntax keyword typescriptNetworkEvent contained datachange dataerror disabled enabled
+  syntax keyword typescriptNetworkEvent contained offline online statuschange connectionInfoUpdate
+  syntax cluster events add=typescriptNetworkEvent
+  hi def link typescriptNetworkEvent Title
+  syntax keyword typescriptProgressEvent contained abort error load loadend loadstart
+  syntax keyword typescriptProgressEvent contained progress timeout uploadprogress
+  syntax cluster events add=typescriptProgressEvent
+  hi def link typescriptProgressEvent Title
+  syntax keyword typescriptResourceEvent contained cached error load
+  syntax cluster events add=typescriptResourceEvent
+  hi def link typescriptResourceEvent Title
+  syntax keyword typescriptScriptEvent contained afterscriptexecute beforescriptexecute
+  syntax cluster events add=typescriptScriptEvent
+  hi def link typescriptScriptEvent Title
+  syntax keyword typescriptSensorEvent contained compassneedscalibration devicelight
+  syntax keyword typescriptSensorEvent contained devicemotion deviceorientation deviceproximity
+  syntax keyword typescriptSensorEvent contained orientationchange userproximity
+  syntax cluster events add=typescriptSensorEvent
+  hi def link typescriptSensorEvent Title
+  syntax keyword typescriptSessionHistoryEvent contained pagehide pageshow popstate
+  syntax cluster events add=typescriptSessionHistoryEvent
+  hi def link typescriptSessionHistoryEvent Title
+  syntax keyword typescriptStorageEvent contained change storage
+  syntax cluster events add=typescriptStorageEvent
+  hi def link typescriptStorageEvent Title
+  syntax keyword typescriptSVGEvent contained SVGAbort SVGError SVGLoad SVGResize SVGScroll
+  syntax keyword typescriptSVGEvent contained SVGUnload SVGZoom
+  syntax cluster events add=typescriptSVGEvent
+  hi def link typescriptSVGEvent Title
+  syntax keyword typescriptTabEvent contained visibilitychange
+  syntax cluster events add=typescriptTabEvent
+  hi def link typescriptTabEvent Title
+  syntax keyword typescriptTextEvent contained compositionend compositionstart compositionupdate
+  syntax keyword typescriptTextEvent contained copy cut paste select text
+  syntax cluster events add=typescriptTextEvent
+  hi def link typescriptTextEvent Title
+  syntax keyword typescriptTouchEvent contained touchcancel touchend touchenter touchleave
+  syntax keyword typescriptTouchEvent contained touchmove touchstart
+  syntax cluster events add=typescriptTouchEvent
+  hi def link typescriptTouchEvent Title
+  syntax keyword typescriptUpdateEvent contained checking downloading error noupdate
+  syntax keyword typescriptUpdateEvent contained obsolete updateready
+  syntax cluster events add=typescriptUpdateEvent
+  hi def link typescriptUpdateEvent Title
+  syntax keyword typescriptValueChangeEvent contained hashchange input readystatechange
+  syntax cluster events add=typescriptValueChangeEvent
+  hi def link typescriptValueChangeEvent Title
+  syntax keyword typescriptViewEvent contained fullscreen fullscreenchange fullscreenerror
+  syntax keyword typescriptViewEvent contained resize scroll
+  syntax cluster events add=typescriptViewEvent
+  hi def link typescriptViewEvent Title
+  syntax keyword typescriptWebsocketEvent contained close error message open
+  syntax cluster events add=typescriptWebsocketEvent
+  hi def link typescriptWebsocketEvent Title
+  syntax keyword typescriptWindowEvent contained DOMWindowCreated DOMWindowClose DOMTitleChanged
+  syntax cluster events add=typescriptWindowEvent
+  hi def link typescriptWindowEvent Title
+  syntax keyword typescriptUncategorizedEvent contained beforeunload message open show
+  syntax cluster events add=typescriptUncategorizedEvent
+  hi def link typescriptUncategorizedEvent Title
+  syntax keyword typescriptServiceWorkerEvent contained install activate fetch
+  syntax cluster events add=typescriptServiceWorkerEvent
+  hi def link typescriptServiceWorkerEvent Title
+
+
+endif
+
+" patch
+" patch for generated code
+syntax keyword typescriptGlobal Promise
+  \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline
+syntax keyword typescriptGlobal Map WeakMap
+  \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline
+
+syntax keyword typescriptConstructor           contained constructor
+  \ nextgroup=@typescriptCallSignature
+  \ skipwhite skipempty
+
+
+syntax cluster memberNextGroup contains=typescriptMemberOptionality,typescriptTypeAnnotation,@typescriptCallSignature
+
+syntax match typescriptMember /#\?\K\k*/
+  \ nextgroup=@memberNextGroup
+  \ contained skipwhite
+
+syntax match typescriptMethodAccessor contained /\v(get|set)\s\K/me=e-1
+  \ nextgroup=@typescriptMembers
+
+syntax cluster typescriptPropertyMemberDeclaration contains=
+  \ typescriptClassStatic,
+  \ typescriptAccessibilityModifier,
+  \ typescriptReadonlyModifier,
+  \ typescriptMethodAccessor,
+  \ @typescriptMembers
+  " \ typescriptMemberVariableDeclaration
+
+syntax match typescriptMemberOptionality /?\|!/ contained
+  \ nextgroup=typescriptTypeAnnotation,@typescriptCallSignature
+  \ skipwhite skipempty
+
+syntax cluster typescriptMembers contains=typescriptMember,typescriptStringMember,typescriptComputedMember
+
+syntax keyword typescriptClassStatic static
+  \ nextgroup=@typescriptMembers,typescriptAsyncFuncKeyword,typescriptReadonlyModifier
+  \ skipwhite contained
+
+syntax keyword typescriptAccessibilityModifier public private protected contained
+
+syntax keyword typescriptReadonlyModifier readonly contained
+
+syntax region  typescriptStringMember   contained
+  \ start=/\z(["']\)/  skip=/\\\\\|\\\z1\|\\\n/  end=/\z1/
+  \ nextgroup=@memberNextGroup
+  \ skipwhite skipempty
+
+syntax region  typescriptComputedMember   contained matchgroup=typescriptProperty
+  \ start=/\[/rs=s+1 end=/]/
+  \ contains=@typescriptValue,typescriptMember,typescriptMappedIn
+  \ nextgroup=@memberNextGroup
+  \ skipwhite skipempty
+
+"don't add typescriptMembers to nextgroup, let outer scope match it
+" so we won't match abstract method outside abstract class
+syntax keyword typescriptAbstract              abstract
+  \ nextgroup=typescriptClassKeyword
+  \ skipwhite skipnl
+syntax keyword typescriptClassKeyword          class
+  \ nextgroup=typescriptClassName,typescriptClassExtends,typescriptClassBlock
+  \ skipwhite
+
+syntax match   typescriptClassName             contained /\K\k*/
+  \ nextgroup=typescriptClassBlock,typescriptClassExtends,typescriptClassTypeParameter
+  \ skipwhite skipnl
+
+syntax region typescriptClassTypeParameter
+  \ start=/</ end=/>/
+  \ contains=@typescriptTypeParameterCluster
+  \ nextgroup=typescriptClassBlock,typescriptClassExtends
+  \ contained skipwhite skipnl
+
+syntax keyword typescriptClassExtends          contained extends implements nextgroup=typescriptClassHeritage skipwhite skipnl
+
+syntax match   typescriptClassHeritage         contained /\v(\k|\.|\(|\))+/
+  \ nextgroup=typescriptClassBlock,typescriptClassExtends,typescriptMixinComma,typescriptClassTypeArguments
+  \ contains=@typescriptValue
+  \ skipwhite skipnl
+  \ contained
+
+syntax region typescriptClassTypeArguments matchgroup=typescriptTypeBrackets
+  \ start=/</ end=/>/
+  \ contains=@typescriptType
+  \ nextgroup=typescriptClassExtends,typescriptClassBlock,typescriptMixinComma
+  \ contained skipwhite skipnl
+
+syntax match typescriptMixinComma /,/ contained nextgroup=typescriptClassHeritage skipwhite skipnl
+
+" we need add arrowFunc to class block for high order arrow func
+" see test case
+syntax region  typescriptClassBlock matchgroup=typescriptBraces start=/{/ end=/}/
+  \ contains=@typescriptPropertyMemberDeclaration,typescriptAbstract,@typescriptComments,typescriptBlock,typescriptAssign,typescriptDecorator,typescriptAsyncFuncKeyword,typescriptArrowFunc
+  \ contained fold
+
+syntax keyword typescriptInterfaceKeyword          interface nextgroup=typescriptInterfaceName skipwhite
+syntax match   typescriptInterfaceName             contained /\k\+/
+  \ nextgroup=typescriptObjectType,typescriptInterfaceExtends,typescriptInterfaceTypeParameter
+  \ skipwhite skipnl
+syntax region typescriptInterfaceTypeParameter
+  \ start=/</ end=/>/
+  \ contains=@typescriptTypeParameterCluster
+  \ nextgroup=typescriptObjectType,typescriptInterfaceExtends
+  \ contained
+  \ skipwhite skipnl
+
+syntax keyword typescriptInterfaceExtends          contained extends nextgroup=typescriptInterfaceHeritage skipwhite skipnl
+
+syntax match typescriptInterfaceHeritage contained /\v(\k|\.)+/
+  \ nextgroup=typescriptObjectType,typescriptInterfaceComma,typescriptInterfaceTypeArguments
+  \ skipwhite
+
+syntax region typescriptInterfaceTypeArguments matchgroup=typescriptTypeBrackets
+  \ start=/</ end=/>/ skip=/\s*,\s*/
+  \ contains=@typescriptType
+  \ nextgroup=typescriptObjectType,typescriptInterfaceComma
+  \ contained skipwhite
+
+syntax match typescriptInterfaceComma /,/ contained nextgroup=typescriptInterfaceHeritage skipwhite skipnl
+
+"Block VariableStatement EmptyStatement ExpressionStatement IfStatement IterationStatement ContinueStatement BreakStatement ReturnStatement WithStatement LabelledStatement SwitchStatement ThrowStatement TryStatement DebuggerStatement
+syntax cluster typescriptStatement
+  \ contains=typescriptBlock,typescriptVariable,
+  \ @typescriptTopExpression,typescriptAssign,
+  \ typescriptConditional,typescriptRepeat,typescriptBranch,
+  \ typescriptLabel,typescriptStatementKeyword,
+  \ typescriptFuncKeyword,
+  \ typescriptTry,typescriptExceptions,typescriptDebugger,
+  \ typescriptExport,typescriptInterfaceKeyword,typescriptEnum,
+  \ typescriptModule,typescriptAliasKeyword,typescriptImport
+
+syntax cluster typescriptPrimitive  contains=typescriptString,typescriptTemplate,typescriptRegexpString,typescriptNumber,typescriptBoolean,typescriptNull,typescriptArray
+
+syntax cluster typescriptEventTypes            contains=typescriptEventString,typescriptTemplate,typescriptNumber,typescriptBoolean,typescriptNull
+
+" top level expression: no arrow func
+" also no func keyword. funcKeyword is contained in statement
+" funcKeyword allows overloading (func without body)
+" funcImpl requires body
+syntax cluster typescriptTopExpression
+  \ contains=@typescriptPrimitive,
+  \ typescriptIdentifier,typescriptIdentifierName,
+  \ typescriptOperator,typescriptUnaryOp,
+  \ typescriptParenExp,typescriptRegexpString,
+  \ typescriptGlobal,typescriptAsyncFuncKeyword,
+  \ typescriptClassKeyword,typescriptTypeCast
+
+" no object literal, used in type cast and arrow func
+" TODO: change func keyword to funcImpl
+syntax cluster typescriptExpression
+  \ contains=@typescriptTopExpression,
+  \ typescriptArrowFuncDef,
+  \ typescriptFuncImpl
+
+syntax cluster typescriptValue
+  \ contains=@typescriptExpression,typescriptObjectLiteral
+
+syntax cluster typescriptEventExpression       contains=typescriptArrowFuncDef,typescriptParenExp,@typescriptValue,typescriptRegexpString,@typescriptEventTypes,typescriptOperator,typescriptGlobal,jsxRegion
+
+syntax keyword typescriptAsyncFuncKeyword      async
+  \ nextgroup=typescriptFuncKeyword,typescriptArrowFuncDef
+  \ skipwhite
+
+syntax keyword typescriptAsyncFuncKeyword      await
+  \ nextgroup=@typescriptValue
+  \ skipwhite
+
+syntax keyword typescriptFuncKeyword           function
+  \ nextgroup=typescriptAsyncFunc,typescriptFuncName,@typescriptCallSignature
+  \ skipwhite skipempty
+
+syntax match   typescriptAsyncFunc             contained /*/
+  \ nextgroup=typescriptFuncName,@typescriptCallSignature
+  \ skipwhite skipempty
+
+syntax match   typescriptFuncName              contained /\K\k*/
+  \ nextgroup=@typescriptCallSignature
+  \ skipwhite
+
+" destructuring ({ a: ee }) =>
+syntax match   typescriptArrowFuncDef          contained /(\(\s*\({\_[^}]*}\|\k\+\)\(:\_[^)]\)\?,\?\)\+)\s*=>/
+  \ contains=typescriptArrowFuncArg,typescriptArrowFunc
+  \ nextgroup=@typescriptExpression,typescriptBlock
+  \ skipwhite skipempty
+
+" matches `(a) =>` or `([a]) =>` or
+" `(
+"  a) =>`
+syntax match   typescriptArrowFuncDef          contained /(\(\_s*[a-zA-Z\$_\[.]\_[^)]*\)*)\s*=>/
+  \ contains=typescriptArrowFuncArg,typescriptArrowFunc
+  \ nextgroup=@typescriptExpression,typescriptBlock
+  \ skipwhite skipempty
+
+syntax match   typescriptArrowFuncDef          contained /\K\k*\s*=>/
+  \ contains=typescriptArrowFuncArg,typescriptArrowFunc
+  \ nextgroup=@typescriptExpression,typescriptBlock
+  \ skipwhite skipempty
+
+" TODO: optimize this pattern
+syntax region   typescriptArrowFuncDef          contained start=/(\_[^(^)]*):/ end=/=>/
+  \ contains=typescriptArrowFuncArg,typescriptArrowFunc,typescriptTypeAnnotation
+  \ nextgroup=@typescriptExpression,typescriptBlock
+  \ skipwhite skipempty keepend
+
+syntax match   typescriptArrowFunc             /=>/
+syntax match   typescriptArrowFuncArg          contained /\K\k*/
+syntax region  typescriptArrowFuncArg          contained start=/<\|(/ end=/\ze=>/ contains=@typescriptCallSignature
+
+syntax region typescriptReturnAnnotation contained start=/:/ end=/{/me=e-1 contains=@typescriptType nextgroup=typescriptBlock
+
+
+syntax region typescriptFuncImpl contained start=/function\>/ end=/{/me=e-1
+  \ contains=typescriptFuncKeyword
+  \ nextgroup=typescriptBlock
+
+syntax cluster typescriptCallImpl contains=typescriptGenericImpl,typescriptParamImpl
+syntax region typescriptGenericImpl matchgroup=typescriptTypeBrackets
+  \ start=/</ end=/>/ skip=/\s*,\s*/
+  \ contains=typescriptTypeParameter
+  \ nextgroup=typescriptParamImpl
+  \ contained skipwhite
+syntax region typescriptParamImpl matchgroup=typescriptParens
+  \ start=/(/ end=/)/
+  \ contains=typescriptDecorator,@typescriptParameterList,@typescriptComments
+  \ nextgroup=typescriptReturnAnnotation,typescriptBlock
+  \ contained skipwhite skipnl
+
+syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/
+  \ nextgroup=typescriptFuncCallArg,typescriptTypeArguments
+  \ contains=@_semantic,typescriptDotNotation
+
+" Define the default highlighting.
+hi def link typescriptReserved             Error
+
+hi def link typescriptEndColons            Exception
+hi def link typescriptSymbols              Normal
+hi def link typescriptBraces               Function
+hi def link typescriptParens               Normal
+hi def link typescriptComment              Comment
+hi def link typescriptLineComment          Comment
+hi def link typescriptDocComment           Comment
+hi def link typescriptCommentTodo          Todo
+hi def link typescriptMagicComment         SpecialComment
+hi def link typescriptRef                  Include
+hi def link typescriptDocNotation          SpecialComment
+hi def link typescriptDocTags              SpecialComment
+hi def link typescriptDocNGParam           typescriptDocParam
+hi def link typescriptDocParam             Function
+hi def link typescriptDocNumParam          Function
+hi def link typescriptDocEventRef          Function
+hi def link typescriptDocNamedParamType    Type
+hi def link typescriptDocParamName         Type
+hi def link typescriptDocParamType         Type
+hi def link typescriptString               String
+hi def link typescriptSpecial              Special
+hi def link typescriptStringLiteralType    String
+hi def link typescriptTemplateLiteralType  String
+hi def link typescriptStringMember         String
+hi def link typescriptTemplate             String
+hi def link typescriptEventString          String
+hi def link typescriptDestructureString    String
+hi def link typescriptASCII                Special
+hi def link typescriptTemplateSB           Label
+hi def link typescriptRegexpString         String
+hi def link typescriptGlobal               Constant
+hi def link typescriptTestGlobal           Function
+hi def link typescriptPrototype            Type
+hi def link typescriptConditional          Conditional
+hi def link typescriptConditionalElse      Conditional
+hi def link typescriptCase                 Conditional
+hi def link typescriptDefault              typescriptCase
+hi def link typescriptBranch               Conditional
+hi def link typescriptIdentifier           Structure
+hi def link typescriptVariable             Identifier
+hi def link typescriptDestructureVariable  PreProc
+hi def link typescriptEnumKeyword          Identifier
+hi def link typescriptRepeat               Repeat
+hi def link typescriptForOperator          Repeat
+hi def link typescriptStatementKeyword     Statement
+hi def link typescriptMessage              Keyword
+hi def link typescriptOperator             Identifier
+hi def link typescriptKeywordOp            Identifier
+hi def link typescriptCastKeyword          Special
+hi def link typescriptType                 Type
+hi def link typescriptNull                 Boolean
+hi def link typescriptNumber               Number
+hi def link typescriptBoolean              Boolean
+hi def link typescriptObjectLabel          typescriptLabel
+hi def link typescriptDestructureLabel     Function
+hi def link typescriptLabel                Label
+hi def link typescriptTupleLable           Label
+hi def link typescriptStringProperty       String
+hi def link typescriptImport               Special
+hi def link typescriptImportType           Special
+hi def link typescriptAmbientDeclaration   Special
+hi def link typescriptExport               Special
+hi def link typescriptExportType           Special
+hi def link typescriptModule               Special
+hi def link typescriptTry                  Special
+hi def link typescriptExceptions           Special
+
+hi def link typescriptMember              Function
+hi def link typescriptMethodAccessor       Operator
+
+hi def link typescriptAsyncFuncKeyword     Keyword
+hi def link typescriptObjectAsyncKeyword   Keyword
+hi def link typescriptAsyncFor             Keyword
+hi def link typescriptFuncKeyword          Keyword
+hi def link typescriptAsyncFunc            Keyword
+hi def link typescriptArrowFunc            Type
+hi def link typescriptFuncName             Function
+hi def link typescriptFuncArg              PreProc
+hi def link typescriptArrowFuncArg         PreProc
+hi def link typescriptFuncComma            Operator
+
+hi def link typescriptClassKeyword         Keyword
+hi def link typescriptClassExtends         Keyword
+" hi def link typescriptClassName            Function
+hi def link typescriptAbstract             Special
+" hi def link typescriptClassHeritage        Function
+" hi def link typescriptInterfaceHeritage    Function
+hi def link typescriptClassStatic          StorageClass
+hi def link typescriptReadonlyModifier     Keyword
+hi def link typescriptInterfaceKeyword     Keyword
+hi def link typescriptInterfaceExtends     Keyword
+hi def link typescriptInterfaceName        Function
+
+hi def link shellbang                      Comment
+
+hi def link typescriptTypeParameter         Identifier
+hi def link typescriptConstraint            Keyword
+hi def link typescriptPredefinedType        Type
+hi def link typescriptReadonlyArrayKeyword  Keyword
+hi def link typescriptUnion                 Operator
+hi def link typescriptFuncTypeArrow         Function
+hi def link typescriptConstructorType       Function
+hi def link typescriptTypeQuery             Keyword
+hi def link typescriptAccessibilityModifier Keyword
+hi def link typescriptOptionalMark          PreProc
+hi def link typescriptFuncType              Special
+hi def link typescriptMappedIn              Special
+hi def link typescriptCall                  PreProc
+hi def link typescriptParamImpl             PreProc
+hi def link typescriptConstructSignature    Identifier
+hi def link typescriptAliasDeclaration      Identifier
+hi def link typescriptAliasKeyword          Keyword
+hi def link typescriptUserDefinedType       Keyword
+hi def link typescriptTypeReference         Identifier
+hi def link typescriptConstructor           Keyword
+hi def link typescriptDecorator             Special
+hi def link typescriptAssertType            Keyword
+
+hi link typeScript             NONE
+
+if exists('s:cpo_save')
+  let &cpo = s:cpo_save
+  unlet s:cpo_save
+endif
--- a/runtime/syntax/swayconfig.vim
+++ b/runtime/syntax/swayconfig.vim
@@ -2,8 +2,8 @@
 " Language: sway window manager config
 " Original Author: James Eapen <james.eapen@vai.org>
 " Maintainer: James Eapen <james.eapen@vai.org>
-" Version: 0.11.0
-" Last Change: 2022 Jun 07
+" Version: 0.11.1
+" Last Change: 2022 Aug 08
 
 " References:
 " http://i3wm.org/docs/userguide.html#configuring
@@ -36,8 +36,8 @@ syn keyword swayConfigBindGestureCommand
 syn keyword swayConfigBindGestureDirection up down left right next prev contained
 syn keyword swayConfigBindGesturePinchDirection inward outward clockwise counterclockwise contained
 syn match swayConfigBindGestureHold /^\s*\(bindgesture\)\s\+hold\(:[1-5]\)\?\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,i3ConfigWorkspaceKeyword,i3ConfigAction
-syn match swayConfigBindGestureSwipe /^\s*\(bindgesture\)\s\+swipe\(:[1-5]\)\?:\(up\|down\|left\|right\)\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,i3ConfigWorkspaceKeyword,i3ConfigAction
-syn match swayConfigBindGesturePinch /^\s*\(bindgesture\)\s\+\(pinch\):.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,swayConfigBindGesturePinchDirection,i3ConfigWorkspaceKeyword,i3ConfigAction
+syn match swayConfigBindGestureSwipe /^\s*\(bindgesture\)\s\+swipe\(:[3-5]\)\?:\(up\|down\|left\|right\)\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,i3ConfigWorkspaceKeyword,i3ConfigAction
+syn match swayConfigBindGesturePinch /^\s*\(bindgesture\)\s\+pinch\(:[2-5]\)\?:\(up\|down\|left\|right\|inward\|outward\|clockwise\|counterclockwise\)\(+\(up\|down\|left\|right\|inward\|outward\|clockwise\|counterclockwise\)\)\?.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,swayConfigBindGesturePinchDirection,i3ConfigWorkspaceKeyword,i3ConfigAction
 
 " floating
 syn keyword swayConfigFloatingKeyword floating contained
--- a/runtime/syntax/typescript.vim
+++ b/runtime/syntax/typescript.vim
@@ -35,7 +35,7 @@ syntax region typescriptTypeCast matchgr
 
 """""""""""""""""""""""""""""""""""""""""""""""""""
 " Source the part common with typescriptreact.vim
-source <sfile>:h/typescriptcommon.vim
+source <sfile>:h/shared/typescriptcommon.vim
 
 
 let b:current_syntax = "typescript"
--- a/runtime/syntax/typescriptreact.vim
+++ b/runtime/syntax/typescriptreact.vim
@@ -133,7 +133,7 @@ syntax region tsxEscJs
 
 """""""""""""""""""""""""""""""""""""""""""""""""""
 " Source the part common with typescriptreact.vim
-source <sfile>:h/typescriptcommon.vim
+source <sfile>:h/shared/typescriptcommon.vim
 
 
 syntax cluster typescriptExpression add=tsxRegion,tsxFragment