mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
vim-patch:86b4816766d9 (#21314)
Update runtime files86b4816766
vim-patch:9.0.1029: autoload directory missing from distribution Problem: Autoload directory missing from distribution. Solution: Add the autoload/zig directory to the list of distributed files.84dbf855fb
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
7b9ad45178
commit
3576776903
100
runtime/autoload/zig/fmt.vim
Normal file
100
runtime/autoload/zig/fmt.vim
Normal file
@ -0,0 +1,100 @@
|
||||
" Adapted from fatih/vim-go: autoload/go/fmt.vim
|
||||
"
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
function! zig#fmt#Format() abort
|
||||
" Save cursor position and many other things.
|
||||
let view = winsaveview()
|
||||
|
||||
if !executable('zig')
|
||||
echohl Error | echomsg "no zig binary found in PATH" | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
let cmdline = 'zig fmt --stdin --ast-check'
|
||||
let current_buf = bufnr('')
|
||||
|
||||
" The formatted code is output on stdout, the errors go on stderr.
|
||||
if exists('*systemlist')
|
||||
silent let out = systemlist(cmdline, current_buf)
|
||||
else
|
||||
silent let out = split(system(cmdline, current_buf))
|
||||
endif
|
||||
if len(out) == 1
|
||||
if out[0] == "error: unrecognized parameter: '--ast-check'"
|
||||
let cmdline = 'zig fmt --stdin'
|
||||
if exists('*systemlist')
|
||||
silent let out = systemlist(cmdline, current_buf)
|
||||
else
|
||||
silent let out = split(system(cmdline, current_buf))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let err = v:shell_error
|
||||
|
||||
|
||||
if err == 0
|
||||
" remove undo point caused via BufWritePre.
|
||||
try | silent undojoin | catch | endtry
|
||||
|
||||
" Replace the file content with the formatted version.
|
||||
if exists('*deletebufline')
|
||||
call deletebufline(current_buf, len(out), line('$'))
|
||||
else
|
||||
silent execute ':' . len(out) . ',' . line('$') . ' delete _'
|
||||
endif
|
||||
call setline(1, out)
|
||||
|
||||
" No errors detected, close the loclist.
|
||||
call setloclist(0, [], 'r')
|
||||
lclose
|
||||
elseif get(g:, 'zig_fmt_parse_errors', 1)
|
||||
let errors = s:parse_errors(expand('%'), out)
|
||||
|
||||
call setloclist(0, [], 'r', {
|
||||
\ 'title': 'Errors',
|
||||
\ 'items': errors,
|
||||
\ })
|
||||
|
||||
let max_win_height = get(g:, 'zig_fmt_max_window_height', 5)
|
||||
" Prevent the loclist from becoming too long.
|
||||
let win_height = min([max_win_height, len(errors)])
|
||||
" Open the loclist, but only if there's at least one error to show.
|
||||
execute 'silent! lwindow ' . win_height
|
||||
endif
|
||||
|
||||
call winrestview(view)
|
||||
|
||||
if err != 0
|
||||
echohl Error | echomsg "zig fmt returned error" | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
" Run the syntax highlighter on the updated content and recompute the folds if
|
||||
" needed.
|
||||
syntax sync fromstart
|
||||
endfunction
|
||||
|
||||
" parse_errors parses the given errors and returns a list of parsed errors
|
||||
function! s:parse_errors(filename, lines) abort
|
||||
" list of errors to be put into location list
|
||||
let errors = []
|
||||
for line in a:lines
|
||||
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
|
||||
if !empty(tokens)
|
||||
call add(errors,{
|
||||
\"filename": a:filename,
|
||||
\"lnum": tokens[2],
|
||||
\"col": tokens[3],
|
||||
\"text": tokens[4],
|
||||
\ })
|
||||
endif
|
||||
endfor
|
||||
|
||||
return errors
|
||||
endfunction
|
||||
" vim: sw=2 ts=2 et
|
39
runtime/compiler/dotnet.vim
Normal file
39
runtime/compiler/dotnet.vim
Normal file
@ -0,0 +1,39 @@
|
||||
" Vim compiler file
|
||||
" Compiler: dotnet build (.NET CLI)
|
||||
" Maintainer: Nick Jensen <nickspoon@gmail.com>
|
||||
" Last Change: 2022-12-06
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/nickspoons/vim-cs
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "dotnet"
|
||||
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if get(g:, "dotnet_errors_only", v:false)
|
||||
CompilerSet makeprg=dotnet\ build\ -nologo
|
||||
\\ -consoleloggerparameters:NoSummary
|
||||
\\ -consoleloggerparameters:ErrorsOnly
|
||||
else
|
||||
CompilerSet makeprg=dotnet\ build\ -nologo\ -consoleloggerparameters:NoSummary
|
||||
endif
|
||||
|
||||
if get(g:, "dotnet_show_project_file", v:true)
|
||||
CompilerSet errorformat=%E%f(%l\\,%c):\ %trror\ %m,
|
||||
\%W%f(%l\\,%c):\ %tarning\ %m,
|
||||
\%-G%.%#
|
||||
else
|
||||
CompilerSet errorformat=%E%f(%l\\,%c):\ %trror\ %m\ [%.%#],
|
||||
\%W%f(%l\\,%c):\ %tarning\ %m\ [%.%#],
|
||||
\%-G%.%#
|
||||
endif
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
28
runtime/compiler/zig.vim
Normal file
28
runtime/compiler/zig.vim
Normal file
@ -0,0 +1,28 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Zig Compiler
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "zig"
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
" a subcommand must be provided for the this compiler (test, build-exe, etc)
|
||||
if has('patch-7.4.191')
|
||||
CompilerSet makeprg=zig\ \$*\ \%:S
|
||||
else
|
||||
CompilerSet makeprg=zig\ \$*\ \"%\"
|
||||
endif
|
||||
|
||||
" TODO: improve errorformat as needed.
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
|
29
runtime/compiler/zig_build.vim
Normal file
29
runtime/compiler/zig_build.vim
Normal file
@ -0,0 +1,29 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Zig Compiler (zig build)
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
if exists('current_compiler')
|
||||
finish
|
||||
endif
|
||||
runtime compiler/zig.vim
|
||||
let current_compiler = 'zig_build'
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
if exists(':CompilerSet') != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
if exists('g:zig_build_makeprg_params')
|
||||
execute 'CompilerSet makeprg=zig\ build\ '.escape(g:zig_build_makeprg_params, ' \|"').'\ $*'
|
||||
else
|
||||
CompilerSet makeprg=zig\ build\ $*
|
||||
endif
|
||||
|
||||
" TODO: anything to add to errorformat for zig build specifically?
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
|
27
runtime/compiler/zig_build_exe.vim
Normal file
27
runtime/compiler/zig_build_exe.vim
Normal file
@ -0,0 +1,27 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Zig Compiler (zig build-exe)
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
if exists('current_compiler')
|
||||
finish
|
||||
endif
|
||||
runtime compiler/zig.vim
|
||||
let current_compiler = 'zig_build_exe'
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
if exists(':CompilerSet') != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
if has('patch-7.4.191')
|
||||
CompilerSet makeprg=zig\ build-exe\ \%:S\ \$*
|
||||
else
|
||||
CompilerSet makeprg=zig\ build-exe\ \"%\"\ \$*
|
||||
endif
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
|
27
runtime/compiler/zig_test.vim
Normal file
27
runtime/compiler/zig_test.vim
Normal file
@ -0,0 +1,27 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Zig Compiler (zig test)
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
if exists('current_compiler')
|
||||
finish
|
||||
endif
|
||||
runtime compiler/zig.vim
|
||||
let current_compiler = 'zig_test'
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
if exists(':CompilerSet') != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
if has('patch-7.4.191')
|
||||
CompilerSet makeprg=zig\ test\ \%:S\ \$*
|
||||
else
|
||||
CompilerSet makeprg=zig\ test\ \"%\"\ \$*
|
||||
endif
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
|
@ -586,6 +586,11 @@ line is folded, it cannot be displayed there.
|
||||
Many movement commands handle a sequence of folded lines like an empty line.
|
||||
For example, the "w" command stops once in the first column.
|
||||
|
||||
When starting a search in a closed fold it will not find a match in the
|
||||
current fold. It's like a forward search always starts from the end of the
|
||||
closed fold, while a backwards search starts from the start of the closed
|
||||
fold.
|
||||
|
||||
When in Insert mode, the cursor line is never folded. That allows you to see
|
||||
what you type!
|
||||
|
||||
|
@ -1471,7 +1471,7 @@ Possible attributes are:
|
||||
number.
|
||||
-count=N A count (default N) which is specified either in the line
|
||||
number position, or as an initial argument (like |:Next|).
|
||||
-count acts like -count=0
|
||||
-count Acts like -count=0
|
||||
|
||||
Note that -range=N and -count=N are mutually exclusive - only one should be
|
||||
specified.
|
||||
@ -1489,7 +1489,7 @@ Possible values are (second column is the short name used in listing):
|
||||
-addr=windows win Range for windows
|
||||
-addr=tabs tab Range for tab pages
|
||||
-addr=quickfix qf Range for quickfix entries
|
||||
-addr=other ? other kind of range; can use ".", "$" and "%"
|
||||
-addr=other ? Other kind of range; can use ".", "$" and "%"
|
||||
as with "lines" (this is the default for
|
||||
-count)
|
||||
|
||||
|
@ -3571,6 +3571,14 @@ highlighting is to put the following line in your |vimrc|: >
|
||||
<
|
||||
|
||||
|
||||
WDL *wdl.vim* *wdl-syntax*
|
||||
|
||||
The Workflow Description Language is a way to specify data processing workflows
|
||||
with a human-readable and writeable syntax. This is used a lot in
|
||||
bioinformatics. More info on the spec can be found here:
|
||||
https://github.com/openwdl/wdl
|
||||
|
||||
|
||||
XF86CONFIG *xf86conf.vim* *ft-xf86conf-syntax*
|
||||
|
||||
The syntax of XF86Config file differs in XFree86 v3.x and v4.x. Both
|
||||
|
@ -615,6 +615,8 @@ autocommand event can be used.
|
||||
If you want to get notified of text in windows scrolling vertically or
|
||||
horizontally, the |WinScrolled| autocommand event can be used. This will also
|
||||
trigger in window size changes.
|
||||
Exception: the events will not be triggered when the text scrolls for
|
||||
'incsearch'.
|
||||
*WinResized-event*
|
||||
The |WinResized| event is triggered after updating the display, several
|
||||
windows may have changed size then. A list of the IDs of windows that changed
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: C#
|
||||
" Maintainer: Nick Jensen <nickspoon@gmail.com>
|
||||
" Former Maintainer: Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: 2021-12-07
|
||||
" Last Change: 2022-11-16
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/nickspoons/vim-cs
|
||||
|
||||
@ -25,8 +25,9 @@ let b:undo_ftplugin = 'setl com< fo<'
|
||||
|
||||
if exists('loaded_matchit') && !exists('b:match_words')
|
||||
" #if/#endif support included by default
|
||||
let b:match_ignorecase = 0
|
||||
let b:match_words = '\%(^\s*\)\@<=#\s*region\>:\%(^\s*\)\@<=#\s*endregion\>,'
|
||||
let b:undo_ftplugin .= ' | unlet! b:match_words'
|
||||
let b:undo_ftplugin .= ' | unlet! b:match_ignorecase b:match_words'
|
||||
endif
|
||||
|
||||
if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Vim
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2022 Sep 09
|
||||
" Last Change: 2022 Nov 27
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@ -98,7 +98,7 @@ if exists("loaded_matchit")
|
||||
" func name
|
||||
" require a parenthesis following, then there can be an "endfunc".
|
||||
let b:match_words =
|
||||
\ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' .
|
||||
\ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+\s*(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' .
|
||||
\ '\<\(wh\%[ile]\|for\)\>:\%(\%(^\||\)\s*\)\@<=\<brea\%[k]\>:\%(\%(^\||\)\s*\)\@<=\<con\%[tinue]\>:\%(\%(^\||\)\s*\)\@<=\<end\(w\%[hile]\|fo\%[r]\)\>,' .
|
||||
\ '\<if\>:\%(\%(^\||\)\s*\)\@<=\<el\%[seif]\>:\%(\%(^\||\)\s*\)\@<=\<en\%[dif]\>,' .
|
||||
\ '{:},' .
|
||||
|
66
runtime/ftplugin/zig.vim
Normal file
66
runtime/ftplugin/zig.vim
Normal file
@ -0,0 +1,66 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Zig
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_orig = &cpo
|
||||
set cpo&vim
|
||||
|
||||
compiler zig_build
|
||||
|
||||
" Match Zig builtin fns
|
||||
setlocal iskeyword+=@-@
|
||||
|
||||
" Recomended code style, no tabs and 4-space indentation
|
||||
setlocal expandtab
|
||||
setlocal tabstop=8
|
||||
setlocal softtabstop=4
|
||||
setlocal shiftwidth=4
|
||||
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
setlocal suffixesadd=.zig,.zir
|
||||
|
||||
if has('comments')
|
||||
setlocal comments=:///,://!,://,:\\\\
|
||||
setlocal commentstring=//\ %s
|
||||
endif
|
||||
|
||||
if has('find_in_path')
|
||||
let &l:includeexpr='substitute(v:fname, "^([^.])$", "\1.zig", "")'
|
||||
let &l:include='\v(\@import>|\@cInclude>|^\s*\#\s*include)'
|
||||
endif
|
||||
|
||||
let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)'
|
||||
|
||||
if !exists('g:zig_std_dir') && exists('*json_decode') && executable('zig')
|
||||
silent let s:env = system('zig env')
|
||||
if v:shell_error == 0
|
||||
let g:zig_std_dir = json_decode(s:env)['std_dir']
|
||||
endif
|
||||
unlet! s:env
|
||||
endif
|
||||
|
||||
if exists('g:zig_std_dir')
|
||||
let &l:path = &l:path . ',' . g:zig_std_dir
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin =
|
||||
\ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<'
|
||||
|
||||
augroup vim-zig
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePre <buffer> if get(g:, 'zig_fmt_autosave', 1) | call zig#fmt#Format() | endif
|
||||
augroup END
|
||||
|
||||
let b:undo_ftplugin .= '|au! vim-zig * <buffer>'
|
||||
|
||||
let &cpo = s:cpo_orig
|
||||
unlet s:cpo_orig
|
||||
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
|
80
runtime/indent/zig.vim
Normal file
80
runtime/indent/zig.vim
Normal file
@ -0,0 +1,80 @@
|
||||
" Vim filetype indent file
|
||||
" Language: Zig
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
if (!has("cindent") || !has("eval"))
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal cindent
|
||||
|
||||
" L0 -> 0 indent for jump labels (i.e. case statement in c).
|
||||
" j1 -> indenting for "javascript object declarations"
|
||||
" J1 -> see j1
|
||||
" w1 -> starting a new line with `(` at the same indent as `(`
|
||||
" m1 -> if `)` starts a line, match its indent with the first char of its
|
||||
" matching `(` line
|
||||
" (s -> use one indent, when starting a new line after a trailing `(`
|
||||
setlocal cinoptions=L0,m1,(s,j1,J1,l1
|
||||
|
||||
" cinkeys: controls what keys trigger indent formatting
|
||||
" 0{ -> {
|
||||
" 0} -> }
|
||||
" 0) -> )
|
||||
" 0] -> ]
|
||||
" !^F -> make CTRL-F (^F) reindent the current line when typed
|
||||
" o -> when <CR> or `o` is used
|
||||
" O -> when the `O` command is used
|
||||
setlocal cinkeys=0{,0},0),0],!^F,o,O
|
||||
|
||||
setlocal indentexpr=GetZigIndent(v:lnum)
|
||||
|
||||
let b:undo_indent = "setlocal cindent< cinkeys< cinoptions< indentexpr<"
|
||||
|
||||
function! GetZigIndent(lnum)
|
||||
let curretLineNum = a:lnum
|
||||
let currentLine = getline(a:lnum)
|
||||
|
||||
" cindent doesn't handle multi-line strings properly, so force no indent
|
||||
if currentLine =~ '^\s*\\\\.*'
|
||||
return -1
|
||||
endif
|
||||
|
||||
let prevLineNum = prevnonblank(a:lnum-1)
|
||||
let prevLine = getline(prevLineNum)
|
||||
|
||||
" for lines that look like
|
||||
" },
|
||||
" };
|
||||
" try treating them the same as a }
|
||||
if prevLine =~ '\v^\s*},$'
|
||||
if currentLine =~ '\v^\s*};$' || currentLine =~ '\v^\s*}$'
|
||||
return indent(prevLineNum) - 4
|
||||
endif
|
||||
return indent(prevLineNum-1) - 4
|
||||
endif
|
||||
if currentLine =~ '\v^\s*},$'
|
||||
return indent(prevLineNum) - 4
|
||||
endif
|
||||
if currentLine =~ '\v^\s*};$'
|
||||
return indent(prevLineNum) - 4
|
||||
endif
|
||||
|
||||
|
||||
" cindent doesn't handle this case correctly:
|
||||
" switch (1): {
|
||||
" 1 => true,
|
||||
" ~
|
||||
" ^---- indents to here
|
||||
if prevLine =~ '.*=>.*,$' && currentLine !~ '.*}$'
|
||||
return indent(prevLineNum)
|
||||
endif
|
||||
|
||||
return cindent(a:lnum)
|
||||
endfunction
|
@ -2,7 +2,7 @@
|
||||
" You can also use this as a start for your own set of menus.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2021 Dec 22
|
||||
" Last Change: 2022 Nov 27
|
||||
|
||||
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
|
||||
" in all modes and avoid side effects from mappings defined by the user.
|
||||
|
@ -1,6 +1,6 @@
|
||||
" Vim plugin for showing matching parens
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2022 Nov 28
|
||||
" Last Change: 2022 Dec 01
|
||||
|
||||
" Exit quickly when:
|
||||
" - this plugin was already loaded (or disabled)
|
||||
|
@ -3,7 +3,7 @@
|
||||
" Maintainer: Nick Jensen <nickspoon@gmail.com>
|
||||
" Former Maintainers: Anduin Withers <awithers@anduin.com>
|
||||
" Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: 2022-03-01
|
||||
" Last Change: 2022-11-16
|
||||
" Filenames: *.cs
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/nickspoons/vim-cs
|
||||
@ -25,6 +25,9 @@ syn keyword csType bool byte char decimal double float int long object sbyte sho
|
||||
syn keyword csType nint nuint " contextual
|
||||
|
||||
syn keyword csStorage enum interface namespace struct
|
||||
syn match csStorage "\<record\ze\_s\+@\=\h\w*\_s*[<(:{;]"
|
||||
syn match csStorage "\%(\<\%(partial\|new\|public\|protected\|internal\|private\|abstract\|sealed\|static\|unsafe\|readonly\)\)\@9<=\_s\+record\>"
|
||||
syn match csStorage "\<record\ze\_s\+\%(class\|struct\)"
|
||||
syn match csStorage "\<delegate\>"
|
||||
syn keyword csRepeat break continue do for foreach goto return while
|
||||
syn keyword csConditional else if switch
|
||||
@ -44,6 +47,9 @@ syn keyword csManagedModifier managed unmanaged contained
|
||||
" Modifiers
|
||||
syn match csUsingModifier "\<global\ze\_s\+using\>"
|
||||
syn keyword csAccessModifier internal private protected public
|
||||
syn keyword csModifier operator nextgroup=csCheckedModifier skipwhite skipempty
|
||||
syn keyword csCheckedModifier checked contained
|
||||
|
||||
" TODO: in new out
|
||||
syn keyword csModifier abstract const event override readonly sealed static virtual volatile
|
||||
syn match csModifier "\<\%(extern\|fixed\|unsafe\)\>"
|
||||
@ -76,7 +82,7 @@ syn match csAccess "\<this\>"
|
||||
" Extension method parameter modifier
|
||||
syn match csModifier "\<this\ze\_s\+@\=\h"
|
||||
|
||||
syn keyword csUnspecifiedStatement as in is nameof operator out params ref sizeof stackalloc using
|
||||
syn keyword csUnspecifiedStatement as in is nameof out params ref sizeof stackalloc using
|
||||
syn keyword csUnsupportedStatement value
|
||||
syn keyword csUnspecifiedKeyword explicit implicit
|
||||
|
||||
@ -183,7 +189,7 @@ syn match csUnicodeNumber +\\u\x\{4}+ contained contains=csUnicodeSpecifier disp
|
||||
syn match csUnicodeNumber +\\U00\x\{6}+ contained contains=csUnicodeSpecifier display
|
||||
syn match csUnicodeSpecifier +\\[uUx]+ contained display
|
||||
|
||||
syn region csString matchgroup=csQuote start=+"+ end=+"+ end=+$+ extend contains=csSpecialChar,csSpecialError,csUnicodeNumber,@Spell
|
||||
syn region csString matchgroup=csQuote start=+"+ end=+"\%(u8\)\=+ end=+$+ extend contains=csSpecialChar,csSpecialError,csUnicodeNumber,@Spell
|
||||
syn match csCharacter "'[^']*'" contains=csSpecialChar,csSpecialCharError,csUnicodeNumber display
|
||||
syn match csCharacter "'\\''" contains=csSpecialChar display
|
||||
syn match csCharacter "'[^\\]'" display
|
||||
@ -200,7 +206,7 @@ syn match csReal "\<\d\+\%(_\+\d\+\)*[fdm]\>" display
|
||||
syn case match
|
||||
syn cluster csNumber contains=csInteger,csReal
|
||||
|
||||
syn region csInterpolatedString matchgroup=csQuote start=+\$"+ end=+"+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,@Spell
|
||||
syn region csInterpolatedString matchgroup=csQuote start=+\$"+ end=+"\%(u8\)\=+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,@Spell
|
||||
|
||||
syn region csInterpolation matchgroup=csInterpolationDelimiter start=+{+ end=+}+ keepend contained contains=@csAll,csBraced,csBracketed,csInterpolationAlign,csInterpolationFormat
|
||||
syn match csEscapedInterpolation "{{" transparent contains=NONE display
|
||||
@ -210,10 +216,10 @@ syn match csInterpolationFormat +:[^}]\+}+ contained contains=csInterpolationFor
|
||||
syn match csInterpolationAlignDel +,+ contained display
|
||||
syn match csInterpolationFormatDel +:+ contained display
|
||||
|
||||
syn region csVerbatimString matchgroup=csQuote start=+@"+ end=+"+ skip=+""+ extend contains=csVerbatimQuote,@Spell
|
||||
syn region csVerbatimString matchgroup=csQuote start=+@"+ end=+"\%(u8\)\=+ skip=+""+ extend contains=csVerbatimQuote,@Spell
|
||||
syn match csVerbatimQuote +""+ contained
|
||||
|
||||
syn region csInterVerbString matchgroup=csQuote start=+$@"+ start=+@$"+ end=+"+ skip=+""+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,csVerbatimQuote,@Spell
|
||||
syn region csInterVerbString matchgroup=csQuote start=+$@"+ start=+@$"+ end=+"\%(u8\)\=+ skip=+""+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,csVerbatimQuote,@Spell
|
||||
|
||||
syn cluster csString contains=csString,csInterpolatedString,csVerbatimString,csInterVerbString
|
||||
|
||||
@ -256,6 +262,7 @@ hi def link csException Exception
|
||||
hi def link csModifier StorageClass
|
||||
hi def link csAccessModifier csModifier
|
||||
hi def link csAsyncModifier csModifier
|
||||
hi def link csCheckedModifier csModifier
|
||||
hi def link csManagedModifier csModifier
|
||||
hi def link csUsingModifier csModifier
|
||||
|
||||
|
210
runtime/syntax/nix.vim
Normal file
210
runtime/syntax/nix.vim
Normal file
@ -0,0 +1,210 @@
|
||||
" Vim syntax file
|
||||
" Language: Nix
|
||||
" Maintainer: James Fleming <james@electronic-quill.net>
|
||||
" Original Author: Daiderd Jordan <daiderd@gmail.com>
|
||||
" Acknowledgement: Based on vim-nix maintained by Daiderd Jordan <daiderd@gmail.com>
|
||||
" https://github.com/LnL7/vim-nix
|
||||
" License: MIT
|
||||
" Last Change: 2022 Dec 06
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
syn keyword nixBoolean true false
|
||||
syn keyword nixNull null
|
||||
syn keyword nixRecKeyword rec
|
||||
|
||||
syn keyword nixOperator or
|
||||
syn match nixOperator '!=\|!'
|
||||
syn match nixOperator '<=\?'
|
||||
syn match nixOperator '>=\?'
|
||||
syn match nixOperator '&&'
|
||||
syn match nixOperator '//\='
|
||||
syn match nixOperator '=='
|
||||
syn match nixOperator '?'
|
||||
syn match nixOperator '||'
|
||||
syn match nixOperator '++\='
|
||||
syn match nixOperator '-'
|
||||
syn match nixOperator '\*'
|
||||
syn match nixOperator '->'
|
||||
|
||||
syn match nixParen '[()]'
|
||||
syn match nixInteger '\d\+'
|
||||
|
||||
syn keyword nixTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
|
||||
syn match nixComment '#.*' contains=nixTodo,@Spell
|
||||
syn region nixComment start=+/\*+ end=+\*/+ contains=nixTodo,@Spell
|
||||
|
||||
syn region nixInterpolation matchgroup=nixInterpolationDelimiter start="\${" end="}" contained contains=@nixExpr,nixInterpolationParam
|
||||
|
||||
syn match nixSimpleStringSpecial /\\\%([nrt"\\$]\|$\)/ contained
|
||||
syn match nixStringSpecial /''['$]/ contained
|
||||
syn match nixStringSpecial /\$\$/ contained
|
||||
syn match nixStringSpecial /''\\[nrt]/ contained
|
||||
|
||||
syn match nixSimpleStringSpecial /\$\$/ contained
|
||||
|
||||
syn match nixInvalidSimpleStringEscape /\\[^nrt"\\$]/ contained
|
||||
syn match nixInvalidStringEscape /''\\[^nrt]/ contained
|
||||
|
||||
syn region nixSimpleString matchgroup=nixStringDelimiter start=+"+ skip=+\\"+ end=+"+ contains=nixInterpolation,nixSimpleStringSpecial,nixInvalidSimpleStringEscape
|
||||
syn region nixString matchgroup=nixStringDelimiter start=+''+ skip=+''['$\\]+ end=+''+ contains=nixInterpolation,nixStringSpecial,nixInvalidStringEscape
|
||||
|
||||
syn match nixFunctionCall "[a-zA-Z_][a-zA-Z0-9_'-]*"
|
||||
|
||||
syn match nixPath "[a-zA-Z0-9._+-]*\%(/[a-zA-Z0-9._+-]\+\)\+"
|
||||
syn match nixHomePath "\~\%(/[a-zA-Z0-9._+-]\+\)\+"
|
||||
syn match nixSearchPath "[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*" contained
|
||||
syn match nixPathDelimiter "[<>]" contained
|
||||
syn match nixSearchPathRef "<[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*>" contains=nixSearchPath,nixPathDelimiter
|
||||
syn match nixURI "[a-zA-Z][a-zA-Z0-9.+-]*:[a-zA-Z0-9%/?:@&=$,_.!~*'+-]\+"
|
||||
|
||||
syn match nixAttributeDot "\." contained
|
||||
syn match nixAttribute "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'.-]\|$\)" contained
|
||||
syn region nixAttributeAssignment start="=" end="\ze;" contained contains=@nixExpr
|
||||
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment
|
||||
|
||||
syn region nixInheritAttributeScope start="(" end="\ze)" contained contains=@nixExpr
|
||||
syn region nixAttributeDefinition matchgroup=nixInherit start="\<inherit\>" end=";" contained contains=nixComment,nixInheritAttributeScope,nixAttribute
|
||||
|
||||
syn region nixAttributeSet start="{" end="}" contains=nixComment,nixAttributeDefinition
|
||||
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn region nixArgumentDefinitionWithDefault matchgroup=nixArgumentDefinition start="[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*?\@=" matchgroup=NONE end="[,}]\@=" transparent contained contains=@nixExpr
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn match nixArgumentDefinition "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,}]\@=" contained
|
||||
syn match nixArgumentEllipsis "\.\.\." contained
|
||||
syn match nixArgumentSeparator "," contained
|
||||
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn match nixArgOperator '@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:'he=s+1 contained contains=nixAttribute
|
||||
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn match nixArgOperator '[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@'hs=e-1 contains=nixAttribute nextgroup=nixFunctionArgument
|
||||
|
||||
" This is a bit more complicated, because function arguments can be passed in a
|
||||
" very similar form on how attribute sets are defined and two regions with the
|
||||
" same start patterns will shadow each other. Instead of a region we could use a
|
||||
" match on {\_.\{-\}}, which unfortunately doesn't take nesting into account.
|
||||
"
|
||||
" So what we do instead is that we look forward until we are sure that it's a
|
||||
" function argument. Unfortunately, we need to catch comments and both vertical
|
||||
" and horizontal white space, which the following regex should hopefully do:
|
||||
"
|
||||
" "\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*"
|
||||
"
|
||||
" It is also used throught the whole file and is marked with 'v's as well.
|
||||
"
|
||||
" Fortunately the matching rules for function arguments are much simpler than
|
||||
" for real attribute sets, because we can stop when we hit the first ellipsis or
|
||||
" default value operator, but we also need to paste the "whitespace & comments
|
||||
" eating" regex all over the place (marked with 'v's):
|
||||
"
|
||||
" Region match 1: { foo ? ... } or { foo, ... } or { ... } (ellipsis)
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv {----- identifier -----}vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*\%([a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,?}]\|\.\.\.\)" end="}" contains=nixComment,nixArgumentDefinitionWithDefault,nixArgumentDefinition,nixArgumentEllipsis,nixArgumentSeparator nextgroup=nixArgOperator
|
||||
|
||||
" Now it gets more tricky, because we need to look forward for the colon, but
|
||||
" there could be something like "{}@foo:", even though it's highly unlikely.
|
||||
"
|
||||
" Region match 2: {}
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv@vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv{----- identifier -----} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*}\%(\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\)\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:" end="}" contains=nixComment nextgroup=nixArgOperator
|
||||
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn match nixSimpleFunctionArgument "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:\([\n ]\)\@="
|
||||
|
||||
syn region nixList matchgroup=nixListBracket start="\[" end="\]" contains=@nixExpr
|
||||
|
||||
syn region nixLetExpr matchgroup=nixLetExprKeyword start="\<let\>" end="\<in\>" contains=nixComment,nixAttributeDefinition
|
||||
|
||||
syn keyword nixIfExprKeyword then contained
|
||||
syn region nixIfExpr matchgroup=nixIfExprKeyword start="\<if\>" end="\<else\>" contains=@nixExpr,nixIfExprKeyword
|
||||
|
||||
syn region nixWithExpr matchgroup=nixWithExprKeyword start="\<with\>" matchgroup=NONE end=";" contains=@nixExpr
|
||||
|
||||
syn region nixAssertExpr matchgroup=nixAssertKeyword start="\<assert\>" matchgroup=NONE end=";" contains=@nixExpr
|
||||
|
||||
syn cluster nixExpr contains=nixBoolean,nixNull,nixOperator,nixParen,nixInteger,nixRecKeyword,nixConditional,nixBuiltin,nixSimpleBuiltin,nixComment,nixFunctionCall,nixFunctionArgument,nixArgOperator,nixSimpleFunctionArgument,nixPath,nixHomePath,nixSearchPathRef,nixURI,nixAttributeSet,nixList,nixSimpleString,nixString,nixLetExpr,nixIfExpr,nixWithExpr,nixAssertExpr,nixInterpolation
|
||||
|
||||
" These definitions override @nixExpr and have to come afterwards:
|
||||
|
||||
syn match nixInterpolationParam "[a-zA-Z_][a-zA-Z0-9_'-]*\%(\.[a-zA-Z_][a-zA-Z0-9_'-]*\)*" contained
|
||||
|
||||
" Non-namespaced Nix builtins as of version 2.0:
|
||||
syn keyword nixSimpleBuiltin
|
||||
\ abort baseNameOf derivation derivationStrict dirOf fetchGit
|
||||
\ fetchMercurial fetchTarball import isNull map mapAttrs placeholder removeAttrs
|
||||
\ scopedImport throw toString
|
||||
|
||||
|
||||
" Namespaced and non-namespaced Nix builtins as of version 2.0:
|
||||
syn keyword nixNamespacedBuiltin contained
|
||||
\ abort add addErrorContext all any attrNames attrValues baseNameOf
|
||||
\ catAttrs compareVersions concatLists concatStringsSep currentSystem
|
||||
\ currentTime deepSeq derivation derivationStrict dirOf div elem elemAt
|
||||
\ fetchGit fetchMercurial fetchTarball fetchurl filter \ filterSource
|
||||
\ findFile foldl' fromJSON functionArgs genList \ genericClosure getAttr
|
||||
\ getEnv hasAttr hasContext hashString head import intersectAttrs isAttrs
|
||||
\ isBool isFloat isFunction isInt isList isNull isString langVersion
|
||||
\ length lessThan listToAttrs map mapAttrs match mul nixPath nixVersion
|
||||
\ parseDrvName partition path pathExists placeholder readDir readFile
|
||||
\ removeAttrs replaceStrings scopedImport seq sort split splitVersion
|
||||
\ storeDir storePath stringLength sub substring tail throw toFile toJSON
|
||||
\ toPath toString toXML trace tryEval typeOf unsafeDiscardOutputDependency
|
||||
\ unsafeDiscardStringContext unsafeGetAttrPos valueSize fromTOML bitAnd
|
||||
\ bitOr bitXor floor ceil
|
||||
|
||||
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin
|
||||
|
||||
hi def link nixArgOperator Operator
|
||||
hi def link nixArgumentDefinition Identifier
|
||||
hi def link nixArgumentEllipsis Operator
|
||||
hi def link nixAssertKeyword Keyword
|
||||
hi def link nixAttribute Identifier
|
||||
hi def link nixAttributeDot Operator
|
||||
hi def link nixBoolean Boolean
|
||||
hi def link nixBuiltin Special
|
||||
hi def link nixComment Comment
|
||||
hi def link nixConditional Conditional
|
||||
hi def link nixHomePath Include
|
||||
hi def link nixIfExprKeyword Keyword
|
||||
hi def link nixInherit Keyword
|
||||
hi def link nixInteger Integer
|
||||
hi def link nixInterpolation Macro
|
||||
hi def link nixInterpolationDelimiter Delimiter
|
||||
hi def link nixInterpolationParam Macro
|
||||
hi def link nixInvalidSimpleStringEscape Error
|
||||
hi def link nixInvalidStringEscape Error
|
||||
hi def link nixLetExprKeyword Keyword
|
||||
hi def link nixNamespacedBuiltin Special
|
||||
hi def link nixNull Constant
|
||||
hi def link nixOperator Operator
|
||||
hi def link nixPath Include
|
||||
hi def link nixPathDelimiter Delimiter
|
||||
hi def link nixRecKeyword Keyword
|
||||
hi def link nixSearchPath Include
|
||||
hi def link nixSimpleBuiltin Keyword
|
||||
hi def link nixSimpleFunctionArgument Identifier
|
||||
hi def link nixSimpleString String
|
||||
hi def link nixSimpleStringSpecial SpecialChar
|
||||
hi def link nixString String
|
||||
hi def link nixStringDelimiter Delimiter
|
||||
hi def link nixStringSpecial Special
|
||||
hi def link nixTodo Todo
|
||||
hi def link nixURI Include
|
||||
hi def link nixWithExprKeyword Keyword
|
||||
|
||||
" This could lead up to slow syntax highlighting for large files, but usually
|
||||
" large files such as all-packages.nix are one large attribute set, so if we'd
|
||||
" use sync patterns we'd have to go back to the start of the file anyway
|
||||
syn sync fromstart
|
||||
|
||||
let b:current_syntax = "nix"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
@ -2,7 +2,7 @@
|
||||
" Language: rego policy language
|
||||
" Maintainer: Matt Dunford (zenmatic@gmail.com)
|
||||
" URL: https://github.com/zenmatic/vim-syntax-rego
|
||||
" Last Change: 2019 Dec 12
|
||||
" Last Change: 2022 Dec 4
|
||||
|
||||
" https://www.openpolicyagent.org/docs/latest/policy-language/
|
||||
|
||||
@ -14,36 +14,56 @@ endif
|
||||
syn case match
|
||||
|
||||
syn keyword regoDirective package import allow deny
|
||||
syn keyword regoKeywords as default else false not null true with some
|
||||
syn keyword regoKeywords as default else every false if import package not null true with some in print
|
||||
|
||||
syn keyword regoFuncAggregates count sum product max min sort all any
|
||||
syn match regoFuncArrays "\<array\.\(concat\|slice\)\>"
|
||||
syn match regoFuncArrays "\<array\.\(concat\|slice\|reverse\)\>"
|
||||
syn keyword regoFuncSets intersection union
|
||||
|
||||
syn keyword regoFuncStrings concat /\<contains\>/ endswith format_int indexof lower replace split sprintf startswith substring trim trim_left trim_prefix trim_right trim_suffix trim_space upper
|
||||
syn match regoFuncStrings2 "\<strings\.replace_n\>"
|
||||
syn keyword regoFuncStrings concat /\<contains\>/ endswith format_int indexof indexof_n lower replace split sprintf startswith substring trim trim_left trim_prefix trim_right trim_suffix trim_space upper
|
||||
syn match regoFuncStrings2 "\<strings\.\(replace_n\|reverse\|any_prefix_match\|any_suffix_match\)\>"
|
||||
syn match regoFuncStrings3 "\<contains\>"
|
||||
|
||||
syn keyword regoFuncRegex re_match
|
||||
syn match regoFuncRegex2 "\<regex\.\(split\|globs_match\|template_match\|find_n\|find_all_string_submatch_n\)\>"
|
||||
syn match regoFuncRegex2 "\<regex\.\(is_valid\|split\|globs_match\|template_match\|find_n\|find_all_string_submatch_n\|replace\)\>"
|
||||
|
||||
syn match regoFuncUuid "\<uuid.rfc4122\>"
|
||||
syn match regoFuncBits "\<bits\.\(or\|and\|negate\|xor\|lsh\|rsh\)\>"
|
||||
syn match regoFuncObject "\<object\.\(get\|remove\|subset\|union\|union_n\|filter\)\>"
|
||||
syn match regoFuncGlob "\<glob\.\(match\|quote_meta\)\>"
|
||||
syn match regoFuncUnits "\<units\.parse_bytes\>"
|
||||
syn match regoFuncUnits "\<units\.parse\(_bytes\)\=\>"
|
||||
syn keyword regoFuncTypes is_number is_string is_boolean is_array is_set is_object is_null type_name
|
||||
syn match regoFuncEncoding1 "\<\(base64\|base64url\)\.\(encode\|decode\)\>"
|
||||
syn match regoFuncEncoding2 "\<urlquery\.\(encode\|decode\|encode_object\)\>"
|
||||
syn match regoFuncEncoding3 "\<\(json\|yaml\)\.\(marshal\|unmarshal\)\>"
|
||||
syn match regoFuncEncoding1 "\<base64\.\(encode\|decode\|is_valid\)\>"
|
||||
syn match regoFuncEncoding2 "\<base64url\.\(encode\(_no_pad\)\=\|decode\)\>"
|
||||
syn match regoFuncEncoding3 "\<urlquery\.\(encode\|decode\|\(en\|de\)code_object\)\>"
|
||||
syn match regoFuncEncoding4 "\<\(json\|yaml\)\.\(is_valid\|marshal\|unmarshal\)\>"
|
||||
syn match regoFuncEncoding5 "\<json\.\(filter\|patch\|remove\)\>"
|
||||
syn match regoFuncTokenSigning "\<io\.jwt\.\(encode_sign_raw\|encode_sign\)\>"
|
||||
syn match regoFuncTokenVerification "\<io\.jwt\.\(verify_rs256\|verify_ps256\|verify_es256\|verify_hs256\|decode\|decode_verify\)\>"
|
||||
syn match regoFuncTime "\<time\.\(now_ns\|parse_ns\|parse_rfc3339_ns\|parse_duration_ns\|date\|clock\|weekday\)\>"
|
||||
syn match regoFuncCryptography "\<crypto\.x509\.parse_certificates\>"
|
||||
syn match regoFuncTokenVerification1 "\<io\.jwt\.\(decode\|decode_verify\)\>"
|
||||
syn match regoFuncTokenVerification2 "\<io\.jwt\.verify_\(rs\|ps\|es\|hs\)\(256\|384\|512\)\>"
|
||||
syn match regoFuncTime "\<time\.\(now_ns\|parse_ns\|parse_rfc3339_ns\|parse_duration_ns\|date\|clock\|weekday\|diff\|add_date\)\>"
|
||||
syn match regoFuncCryptography "\<crypto\.x509\.\(parse_certificates\|parse_certificate_request\|parse_and_verify_certificates\|parse_rsa_private_key\)\>"
|
||||
syn match regoFuncCryptography "\<crypto\.\(md5\|sha1\|sha256\)"
|
||||
syn match regoFuncCryptography "\<crypto\.hmac\.\(md5\|sha1\|sha256\|sha512\)"
|
||||
syn keyword regoFuncGraphs walk
|
||||
syn match regoFuncGraphs2 "\<graph\.reachable\(_paths\)\=\>"
|
||||
syn match regoFuncGraphQl "\<graphql\.\(\(schema_\)\=is_valid\|parse\(_\(and_verify\|query\|schema\)\)\=\)\>"
|
||||
syn match regoFuncHttp "\<http\.send\>"
|
||||
syn match regoFuncNet "\<net\.\(cidr_contains\|cidr_intersects\)\>"
|
||||
syn match regoFuncRego "\<rego\.parse_module\>"
|
||||
syn match regoFuncNet "\<net\.\(cidr_merge\|cidr_contains\|cidr_contains_matches\|cidr_intersects\|cidr_expand\|lookup_ip_addr\|cidr_is_valid\)\>"
|
||||
syn match regoFuncRego "\<rego\.\(parse_module\|metadata\.\(rule\|chain\)\)\>"
|
||||
syn match regoFuncOpa "\<opa\.runtime\>"
|
||||
syn keyword regoFuncDebugging trace
|
||||
syn match regoFuncRand "\<rand\.intn\>"
|
||||
|
||||
syn match regoFuncNumbers "\<numbers\.\(range\|intn\)\>"
|
||||
syn keyword regoFuncNumbers round ceil floor abs
|
||||
|
||||
syn match regoFuncSemver "\<semver\.\(is_valid\|compare\)\>"
|
||||
syn keyword regoFuncConversions to_number
|
||||
syn match regoFuncHex "\<hex\.\(encode\|decode\)\>"
|
||||
|
||||
hi def link regoFuncUuid Statement
|
||||
hi def link regoFuncBits Statement
|
||||
hi def link regoDirective Statement
|
||||
hi def link regoKeywords Statement
|
||||
hi def link regoFuncAggregates Statement
|
||||
@ -60,16 +80,27 @@ hi def link regoFuncTypes Statement
|
||||
hi def link regoFuncEncoding1 Statement
|
||||
hi def link regoFuncEncoding2 Statement
|
||||
hi def link regoFuncEncoding3 Statement
|
||||
hi def link regoFuncEncoding4 Statement
|
||||
hi def link regoFuncEncoding5 Statement
|
||||
hi def link regoFuncTokenSigning Statement
|
||||
hi def link regoFuncTokenVerification Statement
|
||||
hi def link regoFuncTokenVerification1 Statement
|
||||
hi def link regoFuncTokenVerification2 Statement
|
||||
hi def link regoFuncTime Statement
|
||||
hi def link regoFuncCryptography Statement
|
||||
hi def link regoFuncGraphs Statement
|
||||
hi def link regoFuncGraphQl Statement
|
||||
hi def link regoFuncGraphs2 Statement
|
||||
hi def link regoFuncHttp Statement
|
||||
hi def link regoFuncNet Statement
|
||||
hi def link regoFuncRego Statement
|
||||
hi def link regoFuncOpa Statement
|
||||
hi def link regoFuncDebugging Statement
|
||||
hi def link regoFuncObject Statement
|
||||
hi def link regoFuncNumbers Statement
|
||||
hi def link regoFuncSemver Statement
|
||||
hi def link regoFuncConversions Statement
|
||||
hi def link regoFuncHex Statement
|
||||
hi def link regoFuncRand Statement
|
||||
|
||||
" https://www.openpolicyagent.org/docs/latest/policy-language/#strings
|
||||
syn region regoString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
|
@ -2,8 +2,8 @@
|
||||
" Language: shell (sh) Korn shell (ksh) bash (sh)
|
||||
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
|
||||
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
|
||||
" Last Change: Jul 08, 2022
|
||||
" Version: 203
|
||||
" Last Change: Nov 25, 2022
|
||||
" Version: 204
|
||||
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
|
||||
" For options and settings, please use: :help ft-sh-syntax
|
||||
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) and heredoc fixes from Felipe Contreras
|
||||
@ -84,15 +84,9 @@ elseif g:sh_fold_enabled != 0 && !has("folding")
|
||||
let g:sh_fold_enabled= 0
|
||||
echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support"
|
||||
endif
|
||||
if !exists("s:sh_fold_functions")
|
||||
let s:sh_fold_functions= and(g:sh_fold_enabled,1)
|
||||
endif
|
||||
if !exists("s:sh_fold_heredoc")
|
||||
let s:sh_fold_heredoc = and(g:sh_fold_enabled,2)
|
||||
endif
|
||||
if !exists("s:sh_fold_ifdofor")
|
||||
let s:sh_fold_ifdofor = and(g:sh_fold_enabled,4)
|
||||
endif
|
||||
let s:sh_fold_functions= and(g:sh_fold_enabled,1)
|
||||
let s:sh_fold_heredoc = and(g:sh_fold_enabled,2)
|
||||
let s:sh_fold_ifdofor = and(g:sh_fold_enabled,4)
|
||||
if g:sh_fold_enabled && &fdm == "manual"
|
||||
" Given that the user provided g:sh_fold_enabled
|
||||
" AND g:sh_fold_enabled is manual (usual default)
|
||||
@ -113,6 +107,9 @@ endif
|
||||
|
||||
" Set up folding commands for shell {{{1
|
||||
" =================================
|
||||
sil! delc ShFoldFunctions
|
||||
sil! delc ShFoldHereDoc
|
||||
sil! delc ShFoldIfDoFor
|
||||
if s:sh_fold_functions
|
||||
com! -nargs=* ShFoldFunctions <args> fold
|
||||
else
|
||||
@ -415,22 +412,22 @@ syn match shBQComment contained "#.\{-}\ze`" contains=@shCommentGroup
|
||||
" Here Documents: {{{1
|
||||
" (modified by Felipe Contreras)
|
||||
" =========================================
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc01 end="^\z1\s*$" contains=@shDblQuoteList
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<-\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc02 end="^\s*\z1\s*$" contains=@shDblQuoteList
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc03 end="^\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc04 end="^\s*\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^']\+\)'" matchgroup=shHereDoc05 end="^\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*'\z([^']\+\)'" matchgroup=shHereDoc06 end="^\s*\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\"\z([^"]\+\)\"" matchgroup=shHereDoc07 end="^\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<-\s*\"\z([^"]\+\)\"" matchgroup=shHereDoc08 end="^\s*\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc09 end="^\z1\s*$" contains=@shDblQuoteList
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" contains=@shDblQuoteList
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc11 end="^\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc12 end="^\s*\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<\s*\\\_$\_s*'\z([^']\+\)'" matchgroup=shHereDoc13 end="^\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<-\s*\\\_$\_s*'\z([^']\+\)'" matchgroup=shHereDoc14 end="^\s*\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<\s*\\\_$\_s*\"\z([^"]\+\)\"" matchgroup=shHereDoc15 end="^\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\_$\_s*\"\z([^"]\+\)\"" matchgroup=shHereDoc16 end="^\s*\z1\s*$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc01 end="^\z1$" contains=@shDblQuoteList
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<-\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc02 end="^\s*\z1$" contains=@shDblQuoteList
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc03 end="^\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc04 end="^\s*\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^']\+\)'" matchgroup=shHereDoc05 end="^\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*'\z([^']\+\)'" matchgroup=shHereDoc06 end="^\s*\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\"\z([^"]\+\)\"" matchgroup=shHereDoc07 end="^\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<-\s*\"\z([^"]\+\)\"" matchgroup=shHereDoc08 end="^\s*\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc09 end="^\z1$" contains=@shDblQuoteList
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1$" contains=@shDblQuoteList
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc11 end="^\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc12 end="^\s*\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<\s*\\\_$\_s*'\z([^']\+\)'" matchgroup=shHereDoc13 end="^\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<-\s*\\\_$\_s*'\z([^']\+\)'" matchgroup=shHereDoc14 end="^\s*\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<\s*\\\_$\_s*\"\z([^"]\+\)\"" matchgroup=shHereDoc15 end="^\z1$"
|
||||
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\_$\_s*\"\z([^"]\+\)\"" matchgroup=shHereDoc16 end="^\s*\z1$"
|
||||
|
||||
|
||||
" Here Strings: {{{1
|
||||
|
41
runtime/syntax/wdl.vim
Normal file
41
runtime/syntax/wdl.vim
Normal file
@ -0,0 +1,41 @@
|
||||
" Vim syntax file
|
||||
" Language: wdl
|
||||
" Maintainer: Matt Dunford (zenmatic@gmail.com)
|
||||
" URL: https://github.com/zenmatic/vim-syntax-wdl
|
||||
" Last Change: 2022 Nov 24
|
||||
|
||||
" https://github.com/openwdl/wdl
|
||||
|
||||
" quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
syn keyword wdlStatement alias task input command runtime input output workflow call scatter import as meta parameter_meta in version
|
||||
syn keyword wdlConditional if then else
|
||||
syn keyword wdlType struct Array String File Int Float Boolean Map Pair Object
|
||||
|
||||
syn keyword wdlFunctions stdout stderr read_lines read_tsv read_map read_object read_objects read_json read_int read_string read_float read_boolean write_lines write_tsv write_map write_object write_objects write_json size sub range transpose zip cross length flatten prefix select_first defined basename floor ceil round
|
||||
|
||||
syn region wdlCommandSection start="<<<" end=">>>"
|
||||
|
||||
syn region wdlString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
syn region wdlString start=+'+ skip=+\\\\\|\\'+ end=+'+
|
||||
|
||||
" Comments; their contents
|
||||
syn keyword wdlTodo contained TODO FIXME XXX BUG
|
||||
syn cluster wdlCommentGroup contains=wdlTodo
|
||||
syn region wdlComment start="#" end="$" contains=@wdlCommentGroup
|
||||
|
||||
hi def link wdlStatement Statement
|
||||
hi def link wdlConditional Conditional
|
||||
hi def link wdlType Type
|
||||
hi def link wdlFunctions Function
|
||||
hi def link wdlString String
|
||||
hi def link wdlCommandSection String
|
||||
hi def link wdlComment Comment
|
||||
hi def link wdlTodo Todo
|
||||
|
||||
let b:current_syntax = 'wdl'
|
292
runtime/syntax/zig.vim
Normal file
292
runtime/syntax/zig.vim
Normal file
@ -0,0 +1,292 @@
|
||||
" Vim syntax file
|
||||
" Language: Zig
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:zig_syntax_keywords = {
|
||||
\ 'zigBoolean': ["true"
|
||||
\ , "false"]
|
||||
\ , 'zigNull': ["null"]
|
||||
\ , 'zigType': ["bool"
|
||||
\ , "f16"
|
||||
\ , "f32"
|
||||
\ , "f64"
|
||||
\ , "f80"
|
||||
\ , "f128"
|
||||
\ , "void"
|
||||
\ , "type"
|
||||
\ , "anytype"
|
||||
\ , "anyerror"
|
||||
\ , "anyframe"
|
||||
\ , "volatile"
|
||||
\ , "linksection"
|
||||
\ , "noreturn"
|
||||
\ , "allowzero"
|
||||
\ , "i0"
|
||||
\ , "u0"
|
||||
\ , "isize"
|
||||
\ , "usize"
|
||||
\ , "comptime_int"
|
||||
\ , "comptime_float"
|
||||
\ , "c_short"
|
||||
\ , "c_ushort"
|
||||
\ , "c_int"
|
||||
\ , "c_uint"
|
||||
\ , "c_long"
|
||||
\ , "c_ulong"
|
||||
\ , "c_longlong"
|
||||
\ , "c_ulonglong"
|
||||
\ , "c_longdouble"
|
||||
\ , "anyopaque"]
|
||||
\ , 'zigConstant': ["undefined"
|
||||
\ , "unreachable"]
|
||||
\ , 'zigConditional': ["if"
|
||||
\ , "else"
|
||||
\ , "switch"]
|
||||
\ , 'zigRepeat': ["while"
|
||||
\ , "for"]
|
||||
\ , 'zigComparatorWord': ["and"
|
||||
\ , "or"
|
||||
\ , "orelse"]
|
||||
\ , 'zigStructure': ["struct"
|
||||
\ , "enum"
|
||||
\ , "union"
|
||||
\ , "error"
|
||||
\ , "packed"
|
||||
\ , "opaque"]
|
||||
\ , 'zigException': ["error"]
|
||||
\ , 'zigVarDecl': ["var"
|
||||
\ , "const"
|
||||
\ , "comptime"
|
||||
\ , "threadlocal"]
|
||||
\ , 'zigDummyVariable': ["_"]
|
||||
\ , 'zigKeyword': ["fn"
|
||||
\ , "try"
|
||||
\ , "test"
|
||||
\ , "pub"
|
||||
\ , "usingnamespace"]
|
||||
\ , 'zigExecution': ["return"
|
||||
\ , "break"
|
||||
\ , "continue"]
|
||||
\ , 'zigMacro': ["defer"
|
||||
\ , "errdefer"
|
||||
\ , "async"
|
||||
\ , "nosuspend"
|
||||
\ , "await"
|
||||
\ , "suspend"
|
||||
\ , "resume"
|
||||
\ , "export"
|
||||
\ , "extern"]
|
||||
\ , 'zigPreProc': ["catch"
|
||||
\ , "inline"
|
||||
\ , "noinline"
|
||||
\ , "asm"
|
||||
\ , "callconv"
|
||||
\ , "noalias"]
|
||||
\ , 'zigBuiltinFn': ["align"
|
||||
\ , "@addWithOverflow"
|
||||
\ , "@as"
|
||||
\ , "@atomicLoad"
|
||||
\ , "@atomicStore"
|
||||
\ , "@bitCast"
|
||||
\ , "@breakpoint"
|
||||
\ , "@alignCast"
|
||||
\ , "@alignOf"
|
||||
\ , "@cDefine"
|
||||
\ , "@cImport"
|
||||
\ , "@cInclude"
|
||||
\ , "@cUndef"
|
||||
\ , "@clz"
|
||||
\ , "@cmpxchgWeak"
|
||||
\ , "@cmpxchgStrong"
|
||||
\ , "@compileError"
|
||||
\ , "@compileLog"
|
||||
\ , "@ctz"
|
||||
\ , "@popCount"
|
||||
\ , "@divExact"
|
||||
\ , "@divFloor"
|
||||
\ , "@divTrunc"
|
||||
\ , "@embedFile"
|
||||
\ , "@export"
|
||||
\ , "@extern"
|
||||
\ , "@tagName"
|
||||
\ , "@TagType"
|
||||
\ , "@errorName"
|
||||
\ , "@call"
|
||||
\ , "@errorReturnTrace"
|
||||
\ , "@fence"
|
||||
\ , "@fieldParentPtr"
|
||||
\ , "@field"
|
||||
\ , "@unionInit"
|
||||
\ , "@frameAddress"
|
||||
\ , "@import"
|
||||
\ , "@newStackCall"
|
||||
\ , "@asyncCall"
|
||||
\ , "@intToPtr"
|
||||
\ , "@max"
|
||||
\ , "@min"
|
||||
\ , "@memcpy"
|
||||
\ , "@memset"
|
||||
\ , "@mod"
|
||||
\ , "@mulAdd"
|
||||
\ , "@mulWithOverflow"
|
||||
\ , "@splat"
|
||||
\ , "@src"
|
||||
\ , "@bitOffsetOf"
|
||||
\ , "@byteOffsetOf"
|
||||
\ , "@offsetOf"
|
||||
\ , "@OpaqueType"
|
||||
\ , "@panic"
|
||||
\ , "@prefetch"
|
||||
\ , "@ptrCast"
|
||||
\ , "@ptrToInt"
|
||||
\ , "@rem"
|
||||
\ , "@returnAddress"
|
||||
\ , "@setCold"
|
||||
\ , "@Type"
|
||||
\ , "@shuffle"
|
||||
\ , "@reduce"
|
||||
\ , "@select"
|
||||
\ , "@setRuntimeSafety"
|
||||
\ , "@setEvalBranchQuota"
|
||||
\ , "@setFloatMode"
|
||||
\ , "@shlExact"
|
||||
\ , "@This"
|
||||
\ , "@hasDecl"
|
||||
\ , "@hasField"
|
||||
\ , "@shlWithOverflow"
|
||||
\ , "@shrExact"
|
||||
\ , "@sizeOf"
|
||||
\ , "@bitSizeOf"
|
||||
\ , "@sqrt"
|
||||
\ , "@byteSwap"
|
||||
\ , "@subWithOverflow"
|
||||
\ , "@intCast"
|
||||
\ , "@floatCast"
|
||||
\ , "@intToFloat"
|
||||
\ , "@floatToInt"
|
||||
\ , "@boolToInt"
|
||||
\ , "@errSetCast"
|
||||
\ , "@truncate"
|
||||
\ , "@typeInfo"
|
||||
\ , "@typeName"
|
||||
\ , "@TypeOf"
|
||||
\ , "@atomicRmw"
|
||||
\ , "@intToError"
|
||||
\ , "@errorToInt"
|
||||
\ , "@intToEnum"
|
||||
\ , "@enumToInt"
|
||||
\ , "@setAlignStack"
|
||||
\ , "@frame"
|
||||
\ , "@Frame"
|
||||
\ , "@frameSize"
|
||||
\ , "@bitReverse"
|
||||
\ , "@Vector"
|
||||
\ , "@sin"
|
||||
\ , "@cos"
|
||||
\ , "@tan"
|
||||
\ , "@exp"
|
||||
\ , "@exp2"
|
||||
\ , "@log"
|
||||
\ , "@log2"
|
||||
\ , "@log10"
|
||||
\ , "@fabs"
|
||||
\ , "@floor"
|
||||
\ , "@ceil"
|
||||
\ , "@trunc"
|
||||
\ , "@wasmMemorySize"
|
||||
\ , "@wasmMemoryGrow"
|
||||
\ , "@round"]
|
||||
\ }
|
||||
|
||||
function! s:syntax_keyword(dict)
|
||||
for key in keys(a:dict)
|
||||
execute 'syntax keyword' key join(a:dict[key], ' ')
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
call s:syntax_keyword(s:zig_syntax_keywords)
|
||||
|
||||
syntax match zigType "\v<[iu][1-9]\d*>"
|
||||
syntax match zigOperator display "\V\[-+/*=^&?|!><%~]"
|
||||
syntax match zigArrowCharacter display "\V->"
|
||||
|
||||
" 12_34 (. but not ..)? (12_34)? (exponent 12_34)?
|
||||
syntax match zigDecNumber display "\v<\d%(_?\d)*%(\.\.@!)?%(\d%(_?\d)*)?%([eE][+-]?\d%(_?\d)*)?"
|
||||
syntax match zigHexNumber display "\v<0x\x%(_?\x)*%(\.\.@!)?%(\x%(_?\x)*)?%([pP][+-]?\d%(_?\d)*)?"
|
||||
syntax match zigOctNumber display "\v<0o\o%(_?\o)*"
|
||||
syntax match zigBinNumber display "\v<0b[01]%(_?[01])*"
|
||||
|
||||
syntax match zigCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/
|
||||
syntax match zigCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/
|
||||
syntax match zigCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=zigEscape,zigEscapeError,zigCharacterInvalid,zigCharacterInvalidUnicode
|
||||
syntax match zigCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{6}\)\)'/ contains=zigEscape,zigEscapeUnicode,zigEscapeError,zigCharacterInvalid
|
||||
|
||||
syntax region zigBlock start="{" end="}" transparent fold
|
||||
|
||||
syntax region zigCommentLine start="//" end="$" contains=zigTodo,@Spell
|
||||
syntax region zigCommentLineDoc start="//[/!]/\@!" end="$" contains=zigTodo,@Spell
|
||||
|
||||
syntax match zigMultilineStringPrefix /c\?\\\\/ contained containedin=zigMultilineString
|
||||
syntax region zigMultilineString matchgroup=zigMultilineStringDelimiter start="c\?\\\\" end="$" contains=zigMultilineStringPrefix display
|
||||
|
||||
syntax keyword zigTodo contained TODO
|
||||
|
||||
syntax region zigString matchgroup=zigStringDelimiter start=+c\?"+ skip=+\\\\\|\\"+ end=+"+ oneline contains=zigEscape,zigEscapeUnicode,zigEscapeError,@Spell
|
||||
syntax match zigEscapeError display contained /\\./
|
||||
syntax match zigEscape display contained /\\\([nrt\\'"]\|x\x\{2}\)/
|
||||
syntax match zigEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{6}\)/
|
||||
|
||||
highlight default link zigDecNumber zigNumber
|
||||
highlight default link zigHexNumber zigNumber
|
||||
highlight default link zigOctNumber zigNumber
|
||||
highlight default link zigBinNumber zigNumber
|
||||
|
||||
highlight default link zigBuiltinFn Statement
|
||||
highlight default link zigKeyword Keyword
|
||||
highlight default link zigType Type
|
||||
highlight default link zigCommentLine Comment
|
||||
highlight default link zigCommentLineDoc Comment
|
||||
highlight default link zigDummyVariable Comment
|
||||
highlight default link zigTodo Todo
|
||||
highlight default link zigString String
|
||||
highlight default link zigStringDelimiter String
|
||||
highlight default link zigMultilineString String
|
||||
highlight default link zigMultilineStringContent String
|
||||
highlight default link zigMultilineStringPrefix String
|
||||
highlight default link zigMultilineStringDelimiter Delimiter
|
||||
highlight default link zigCharacterInvalid Error
|
||||
highlight default link zigCharacterInvalidUnicode zigCharacterInvalid
|
||||
highlight default link zigCharacter Character
|
||||
highlight default link zigEscape Special
|
||||
highlight default link zigEscapeUnicode zigEscape
|
||||
highlight default link zigEscapeError Error
|
||||
highlight default link zigBoolean Boolean
|
||||
highlight default link zigNull Boolean
|
||||
highlight default link zigConstant Constant
|
||||
highlight default link zigNumber Number
|
||||
highlight default link zigArrowCharacter zigOperator
|
||||
highlight default link zigOperator Operator
|
||||
highlight default link zigStructure Structure
|
||||
highlight default link zigExecution Special
|
||||
highlight default link zigMacro Macro
|
||||
highlight default link zigConditional Conditional
|
||||
highlight default link zigComparatorWord Keyword
|
||||
highlight default link zigRepeat Repeat
|
||||
highlight default link zigSpecial Special
|
||||
highlight default link zigVarDecl Function
|
||||
highlight default link zigPreProc PreProc
|
||||
highlight default link zigException Exception
|
||||
|
||||
delfunction s:syntax_keyword
|
||||
|
||||
let b:current_syntax = "zig"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet! s:cpo_save
|
49
runtime/syntax/zir.vim
Normal file
49
runtime/syntax/zir.vim
Normal file
@ -0,0 +1,49 @@
|
||||
" Vim syntax file
|
||||
" Language: Zir
|
||||
" Upstream: https://github.com/ziglang/zig.vim
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let b:current_syntax = "zir"
|
||||
|
||||
syn region zirCommentLine start=";" end="$" contains=zirTodo,@Spell
|
||||
|
||||
syn region zirBlock start="{" end="}" transparent fold
|
||||
|
||||
syn keyword zirKeyword primitive fntype int str as ptrtoint fieldptr deref asm unreachable export ref fn
|
||||
|
||||
syn keyword zirTodo contained TODO
|
||||
|
||||
syn region zirString start=+c\?"+ skip=+\\\\\|\\"+ end=+"+ oneline contains=zirEscape,zirEscapeUnicode,zirEscapeError,@Spell
|
||||
|
||||
syn match zirEscapeError display contained /\\./
|
||||
syn match zirEscape display contained /\\\([nrt\\'"]\|x\x\{2}\)/
|
||||
syn match zirEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{6}\)/
|
||||
|
||||
syn match zirDecNumber display "\<[0-9]\+\%(.[0-9]\+\)\=\%([eE][+-]\?[0-9]\+\)\="
|
||||
syn match zirHexNumber display "\<0x[a-fA-F0-9]\+\%([a-fA-F0-9]\+\%([pP][+-]\?[0-9]\+\)\?\)\="
|
||||
syn match zirOctNumber display "\<0o[0-7]\+"
|
||||
syn match zirBinNumber display "\<0b[01]\+\%(.[01]\+\%([eE][+-]\?[0-9]\+\)\?\)\="
|
||||
|
||||
syn match zirGlobal display "[^a-zA-Z0-9_]\?\zs@[a-zA-Z0-9_]\+"
|
||||
syn match zirLocal display "[^a-zA-Z0-9_]\?\zs%[a-zA-Z0-9_]\+"
|
||||
|
||||
hi def link zirCommentLine Comment
|
||||
hi def link zirTodo Todo
|
||||
|
||||
hi def link zirKeyword Keyword
|
||||
|
||||
hi def link zirString Constant
|
||||
|
||||
hi def link zirEscape Special
|
||||
hi def link zirEscapeUnicode zirEscape
|
||||
hi def link zirEscapeError Error
|
||||
|
||||
hi def link zirDecNumber Constant
|
||||
hi def link zirHexNumber Constant
|
||||
hi def link zirOctNumber Constant
|
||||
hi def link zirBinNumber Constant
|
||||
|
||||
hi def link zirGlobal Identifier
|
||||
hi def link zirLocal Identifier
|
Loading…
Reference in New Issue
Block a user