Compare commits

..

17 Commits

Author SHA1 Message Date
Adam Stankiewicz
2edc785a5e Make typescript.tsx default filetype for tsx, fixes #409 2019-06-09 00:08:31 +02:00
Adam Stankiewicz
445e026010 Add styled-components, closes #407 2019-06-08 14:12:14 +02:00
Adam Stankiewicz
fca45b2c2b Add rego support, closes #406 2019-06-08 13:36:13 +02:00
Adam Stankiewicz
ebf9ec9d62 Add zig support, closes #405 2019-06-08 13:34:40 +02:00
Adam Stankiewicz
9caa678708 Add ion shell support, closes #404 2019-06-08 13:33:25 +02:00
Adam Stankiewicz
8f2a71643a Add hcl support, closes #403 2019-06-08 13:32:04 +02:00
Adam Stankiewicz
af763ef221 Change tmux provider, closes #402 2019-06-08 13:29:23 +02:00
Adam Stankiewicz
5ded0682bd Add dlang support, closes #401 2019-06-08 13:28:47 +02:00
Adam Stankiewicz
26c678b08d Change jsx/tsx provider, closes #400 2019-06-08 13:25:41 +02:00
Adam Stankiewicz
17ecfbdabc Add s:setf helper, fixes #399 2019-06-08 13:14:56 +02:00
Adam Stankiewicz
0217fb50fe Add tsx provider, closes #330 2019-06-08 13:03:32 +02:00
Adam Stankiewicz
5023da62ec Add hive syntax, closes #396 2019-06-08 12:50:29 +02:00
Adam Stankiewicz
957228cc25 Add log syntax, closes #394 2019-06-08 12:48:22 +02:00
Adam Stankiewicz
7aae831309 Add tptp syntax 2019-06-08 12:46:43 +02:00
Adam Stankiewicz
671078ef6c Update 2019-06-08 12:44:15 +02:00
Adam Stankiewicz
aebef2c2e7 Update 2019-05-07 16:17:56 +02:00
German Lashevich
e8245dbf17 FIx CI build freezing (#398)
* Kill vim server

* Fix incorrect usage of rspec

* Add build stage to CI

* Try using new server for each run

* Sort and uniq test files
2019-05-01 23:52:54 +02:00
71 changed files with 5313 additions and 8396 deletions

View File

@@ -7,6 +7,5 @@ addons:
packages:
- vim-gtk
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
script: bundle exec rspec --format=documentation
- "./build"
script: xvfb-run bundle exec rspec --format=documentation

View File

@@ -10,7 +10,7 @@ A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 120+ times faster** than the <!--Package Count-->134<!--/Package Count--> packages it consists of.
- It **installs and updates 120+ times faster** than the <!--Package Count-->143<!--/Package Count--> packages it consists of.
- Solid syntax and indentation support (other features skipped). Only the best language packs.
- All unnecessary files are ignored (like enormous documentation from php support).
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
@@ -68,6 +68,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin)
- [cue](https://github.com/mgrabovsky/vim-cuesheet) (syntax)
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin)
- [dlang](https://github.com/JesseKPhillips/d.vim) (syntax, indent)
- [dockerfile](https://github.com/ekalinin/Dockerfile.vim) (syntax, indent, ftplugin)
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, autoload, ftplugin)
- [elm](https://github.com/ElmCast/elm-vim) (syntax, indent, autoload, ftplugin)
@@ -91,9 +92,12 @@ If you need full functionality of any plugin, please use it directly with your p
- [haproxy](https://github.com/CH-DanReif/haproxy.vim) (syntax)
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin)
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax)
- [hcl](https://github.com/b4b4r07/vim-hcl) (syntax, indent, ftplugin)
- [hive](https://github.com/zebradil/hive.vim) (syntax, ftplugin)
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
- [i3](https://github.com/mboughaba/i3config.vim) (syntax, ftplugin)
- [idris](https://github.com/idris-hackers/idris-vim) (syntax, indent, ftplugin)
- [ion](https://github.com/vmchale/ion-vim) (syntax, ftplugin)
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax)
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
@@ -101,7 +105,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [json5](https://github.com/GutenYe/json5.vim) (syntax)
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
- [jsx](https://github.com/amadeus/vim-jsx) (syntax, indent, ftplugin)
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty) (autoload, syntax, indent, ftplugin)
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (syntax, indent, autoload, ftplugin)
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent, ftplugin)
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
@@ -109,10 +113,11 @@ If you need full functionality of any plugin, please use it directly with your p
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond) (syntax, indent, compiler, ftplugin)
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin)
- [llvm](https://github.com/rhysd/vim-llvm) (syntax, indent, ftplugin)
- [log](https://github.com/MTDL9/vim-log-highlighting) (syntax)
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, indent)
- [mathematica](https://github.com/voldikss/vim-mma) (syntax, autoload, ftplugin)
- [mathematica](https://github.com/voldikss/vim-mma) (syntax, ftplugin)
- [mdx](https://github.com/jxnblk/vim-mdx-js) (syntax)
- [meson](https://github.com/mesonbuild/meson) (syntax, indent, ftplugin)
- [moonscript](https://github.com/leafo/moonscript-vim) (syntax, indent, ftplugin)
@@ -143,6 +148,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin)
- [reason](https://github.com/reasonml-editor/vim-reason-plus) (syntax, indent)
- [rego](https://github.com/tsandall/vim-rego) (syntax)
- [rspec](https://github.com/sheerun/rspec.vim) (syntax)
- [rst](https://github.com/marshallward/vim-restructuredtext) (syntax, autoload, ftplugin)
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin)
@@ -154,18 +160,20 @@ If you need full functionality of any plugin, please use it directly with your p
- [slime](https://github.com/slime-lang/vim-slime-syntax) (syntax, indent)
- [smt2](https://github.com/bohlender/vim-smt2) (syntax, autoload, ftplugin)
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
- [styled-components](https://github.com/styled-components/vim-styled-components#main) (syntax, indent, ftplugin)
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
- [svg-indent](https://github.com/jasonshell/vim-svg-indent) (indent)
- [svg](https://github.com/vim-scripts/svg.vim) (syntax)
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin)
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax)
- [systemd](https://github.com/wgwoods/vim-systemd-syntax) (syntax)
- [terraform](https://github.com/hashivim/vim-terraform) (syntax, indent, ftplugin)
- [terraform](https://github.com/hashivim/vim-terraform) (syntax, indent, autoload, ftplugin)
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin)
- [thrift](https://github.com/solarnz/thrift.vim) (syntax)
- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin)
- [tmux](https://github.com/ericpruitt/tmux.vim) ()
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin)
- [tptp](https://github.com/c-cube/vim-tptp) (syntax)
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin)
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent)
@@ -179,6 +187,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [xml](https://github.com/amadeus/vim-xml) (syntax)
- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin)
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
- [zig](https://github.com/ziglang/zig.vim) (syntax, autoload, ftplugin)
<!--/Language Packs-->
## Updating

View File

@@ -14,3 +14,75 @@ if exists('b:undo_ftplugin')
else
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
endif
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim ftplugin file
"
" Language: javascript.jsx
" Maintainer: MaxMEllon <maxmellon1994@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" modified from html.vim
" For matchit plugin
if exists("loaded_matchit")
let b:match_ignorecase = 0
let b:match_words = '(:),\[:\],{:},<:>,' .
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
endif
" For andymass/vim-matchup plugin
if exists("loaded_matchup")
setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
let b:match_skip = 's:comment\|string'
endif
let b:original_commentstring = &l:commentstring
augroup jsx_comment
autocmd! CursorMoved <buffer>
autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:original_commentstring)
augroup end
setlocal suffixesadd+=.jsx
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
finish
endif
" Vim filetype plugin file
" Language: styled-components (js/ts)
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
" URL: https://github.com/styled-components/vim-styled-components
fu! s:GetSyntaxNames(lnum, cnum)
return map(synstack(a:lnum, a:cnum), 'synIDattr(v:val, "name")')
endfu
" re-implement SynSOL of vim-jsx
fu! s:SynSOL(lnum)
return s:GetSyntaxNames(a:lnum, 1)
endfu
"" Return whether the current line is a jsTemplateString
fu! IsStyledDefinition(lnum)
" iterate through all syntax items in the given line
for item in s:SynSOL(a:lnum)
" if syntax-item is a jsTemplateString return 1 - true
" `==#` is a match case comparison of the item
if item ==# 'styledDefinition'
return 1
endif
endfor
" fallback to 0 - false
return 0
endfu
if exists('&ofu')
let b:prevofu=&ofu
setl omnifunc=styledcomplete#CompleteSC
endif

View File

@@ -1,31 +0,0 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim ftplugin file
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" modified from html.vim
if exists("loaded_matchit")
let b:match_ignorecase = 0
let s:jsx_match_words = '<\([a-zA-Z0-9.]\+\)\(>\|$\|\s\):<\/\1>'
if !exists('b:loaded_jsx_match_words')
let b:loaded_jsx_match_words = 0
endif
if b:loaded_jsx_match_words == 0
let b:match_words = exists('b:match_words')
\ ? b:match_words . ',' . s:jsx_match_words
\ : s:jsx_match_words
endif
let b:loaded_jsx_match_words = 1
endif
setlocal suffixesadd+=.jsx

View File

@@ -1,85 +0,0 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'terraform') != -1
finish
endif
if !exists('g:terraform_align')
let g:terraform_align = 0
endif
if !exists('g:terraform_remap_spacebar')
let g:terraform_remap_spacebar = 0
endif
if !exists('g:terraform_fold_sections')
let g:terraform_fold_sections = 0
endif
if g:terraform_align && exists(':Tabularize')
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
function! s:terraformalign()
let p = '^.*=[^>]*$'
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
Tabularize/=/l1
normal! 0
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
endif
if g:terraform_fold_sections
function! TerraformFolds()
let thisline = getline(v:lnum)
if match(thisline, '^resource') >= 0
return ">1"
elseif match(thisline, '^provider') >= 0
return ">1"
elseif match(thisline, '^module') >= 0
return ">1"
elseif match(thisline, '^variable') >= 0
return ">1"
elseif match(thisline, '^output') >= 0
return ">1"
elseif match(thisline, '^data') >= 0
return ">1"
elseif match(thisline, '^terraform') >= 0
return ">1"
elseif match(thisline, '^locals') >= 0
return ">1"
else
return "="
endif
endfunction
setlocal foldmethod=expr
setlocal foldexpr=TerraformFolds()
setlocal foldlevel=1
function! TerraformFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
setlocal foldtext=TerraformFoldText()
endif
" Re-map the space bar to fold and unfold
if get(g:, "terraform_remap_spacebar", 1)
"inoremap <space> <C-O>za
nnoremap <space> za
onoremap <space> <C-C>za
vnoremap <space> zf
endif
" Match the identation put in place by Hashicorp and :TerraformFmt, https://github.com/hashivim/vim-terraform/issues/21
if get(g:, "terraform_align", 1)
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
endif
" Set the commentstring
if exists('g:terraform_commentstring')
let &l:commentstring=g:terraform_commentstring
else
setlocal commentstring=#%s
endif

View File

@@ -0,0 +1,27 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
" modified from html.vim
" For matchit plugin
if exists("loaded_matchit")
let b:match_ignorecase = 0
let b:match_words = '(:),\[:\],{:},<:>,' .
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
endif
" For andymass/vim-matchup plugin
if exists("loaded_matchup")
setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
let b:match_skip = 's:comment\|string'
endif
let b:original_commentstring = &l:commentstring
augroup jsx_comment
autocmd! CursorMoved <buffer>
autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:original_commentstring)
augroup end
setlocal suffixesadd+=.tsx

206
after/indent/javascript.vim Normal file
View File

@@ -0,0 +1,206 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim indent file
"
" Language: javascript.jsx
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if exists('b:did_indent')
let s:did_indent = b:did_indent
unlet b:did_indent
endif
let s:keepcpo = &cpo
set cpo&vim
if exists('s:did_indent')
let b:did_indent = s:did_indent
endif
setlocal indentexpr=GetJsxIndent()
setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e,*<Return>,<>>,<<>,/
function! GetJsxIndent()
return jsx_pretty#indent#get(function('GetJavascriptIndent'))
endfunction
let &cpo = s:keepcpo
unlet s:keepcpo
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
finish
endif
" Vim syntax file
" Language: styled-components (js/ts)
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
" URL: https://github.com/styled-components/vim-styled-components
" initialize variable to check, if the indentation expression is run
" multiple times in a row, which indicates an infinite recursion
let s:is_recursion = 0
" store current indentexpr for later
let b:js_ts_indent=&indentexpr
" set indentexpr for this filetype (styled-components)
setlocal indentexpr=GetStyledIndent()
" add the following keys to trigger reindenting, when in insert mode
" - *; - Indent and insert on press of ';' key.
" - *<:> - Indent and insert on press of ':' key.
set indentkeys+=*;,*<:>,*<Return>
fu! s:GetSyntaxNames(lnum, cnum)
return map(synstack(a:lnum, a:cnum), 'synIDattr(v:val, "name")')
endfu
" re-implement SynSOL of vim-jsx
" TODO: add dependency to the readme and remove duplicate implementation
fu! s:SynSOL(lnum)
return s:GetSyntaxNames(a:lnum, 1)
endfu
" re-implement SynEOL of vim-jsx
" TODO: add dependency to the readme and remove duplicate implementation
fu! s:SynEOL(lnum, offset)
let l:lnum = prevnonblank(a:lnum)
let l:col = strlen(getline(l:lnum))
return s:GetSyntaxNames(l:lnum, l:col + a:offset)
endfu
"" Return whether the current line is a jsTemplateString
fu! s:IsStyledDefinition(lnum)
" iterate through all syntax items in the given line
for item in s:SynSOL(a:lnum)
" if syntax-item is a jsTemplateString return 1 - true
" `==#` is a match case comparison of the item
if item ==# 'styledDefinition'
return 1
endif
endfor
" fallback to 0 - false
return 0
endfu
"" Count occurences of `str` at the beginning of the given `lnum` line
fu! s:CountOccurencesInSOL(lnum, str)
let l:occurence = 0
" iterate through all items in the given line
for item in s:SynSOL(a:lnum)
" if the syntax-item equals the given str increment the counter
" `==?` is a case isensitive equal operation
if item ==? a:str
let l:occurence += 1
endif
endfor
" return the accumulated count of occurences
return l:occurence
endfu
"" Count occurences of `str` at the end of the given `lnum` line
fu! s:CountOccurencesInEOL(lnum, str, offset)
let l:occurence = 0
" iterate through all items in the given line
for item in s:SynEOL(a:lnum, a:offset)
" if the syntax-item equals the given str increment the counter
" `==?` is a case insensitive equal operation
if item == a:str
let l:occurence += 1
endif
endfor
" return the accumulated count of occurences
return l:occurence
endfu
"" Get the indentation of the current line
fu! GetStyledIndent()
if s:IsStyledDefinition(v:lnum)
let l:baseIndent = 0
" find last non-styled line
let l:cnum = v:lnum
while s:IsStyledDefinition(l:cnum)
let l:cnum -= 1
endwhile
" get indentation of the last non-styled line as base indentation
let l:baseIndent = indent(l:cnum)
" incrementally build indentation based on current indentation
" - one shiftwidth for the styled definition region
" - one shiftwidth per open nested definition region
let l:styledIndent = &sw
let l:styledIndent += min([
\ s:CountOccurencesInSOL(v:lnum, 'styledNestedRegion'),
\ s:CountOccurencesInEOL(v:lnum, 'styledNestedRegion', 0)
\ ]) * &sw
" decrease indentation by one shiftwidth, if the styled definition
" region ends on the current line
" - either directly via styled definition region, or
" - if the very last
if s:CountOccurencesInEOL(v:lnum, 'styledDefinition', 1) == 0
let l:styledIndent -= &sw
endif
" return the base indentation
" (for nested styles inside classes/objects/etc.) plus the actual
" indentation inside the styled definition region
return l:baseIndent + l:styledIndent
elseif len(b:js_ts_indent)
let l:result = 0
let l:offset = 0
" increase indentation by one shiftwidth, if the last line ended on a
" styledXmlRegion and this line does not continue with it
" this is a fix for an incorrectly indented xml prop after a
" glamor-styled styledXmlRegion
if s:CountOccurencesInEOL(v:lnum-1, 'styledXmlRegion', 0) == 1 &&
\ s:CountOccurencesInSOL(v:lnum, 'styledXmlRegion') == 0
let l:offset = &sw
endif
" make sure `GetStyledIndent` and `GetJsxIndent` don't infinitely
" recurse by incrementing a counter variable, before evaluating the
" stored indent expression
if s:is_recursion == 0
let s:is_recursion = 1
let l:result = eval(b:js_ts_indent)
endif
" `is_recursion` being 0 at this point indicates, that
" `eval(b:js_ts_indent)` did itself evaluate it's stored indentexpr
" and thus it can be assumed, that the current line should be
" indented as JS
if s:is_recursion == 0
" use one of `GetJavascriptIndent` or `GetJsIndent` if existing
" fallback to cindent, if not
if exists('*GetJavascriptIndent')
let l:result = GetJavascriptIndent()
elseif exists('*GetJsIndent')
let l:result = GetJsIndent()
else
let l:result = cindent(v:lnum)
endif
endif
" reset `is_recursion` counter and return the indentation value
let s:is_recursion = 0
return l:result + l:offset
endif
" if all else fails indent according to C-syntax
return cindent(v:lnum)
endfu

View File

@@ -1,118 +1,173 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
finish
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim indent file
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim syntax file
" Language: styled-components (js/ts)
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
" URL: https://github.com/styled-components/vim-styled-components
" Save the current JavaScript indentexpr.
let b:jsx_js_indentexpr = &indentexpr
" initialize variable to check, if the indentation expression is run
" multiple times in a row, which indicates an infinite recursion
let s:is_recursion = 0
" Prologue; load in XML indentation.
if exists('b:did_indent')
let s:did_indent=b:did_indent
unlet b:did_indent
endif
exe 'runtime! indent/xml.vim'
if exists('s:did_indent')
let b:did_indent=s:did_indent
endif
" store current indentexpr for later
let b:js_ts_indent=&indentexpr
setlocal indentexpr=GetJsxIndent()
" set indentexpr for this filetype (styled-components)
setlocal indentexpr=GetStyledIndent()
" JS indentkeys
setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e
" XML indentkeys
setlocal indentkeys+=*<Return>,<>>,<<>,/
" add the following keys to trigger reindenting, when in insert mode
" - *; - Indent and insert on press of ';' key.
" - *<:> - Indent and insert on press of ':' key.
set indentkeys+=*;,*<:>,*<Return>
" Multiline end tag regex (line beginning with '>' or '/>')
let s:endtag = '^\s*\/\?>\s*;\='
" Get all syntax types at the beginning of a given line.
fu! SynSOL(lnum)
return map(synstack(a:lnum, 1), 'synIDattr(v:val, "name")')
fu! s:GetSyntaxNames(lnum, cnum)
return map(synstack(a:lnum, a:cnum), 'synIDattr(v:val, "name")')
endfu
" Get all syntax types at the end of a given line.
fu! SynEOL(lnum)
let lnum = prevnonblank(a:lnum)
let col = strlen(getline(lnum))
return map(synstack(lnum, col), 'synIDattr(v:val, "name")')
" re-implement SynSOL of vim-jsx
" TODO: add dependency to the readme and remove duplicate implementation
fu! s:SynSOL(lnum)
return s:GetSyntaxNames(a:lnum, 1)
endfu
" Check if a syntax attribute is XMLish.
fu! SynAttrXMLish(synattr)
return a:synattr =~ "^xml" || a:synattr =~ "^jsx"
" re-implement SynEOL of vim-jsx
" TODO: add dependency to the readme and remove duplicate implementation
fu! s:SynEOL(lnum, offset)
let l:lnum = prevnonblank(a:lnum)
let l:col = strlen(getline(l:lnum))
return s:GetSyntaxNames(l:lnum, l:col + a:offset)
endfu
" Check if a synstack is XMLish (i.e., has an XMLish last attribute).
fu! SynXMLish(syns)
return SynAttrXMLish(get(a:syns, -1))
"" Return whether the current line is a jsTemplateString
fu! s:IsStyledDefinition(lnum)
" iterate through all syntax items in the given line
for item in s:SynSOL(a:lnum)
" if syntax-item is a jsTemplateString return 1 - true
" `==#` is a match case comparison of the item
if item ==# 'styledDefinition'
return 1
endif
endfor
" fallback to 0 - false
return 0
endfu
" Check if a synstack denotes the end of a JSX block.
fu! SynJSXBlockEnd(syns)
return get(a:syns, -1) =~ '\%(js\|javascript\)Braces' &&
\ SynAttrXMLish(get(a:syns, -2))
"" Count occurences of `str` at the beginning of the given `lnum` line
fu! s:CountOccurencesInSOL(lnum, str)
let l:occurence = 0
" iterate through all items in the given line
for item in s:SynSOL(a:lnum)
" if the syntax-item equals the given str increment the counter
" `==?` is a case isensitive equal operation
if item ==? a:str
let l:occurence += 1
endif
endfor
" return the accumulated count of occurences
return l:occurence
endfu
" Determine how many jsxRegions deep a synstack is.
fu! SynJSXDepth(syns)
return len(filter(copy(a:syns), 'v:val ==# "jsxRegion"'))
"" Count occurences of `str` at the end of the given `lnum` line
fu! s:CountOccurencesInEOL(lnum, str, offset)
let l:occurence = 0
" iterate through all items in the given line
for item in s:SynEOL(a:lnum, a:offset)
" if the syntax-item equals the given str increment the counter
" `==?` is a case insensitive equal operation
if item == a:str
let l:occurence += 1
endif
endfor
" return the accumulated count of occurences
return l:occurence
endfu
" Check whether `cursyn' continues the same jsxRegion as `prevsyn'.
fu! SynJSXContinues(cursyn, prevsyn)
let curdepth = SynJSXDepth(a:cursyn)
let prevdepth = SynJSXDepth(a:prevsyn)
"" Get the indentation of the current line
fu! GetStyledIndent()
if s:IsStyledDefinition(v:lnum)
let l:baseIndent = 0
" In most places, we expect the nesting depths to be the same between any
" two consecutive positions within a jsxRegion (e.g., between a parent and
" child node, between two JSX attributes, etc.). The exception is between
" sibling nodes, where after a completed element (with depth N), we return
" to the parent's nesting (depth N - 1). This case is easily detected,
" since it is the only time when the top syntax element in the synstack is
" jsxRegion---specifically, the jsxRegion corresponding to the parent.
return prevdepth == curdepth ||
\ (prevdepth == curdepth + 1 && get(a:cursyn, -1) ==# 'jsxRegion')
endfu
" find last non-styled line
let l:cnum = v:lnum
while s:IsStyledDefinition(l:cnum)
let l:cnum -= 1
endwhile
" Cleverly mix JS and XML indentation.
fu! GetJsxIndent()
let cursyn = SynSOL(v:lnum)
let prevsyn = SynEOL(v:lnum - 1)
" get indentation of the last non-styled line as base indentation
let l:baseIndent = indent(l:cnum)
" Use XML indenting iff:
" - the syntax at the end of the previous line was either JSX or was the
" closing brace of a jsBlock whose parent syntax was JSX; and
" - the current line continues the same jsxRegion as the previous line.
if (SynXMLish(prevsyn) || SynJSXBlockEnd(prevsyn)) &&
\ SynJSXContinues(cursyn, prevsyn)
let ind = XmlIndentGet(v:lnum, 0)
" incrementally build indentation based on current indentation
" - one shiftwidth for the styled definition region
" - one shiftwidth per open nested definition region
let l:styledIndent = &sw
let l:styledIndent += min([
\ s:CountOccurencesInSOL(v:lnum, 'styledNestedRegion'),
\ s:CountOccurencesInEOL(v:lnum, 'styledNestedRegion', 0)
\ ]) * &sw
" Align '/>' and '>' with '<' for multiline tags.
if getline(v:lnum) =~? s:endtag
let ind = ind - &sw
" decrease indentation by one shiftwidth, if the styled definition
" region ends on the current line
" - either directly via styled definition region, or
" - if the very last
if s:CountOccurencesInEOL(v:lnum, 'styledDefinition', 1) == 0
let l:styledIndent -= &sw
endif
" Then correct the indentation of any JSX following '/>' or '>'.
if getline(v:lnum - 1) =~? s:endtag
let ind = ind + &sw
" return the base indentation
" (for nested styles inside classes/objects/etc.) plus the actual
" indentation inside the styled definition region
return l:baseIndent + l:styledIndent
elseif len(b:js_ts_indent)
let l:result = 0
let l:offset = 0
" increase indentation by one shiftwidth, if the last line ended on a
" styledXmlRegion and this line does not continue with it
" this is a fix for an incorrectly indented xml prop after a
" glamor-styled styledXmlRegion
if s:CountOccurencesInEOL(v:lnum-1, 'styledXmlRegion', 0) == 1 &&
\ s:CountOccurencesInSOL(v:lnum, 'styledXmlRegion') == 0
let l:offset = &sw
endif
else
if len(b:jsx_js_indentexpr)
" Invoke the base JS package's custom indenter. (For vim-javascript,
" e.g., this will be GetJavascriptIndent().)
let ind = eval(b:jsx_js_indentexpr)
else
let ind = cindent(v:lnum)
" make sure `GetStyledIndent` and `GetJsxIndent` don't infinitely
" recurse by incrementing a counter variable, before evaluating the
" stored indent expression
if s:is_recursion == 0
let s:is_recursion = 1
let l:result = eval(b:js_ts_indent)
endif
" `is_recursion` being 0 at this point indicates, that
" `eval(b:js_ts_indent)` did itself evaluate it's stored indentexpr
" and thus it can be assumed, that the current line should be
" indented as JS
if s:is_recursion == 0
" use one of `GetJavascriptIndent` or `GetJsIndent` if existing
" fallback to cindent, if not
if exists('*GetJavascriptIndent')
let l:result = GetJavascriptIndent()
elseif exists('*GetJsIndent')
let l:result = GetJsIndent()
else
let l:result = cindent(v:lnum)
endif
endif
" reset `is_recursion` counter and return the indentation value
let s:is_recursion = 0
return l:result + l:offset
endif
return ind
" if all else fails indent according to C-syntax
return cindent(v:lnum)
endfu

207
after/indent/typescript.vim Normal file
View File

@@ -0,0 +1,207 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim indent file
"
" Language: typescript.jsx
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
" Depends: leafgarland/typescript-vim
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if exists('b:did_indent')
let s:did_indent = b:did_indent
unlet b:did_indent
endif
let s:keepcpo = &cpo
set cpo&vim
if exists('s:did_indent')
let b:did_indent = s:did_indent
endif
setlocal indentexpr=GetJsxIndent()
setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e,*<Return>,<>>,<<>,/
function! GetJsxIndent()
return jsx_pretty#indent#get(function('GetTypescriptIndent'))
endfunction
let &cpo = s:keepcpo
unlet s:keepcpo
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
finish
endif
" Vim syntax file
" Language: styled-components (js/ts)
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
" URL: https://github.com/styled-components/vim-styled-components
" initialize variable to check, if the indentation expression is run
" multiple times in a row, which indicates an infinite recursion
let s:is_recursion = 0
" store current indentexpr for later
let b:js_ts_indent=&indentexpr
" set indentexpr for this filetype (styled-components)
setlocal indentexpr=GetStyledIndent()
" add the following keys to trigger reindenting, when in insert mode
" - *; - Indent and insert on press of ';' key.
" - *<:> - Indent and insert on press of ':' key.
set indentkeys+=*;,*<:>,*<Return>
fu! s:GetSyntaxNames(lnum, cnum)
return map(synstack(a:lnum, a:cnum), 'synIDattr(v:val, "name")')
endfu
" re-implement SynSOL of vim-jsx
" TODO: add dependency to the readme and remove duplicate implementation
fu! s:SynSOL(lnum)
return s:GetSyntaxNames(a:lnum, 1)
endfu
" re-implement SynEOL of vim-jsx
" TODO: add dependency to the readme and remove duplicate implementation
fu! s:SynEOL(lnum, offset)
let l:lnum = prevnonblank(a:lnum)
let l:col = strlen(getline(l:lnum))
return s:GetSyntaxNames(l:lnum, l:col + a:offset)
endfu
"" Return whether the current line is a jsTemplateString
fu! s:IsStyledDefinition(lnum)
" iterate through all syntax items in the given line
for item in s:SynSOL(a:lnum)
" if syntax-item is a jsTemplateString return 1 - true
" `==#` is a match case comparison of the item
if item ==# 'styledDefinition'
return 1
endif
endfor
" fallback to 0 - false
return 0
endfu
"" Count occurences of `str` at the beginning of the given `lnum` line
fu! s:CountOccurencesInSOL(lnum, str)
let l:occurence = 0
" iterate through all items in the given line
for item in s:SynSOL(a:lnum)
" if the syntax-item equals the given str increment the counter
" `==?` is a case isensitive equal operation
if item ==? a:str
let l:occurence += 1
endif
endfor
" return the accumulated count of occurences
return l:occurence
endfu
"" Count occurences of `str` at the end of the given `lnum` line
fu! s:CountOccurencesInEOL(lnum, str, offset)
let l:occurence = 0
" iterate through all items in the given line
for item in s:SynEOL(a:lnum, a:offset)
" if the syntax-item equals the given str increment the counter
" `==?` is a case insensitive equal operation
if item == a:str
let l:occurence += 1
endif
endfor
" return the accumulated count of occurences
return l:occurence
endfu
"" Get the indentation of the current line
fu! GetStyledIndent()
if s:IsStyledDefinition(v:lnum)
let l:baseIndent = 0
" find last non-styled line
let l:cnum = v:lnum
while s:IsStyledDefinition(l:cnum)
let l:cnum -= 1
endwhile
" get indentation of the last non-styled line as base indentation
let l:baseIndent = indent(l:cnum)
" incrementally build indentation based on current indentation
" - one shiftwidth for the styled definition region
" - one shiftwidth per open nested definition region
let l:styledIndent = &sw
let l:styledIndent += min([
\ s:CountOccurencesInSOL(v:lnum, 'styledNestedRegion'),
\ s:CountOccurencesInEOL(v:lnum, 'styledNestedRegion', 0)
\ ]) * &sw
" decrease indentation by one shiftwidth, if the styled definition
" region ends on the current line
" - either directly via styled definition region, or
" - if the very last
if s:CountOccurencesInEOL(v:lnum, 'styledDefinition', 1) == 0
let l:styledIndent -= &sw
endif
" return the base indentation
" (for nested styles inside classes/objects/etc.) plus the actual
" indentation inside the styled definition region
return l:baseIndent + l:styledIndent
elseif len(b:js_ts_indent)
let l:result = 0
let l:offset = 0
" increase indentation by one shiftwidth, if the last line ended on a
" styledXmlRegion and this line does not continue with it
" this is a fix for an incorrectly indented xml prop after a
" glamor-styled styledXmlRegion
if s:CountOccurencesInEOL(v:lnum-1, 'styledXmlRegion', 0) == 1 &&
\ s:CountOccurencesInSOL(v:lnum, 'styledXmlRegion') == 0
let l:offset = &sw
endif
" make sure `GetStyledIndent` and `GetJsxIndent` don't infinitely
" recurse by incrementing a counter variable, before evaluating the
" stored indent expression
if s:is_recursion == 0
let s:is_recursion = 1
let l:result = eval(b:js_ts_indent)
endif
" `is_recursion` being 0 at this point indicates, that
" `eval(b:js_ts_indent)` did itself evaluate it's stored indentexpr
" and thus it can be assumed, that the current line should be
" indented as JS
if s:is_recursion == 0
" use one of `GetJavascriptIndent` or `GetJsIndent` if existing
" fallback to cindent, if not
if exists('*GetJavascriptIndent')
let l:result = GetJavascriptIndent()
elseif exists('*GetJsIndent')
let l:result = GetJsIndent()
else
let l:result = cindent(v:lnum)
endif
endif
" reset `is_recursion` counter and return the indentation value
let s:is_recursion = 0
return l:result + l:offset
endif
" if all else fails indent according to C-syntax
return cindent(v:lnum)
endfu

317
after/syntax/javascript.vim Normal file
View File

@@ -0,0 +1,317 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim syntax file
"
" Language: javascript.jsx
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:jsx_cpo = &cpo
set cpo&vim
syntax case match
if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
endif
if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
if hlexists("jsNoise") " pangloss/vim-javascript
syntax cluster jsExpression add=jsxRegion
elseif hlexists("javascriptOpSymbols") " othree/yajs.vim
" refine the javascript line comment
syntax region javascriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
syntax cluster javascriptValue add=jsxRegion
syntax cluster javascriptNoReserved add=jsxElement,jsxTag
" add support to arrow function which returns a tagged template string, e.g.
" () => html`<div></div>`
syntax cluster afterArrowFunc add=javascriptTagRef
else " build-in javascript syntax
" refine the javascript line comment
syntax region javaScriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
" add a javaScriptBlock group for build-in syntax
syntax region javaScriptBlockBuildIn
\ contained
\ matchgroup=javaScriptBraces
\ start="{"
\ end="}"
\ extend
\ contains=javaScriptBlockBuildIn,@javaScriptEmbededExpr,javaScript.*
\ fold
syntax cluster javaScriptEmbededExpr add=jsxRegion
" refine the template string syntax
syntax region javaScriptStringT start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=javaScriptSpecial,javaScriptEmbed,@htmlPreproc extend
syntax region javaScriptEmbed matchgroup=javaScriptEmbedBraces start=+\${+ end=+}+ contained contains=@javaScriptEmbededExpr,javaScript.*
endif
" because this is autoloaded, when developing you're going to need to source
" the autoload/jsx_pretty/*.vim file manually, or restart vim
call jsx_pretty#syntax#highlight()
let b:current_syntax = 'javascript.jsx'
let &cpo = s:jsx_cpo
unlet s:jsx_cpo
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
finish
endif
" Vim syntax file
" Language: styled-components (js/ts)
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
" URL: https://github.com/styled-components/vim-styled-components
if exists("b:current_syntax")
let s:current_syntax=b:current_syntax
unlet b:current_syntax
endif
" fix for "-" before cssPositioningProp
" - needs to be above CSS include to not match cssVendor definitions
syn region cssCustomPositioningPrefix contained
\ start='-' end='\%(\s\{-}:\)\@='
\ contains=cssPositioningProp
" introduce CSS cluster from built-in (or single third party syntax file)
syn include @CSS syntax/css.vim
" try to include CSS3 definitions from multiple files
" this is only possible on vim version above 7
if v:version >= 700
try
syn include @CSS3 syntax/css/*.vim
catch
endtry
endif
" TODO: include react-native keywords
" define custom cssAttrRegion
" - add ",", "`" and "{" to the end characters
" - add "cssPseudoClassId" to it's containing elements
" this will incorrectly highlight pseudo elements incorrectly used as
" attributes but correctly highlight actual attributes
syn region cssCustomAttrRegion contained
\ start=":" end="\ze\%(;\|)\|{\|}\|`\)"
\ contains=css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,
\ cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,
\ cssError,cssAttrComma,cssNoise,cssPseudoClassId,
\ jsTemplateExpression,
\ typescriptInterpolation,typescriptTemplateSubstitution
syn region cssCustomAttrRegion contained
\ start="transition\s*:" end="\ze\%(;\|)\|{\|}\|`\)"
\ contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,
\ cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,
\ cssVendor,cssError,cssAttrComma,cssNoise,cssPseudoClassId,
\ jsTemplateExpression,
\ typescriptInterpolation,typescriptTemplateSubstitution
" define custom css elements to not utilize cssDefinition
syn region cssCustomMediaBlock contained fold transparent matchgroup=cssBraces
\ start="{" end="}"
\ contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,
\ cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,
\ cssUnicodeEscape,cssVendor,cssTagName,cssClassName,
\ cssIdentifier,cssPseudoClass,cssSelectorOp,cssSelectorOp2,
\ cssAttributeSelector
syn region cssCustomPageWrap contained transparent matchgroup=cssBraces
\ start="{" end="}"
\ contains=cssPageMargin,cssPageProp,cssCustomAttrRegion,css.*Prop,
\ cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,
\ cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,
\ cssHacks
syn match cssCustomPageMargin contained skipwhite skipnl
\ "@\%(\%(top\|left\|right\|bottom\)-\%(left\|center\|right\|middle\|bottom\)\)\%(-corner\)\="
syn match cssCustomKeyFrameSelector "\%(\d*%\|\<from\>\|\<to\>\)" contained
\ skipwhite skipnl
" define css include customly to overwrite nextgroup
syn region cssInclude start="@media\>" end="\ze{" skipwhite skipnl
\ contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,
\ cssMediaMediaAttr,cssVencor,cssMediaType,cssIncludeKeyword,
\ cssMediaComma,cssComment
\ nextgroup=cssCustomMediaBlock
" define all non-contained css definitions
syn cluster CSSTop
\ contains=cssTagName,cssSelectorOp,cssAttributeSelector,cssClassName,
\ cssBraces,cssIdentifier,cssIncludeKeyword,cssPage,cssKeyFrame,
\ cssFontDescriptor,cssAttrComma,cssPseudoClass,cssUnicodeEscape
" custom highlights for styled components
" - "&" inside top level
" - cssTagName inside of jsStrings inside of styledPrefix regions
" TODO: override highlighting of cssTagName with more subtle one
syn match styledAmpersand contained "&"
syn region styledTagNameString matchgroup=jsString contained
\ start=+'+ end=+'+ skip=+\\\%(\'\|$\)+
\ contains=cssTagName
syn region styledTagNameString matchgroup=jsString contained
\ start=+"+ end=+"+ skip=+\\\%(\"\|$\)+
\ contains=cssTagName
syn region styledTagNameString matchgroup=jsString contained
\ start=+`+ end=+`+ skip=+\\\%(\`\|$\)+
\ contains=cssTagName
" define custom API sections that trigger the styledDefinition highlighting
syn match styledPrefix "\<styled\>\.\k\+"
\ transparent fold
\ nextgroup=styledDefinition
\ contains=cssTagName,javascriptTagRef
\ containedin=jsFuncBlock
syn match styledPrefix "\.\<attrs\>\s*(\%(\n\|\s\|.\)\{-})"
\ transparent fold extend
\ nextgroup=styledDefinition
\ contains=jsObject,jsParen
\ containedin=jsFuncBlock
syn match styledPrefix "\.\<extend\>"
\ transparent fold
\ nextgroup=styledDefinition
\ containedin=jsFuncBlock
" define custom API section, that contains typescript annotations
" this is structurally similar to `jsFuncCall`, but allows type
" annotations (delimited by brackets (e.g. "<>")) between `styled` and
" the function call parenthesis
syn match styledTypescriptPrefix
\ "\<styled\><\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>(\%('\k\+'\|\"\k\+\"\|\k\+\))"
\ transparent fold
\ nextgroup=styledDefinition
\ contains=cssTagName,
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
syn match styledTypescriptPrefix
\ "\<styled\>\%((\%('\k\+'\|\"\k\+\"\|\k\+\))\|\.\k\+\)<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
\ transparent fold
\ nextgroup=styledDefinition
\ contains=cssTagName,
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
syn match styledTypescriptPrefix "\.\<attrs\>\s*(\%(\n\|\s\|.\)\{-})<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
\ transparent fold extend
\ nextgroup=styledDefinition
\ contains=cssTagName,
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
syn match styledTypescriptPrefix "\.\<extend\><\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
\ transparent fold extend
\ nextgroup=styledDefinition
\ contains=cssTagName,
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
" define emotion css prop
" to bypass problems from top-level defined xml/js definitions, this
" plugin re-defines keywords/noise for highlighting inside of the custom
" xmlAttrib definition
syn keyword styledXmlRegionKeyword css contained
syn match styledXmlRegionNoise "\%(=\|{\|}\)" contained
" only include styledDefinitions inside of xmlAttribs, that are wrapped
" in `css={}` regions, `keepend` is necessary to correctly break on the
" higher-level xmlAttrib region end
syn region styledXmlRegion
\ start="\<css\>={" end="}"
\ keepend fold
\ containedin=xmlAttrib
\ contains=styledXmlRegionKeyword,styledXmlRegionNoise,styledDefinition
" define nested region for indenting
syn region styledNestedRegion contained transparent
\ matchgroup=cssBraces
\ start="{" end="}"
" re-define cssError to be highlighted correctly in styledNestedRegion
syn match cssError contained "{@<>"
" extend javascript matches to trigger styledDefinition highlighting
syn match jsTaggedTemplate extend
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
\ nextgroup=styledDefinition
syn match jsFuncCall "\<styled\>\s*(.\+)" transparent
\ nextgroup=styledDefinition
syn match jsFuncCall "\<styled\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))"
\ contains=styledTagNameString
\ nextgroup=styledDefinition
syn match jsFuncCall "\<styled\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
\ contains=typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
\ nextgroup=styledDefinition
syn match jsFuncCall "\.\<withComponent\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))"
\ contains=styledTagNameString
syn match jsFuncCall "\<dc\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))\%((\)\@="
\ contains=styledTagNameString
\ nextgroup=styledDefinitionArgument
" inject css highlighting into custom jsTemplateString region
" - use `extend` to not end all nested jsTemplateExpression on the first
" closing one
syn region styledDefinition contained transparent fold extend
\ start="`" end="`" skip="\\\%(`\|$\)"
\ contains=@CSSTop,
\ css.*Prop,cssValue.*,cssColor,cssUrl,cssImportant,cssError,
\ cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,
\ cssHacks,
\ cssCustom.*,
\ jsComment,jsTemplateExpression,
\ typescriptInterpolation,typescriptTemplateSubstitution,
\ styledAmpersand,styledNestedRegion
syn region styledDefinitionArgument contained transparent start=+(+ end=+)+
\ contains=styledDefinition
syn cluster typescriptValue add=styledPrefix,jsFuncCall,styledTypescriptPrefix
""" yajs specific extensions
" define template tag keywords, that trigger styledDefinitions again to be
" contained in and also do contain the `javascriptTagRef` region
syn match javascriptTagRefStyledPrefix transparent fold
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
\ containedin=javascriptTagRef
\ contains=javascriptTagRef
\ nextgroup=styledDefinition
" extend the yajs clusters to include the previously and extraneously defined
" styled-related matches
syn cluster javascriptExpression
\ add=styledPrefix,jsFuncCall,javascriptTagRefStyledPrefix
syn cluster javascriptAfterIdentifier add=styledPrefix,jsFuncCall
""" yats specific extensions
" extend typescriptIdentifierName to allow styledDefinitions in their
" tagged templates
syn match typescriptIdentifierName extend
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
\ nextgroup=styledDefinition
" color the custom highlight elements
hi def link cssCustomKeyFrameSelector Constant
hi def link cssCustomPositioningPrefix StorageClass
hi def link styledAmpersand Special
hi def link styledXmlRegionKeyword Type
hi def link styledXmlRegionNoise Noise
hi def link styledXmlRegion String
if exists("s:current_syntax")
let b:current_syntax=s:current_syntax
endif

View File

@@ -1,83 +0,0 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim syntax file
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
" Depends: pangloss/vim-javascript
"
" CREDITS: Inspired by Facebook.
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Prologue; load in XML syntax.
if exists('b:current_syntax')
let s:current_syntax=b:current_syntax
unlet b:current_syntax
endif
syn include @XMLSyntax syntax/xml.vim
if exists('s:current_syntax')
let b:current_syntax=s:current_syntax
endif
" Officially, vim-jsx depends on the pangloss/vim-javascript syntax package
" (and is tested against it exclusively). However, in practice, we make some
" effort towards compatibility with other packages.
"
" These are the plugin-to-syntax-element correspondences:
"
" - pangloss/vim-javascript: jsBlock, jsExpression
" - jelera/vim-javascript-syntax: javascriptBlock
" - othree/yajs.vim: javascriptNoReserved
" JSX attributes should color as JS. Note the trivial end pattern; we let
" jsBlock take care of ending the region.
syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
" JSX comments inside XML tag should color as comment. Note the trivial end pattern; we let
" jsComment take care of ending the region.
syn region xmlString contained start=+//+ end=++ contains=jsComment
" JSX child blocks behave just like JSX attributes, except that (a) they are
" syntactically distinct, and (b) they need the syn-extend argument, or else
" nested XML end-tag patterns may end the outer jsxRegion.
syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
\ extend
" Highlight JSX regions as XML; recursively match.
"
" Note that we prohibit JSX tags from having a < or word character immediately
" preceding it, to avoid conflicts with, respectively, the left shift operator
" and generic Flow type annotations (http://flowtype.org/).
syn region jsxRegion
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z_][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+
\ skip=+<!--\_.\{-}-->+
\ end=+</\z1\_\s\{-}>+
\ end=+/>+
\ keepend
\ extend
" Shorthand fragment support
"
" Note that since the main jsxRegion contains @XMLSyntax, we cannot simply
" adjust the regex above since @XMLSyntax will highlight the opening `<` as an
" XMLError. Instead we create a new group with the same name that does not
" include @XMLSyntax and instead uses matchgroup to get the same highlighting.
syn region jsxRegion
\ contains=@Spell,jsxRegion,jsxChild,jsBlock,javascriptBlock
\ matchgroup=xmlTag
\ start=/<>/
\ end=/<\/>/
\ keepend
\ extend
" Add jsxRegion to the lowest-level JS syntax cluster.
syn cluster jsExpression add=jsxRegion
" Allow jsxRegion to contain reserved words.
syn cluster javascriptNoReserved add=jsxRegion

303
after/syntax/typescript.vim Normal file
View File

@@ -0,0 +1,303 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim syntax file
"
" Language: javascript.jsx
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
" Depends: leafgarland/typescript-vim
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:jsx_cpo = &cpo
set cpo&vim
syntax case match
if exists('b:current_syntax')
let s:current_syntax = b:current_syntax
unlet b:current_syntax
endif
if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
" refine the typescript line comment
syntax region typescriptLineComment start=+//+ end=/$/ contains=@Spell,typescriptCommentTodo,typescriptRef extend keepend
" add a typescriptBlock group for typescript
syntax region typescriptBlock
\ contained
\ matchgroup=typescriptBraces
\ start="{"
\ end="}"
\ extend
\ contains=@typescriptAll,@typescriptExpression,typescriptBlock
\ fold
" because this is autoloaded, when developing you're going to need to source
" the autoload/jsx_pretty/*.vim file manually, or restart vim
call jsx_pretty#syntax#highlight()
syntax cluster typescriptExpression add=jsxRegion
let b:current_syntax = 'typescript.tsx'
let &cpo = s:jsx_cpo
unlet s:jsx_cpo
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
finish
endif
" Vim syntax file
" Language: styled-components (js/ts)
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
" URL: https://github.com/styled-components/vim-styled-components
if exists("b:current_syntax")
let s:current_syntax=b:current_syntax
unlet b:current_syntax
endif
" fix for "-" before cssPositioningProp
" - needs to be above CSS include to not match cssVendor definitions
syn region cssCustomPositioningPrefix contained
\ start='-' end='\%(\s\{-}:\)\@='
\ contains=cssPositioningProp
" introduce CSS cluster from built-in (or single third party syntax file)
syn include @CSS syntax/css.vim
" try to include CSS3 definitions from multiple files
" this is only possible on vim version above 7
if v:version >= 700
try
syn include @CSS3 syntax/css/*.vim
catch
endtry
endif
" TODO: include react-native keywords
" define custom cssAttrRegion
" - add ",", "`" and "{" to the end characters
" - add "cssPseudoClassId" to it's containing elements
" this will incorrectly highlight pseudo elements incorrectly used as
" attributes but correctly highlight actual attributes
syn region cssCustomAttrRegion contained
\ start=":" end="\ze\%(;\|)\|{\|}\|`\)"
\ contains=css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,
\ cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,
\ cssError,cssAttrComma,cssNoise,cssPseudoClassId,
\ jsTemplateExpression,
\ typescriptInterpolation,typescriptTemplateSubstitution
syn region cssCustomAttrRegion contained
\ start="transition\s*:" end="\ze\%(;\|)\|{\|}\|`\)"
\ contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,
\ cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,
\ cssVendor,cssError,cssAttrComma,cssNoise,cssPseudoClassId,
\ jsTemplateExpression,
\ typescriptInterpolation,typescriptTemplateSubstitution
" define custom css elements to not utilize cssDefinition
syn region cssCustomMediaBlock contained fold transparent matchgroup=cssBraces
\ start="{" end="}"
\ contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,
\ cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,
\ cssUnicodeEscape,cssVendor,cssTagName,cssClassName,
\ cssIdentifier,cssPseudoClass,cssSelectorOp,cssSelectorOp2,
\ cssAttributeSelector
syn region cssCustomPageWrap contained transparent matchgroup=cssBraces
\ start="{" end="}"
\ contains=cssPageMargin,cssPageProp,cssCustomAttrRegion,css.*Prop,
\ cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,
\ cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,
\ cssHacks
syn match cssCustomPageMargin contained skipwhite skipnl
\ "@\%(\%(top\|left\|right\|bottom\)-\%(left\|center\|right\|middle\|bottom\)\)\%(-corner\)\="
syn match cssCustomKeyFrameSelector "\%(\d*%\|\<from\>\|\<to\>\)" contained
\ skipwhite skipnl
" define css include customly to overwrite nextgroup
syn region cssInclude start="@media\>" end="\ze{" skipwhite skipnl
\ contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,
\ cssMediaMediaAttr,cssVencor,cssMediaType,cssIncludeKeyword,
\ cssMediaComma,cssComment
\ nextgroup=cssCustomMediaBlock
" define all non-contained css definitions
syn cluster CSSTop
\ contains=cssTagName,cssSelectorOp,cssAttributeSelector,cssClassName,
\ cssBraces,cssIdentifier,cssIncludeKeyword,cssPage,cssKeyFrame,
\ cssFontDescriptor,cssAttrComma,cssPseudoClass,cssUnicodeEscape
" custom highlights for styled components
" - "&" inside top level
" - cssTagName inside of jsStrings inside of styledPrefix regions
" TODO: override highlighting of cssTagName with more subtle one
syn match styledAmpersand contained "&"
syn region styledTagNameString matchgroup=jsString contained
\ start=+'+ end=+'+ skip=+\\\%(\'\|$\)+
\ contains=cssTagName
syn region styledTagNameString matchgroup=jsString contained
\ start=+"+ end=+"+ skip=+\\\%(\"\|$\)+
\ contains=cssTagName
syn region styledTagNameString matchgroup=jsString contained
\ start=+`+ end=+`+ skip=+\\\%(\`\|$\)+
\ contains=cssTagName
" define custom API sections that trigger the styledDefinition highlighting
syn match styledPrefix "\<styled\>\.\k\+"
\ transparent fold
\ nextgroup=styledDefinition
\ contains=cssTagName,javascriptTagRef
\ containedin=jsFuncBlock
syn match styledPrefix "\.\<attrs\>\s*(\%(\n\|\s\|.\)\{-})"
\ transparent fold extend
\ nextgroup=styledDefinition
\ contains=jsObject,jsParen
\ containedin=jsFuncBlock
syn match styledPrefix "\.\<extend\>"
\ transparent fold
\ nextgroup=styledDefinition
\ containedin=jsFuncBlock
" define custom API section, that contains typescript annotations
" this is structurally similar to `jsFuncCall`, but allows type
" annotations (delimited by brackets (e.g. "<>")) between `styled` and
" the function call parenthesis
syn match styledTypescriptPrefix
\ "\<styled\><\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>(\%('\k\+'\|\"\k\+\"\|\k\+\))"
\ transparent fold
\ nextgroup=styledDefinition
\ contains=cssTagName,
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
syn match styledTypescriptPrefix
\ "\<styled\>\%((\%('\k\+'\|\"\k\+\"\|\k\+\))\|\.\k\+\)<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
\ transparent fold
\ nextgroup=styledDefinition
\ contains=cssTagName,
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
syn match styledTypescriptPrefix "\.\<attrs\>\s*(\%(\n\|\s\|.\)\{-})<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
\ transparent fold extend
\ nextgroup=styledDefinition
\ contains=cssTagName,
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
syn match styledTypescriptPrefix "\.\<extend\><\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
\ transparent fold extend
\ nextgroup=styledDefinition
\ contains=cssTagName,
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
" define emotion css prop
" to bypass problems from top-level defined xml/js definitions, this
" plugin re-defines keywords/noise for highlighting inside of the custom
" xmlAttrib definition
syn keyword styledXmlRegionKeyword css contained
syn match styledXmlRegionNoise "\%(=\|{\|}\)" contained
" only include styledDefinitions inside of xmlAttribs, that are wrapped
" in `css={}` regions, `keepend` is necessary to correctly break on the
" higher-level xmlAttrib region end
syn region styledXmlRegion
\ start="\<css\>={" end="}"
\ keepend fold
\ containedin=xmlAttrib
\ contains=styledXmlRegionKeyword,styledXmlRegionNoise,styledDefinition
" define nested region for indenting
syn region styledNestedRegion contained transparent
\ matchgroup=cssBraces
\ start="{" end="}"
" re-define cssError to be highlighted correctly in styledNestedRegion
syn match cssError contained "{@<>"
" extend javascript matches to trigger styledDefinition highlighting
syn match jsTaggedTemplate extend
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
\ nextgroup=styledDefinition
syn match jsFuncCall "\<styled\>\s*(.\+)" transparent
\ nextgroup=styledDefinition
syn match jsFuncCall "\<styled\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))"
\ contains=styledTagNameString
\ nextgroup=styledDefinition
syn match jsFuncCall "\<styled\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
\ contains=typescriptBraces,typescriptOpSymbols,typescriptEndColons,
\ typescriptParens,typescriptStringS,@typescriptType,
\ typescriptType,
\ styledTagNameString
\ nextgroup=styledDefinition
syn match jsFuncCall "\.\<withComponent\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))"
\ contains=styledTagNameString
syn match jsFuncCall "\<dc\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))\%((\)\@="
\ contains=styledTagNameString
\ nextgroup=styledDefinitionArgument
" inject css highlighting into custom jsTemplateString region
" - use `extend` to not end all nested jsTemplateExpression on the first
" closing one
syn region styledDefinition contained transparent fold extend
\ start="`" end="`" skip="\\\%(`\|$\)"
\ contains=@CSSTop,
\ css.*Prop,cssValue.*,cssColor,cssUrl,cssImportant,cssError,
\ cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,
\ cssHacks,
\ cssCustom.*,
\ jsComment,jsTemplateExpression,
\ typescriptInterpolation,typescriptTemplateSubstitution,
\ styledAmpersand,styledNestedRegion
syn region styledDefinitionArgument contained transparent start=+(+ end=+)+
\ contains=styledDefinition
syn cluster typescriptValue add=styledPrefix,jsFuncCall,styledTypescriptPrefix
""" yajs specific extensions
" define template tag keywords, that trigger styledDefinitions again to be
" contained in and also do contain the `javascriptTagRef` region
syn match javascriptTagRefStyledPrefix transparent fold
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
\ containedin=javascriptTagRef
\ contains=javascriptTagRef
\ nextgroup=styledDefinition
" extend the yajs clusters to include the previously and extraneously defined
" styled-related matches
syn cluster javascriptExpression
\ add=styledPrefix,jsFuncCall,javascriptTagRefStyledPrefix
syn cluster javascriptAfterIdentifier add=styledPrefix,jsFuncCall
""" yats specific extensions
" extend typescriptIdentifierName to allow styledDefinitions in their
" tagged templates
syn match typescriptIdentifierName extend
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
\ nextgroup=styledDefinition
" color the custom highlight elements
hi def link cssCustomKeyFrameSelector Constant
hi def link cssCustomPositioningPrefix StorageClass
hi def link styledAmpersand Special
hi def link styledXmlRegionKeyword Type
hi def link styledXmlRegionNoise Noise
hi def link styledXmlRegion String
if exists("s:current_syntax")
let b:current_syntax=s:current_syntax
endif

File diff suppressed because it is too large Load Diff

View File

@@ -9,22 +9,35 @@ function! s:error(text) abort
echohl None
endfunction
function! s:cexpr(errorformat, joined_lines) abort
let temp_errorfomat = &errorformat
try
let &errorformat = a:errorformat
cexpr a:joined_lines
copen
finally
let &errorformat = temp_errorfomat
endtry
function! s:cexpr(errorformat, lines, reason) abort
call setqflist([], ' ', {
\ 'lines': a:lines,
\ 'efm': a:errorformat,
\ 'context': {'reason': a:reason},
\})
copen
endfunction
" If the quickfix list has a context matching [reason], clear and close it.
function! s:clearQfList(reason) abort
let context = get(getqflist({'context': 1}), 'context', {})
if type(context) == v:t_dict &&
\ has_key(context, 'reason') &&
\ context.reason == a:reason
call setqflist([], 'r')
cclose
endif
endfunction
function! dart#fmt(q_args) abort
if executable('dartfmt')
let buffer_content = join(getline(1, '$'), "\n")
let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content)
if buffer_content ==# joined_lines[:-2] | return | endif
let args = '--stdin-name '.expand('%').' '.a:q_args
let joined_lines = system(printf('dartfmt %s', args), buffer_content)
if buffer_content ==# joined_lines[:-2]
call s:clearQfList('dartfmt')
return
endif
if 0 == v:shell_error
let win_view = winsaveview()
let lines = split(joined_lines, "\n")
@@ -33,12 +46,11 @@ function! dart#fmt(q_args) abort
silent keepjumps execute string(len(lines)+1).',$ delete'
endif
call winrestview(win_view)
call s:clearQfList('dartfmt')
else
let errors = split(joined_lines, "\n")[2:]
let file_path = expand('%')
call map(errors, 'file_path.":".v:val')
let error_format = '%A%f:line %l\, column %c of stdin: %m,%C%.%#'
call s:cexpr(error_format, join(errors, "\n"))
let error_format = '%Aline %l\, column %c of %f: %m,%C%.%#'
call s:cexpr(error_format, errors, 'dartfmt')
endif
else
call s:error('cannot execute binary file: dartfmt')
@@ -49,8 +61,9 @@ function! dart#analyzer(q_args) abort
if executable('dartanalyzer')
let path = expand('%:p:gs:\:/:')
if filereadable(path)
let joined_lines = system(printf('dartanalyzer %s %s', a:q_args, shellescape(path)))
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
let command = printf('dartanalyzer %s %s', a:q_args, shellescape(path))
let lines = systemlist(command)
call s:cexpr('%m (%f\, line %l\, col %c)', lines, 'dartanalyzer')
else
call s:error(printf('cannot read a file: "%s"', path))
endif
@@ -63,8 +76,9 @@ function! dart#tojs(q_args) abort
if executable('dart2js')
let path = expand('%:p:gs:\:/:')
if filereadable(path)
let joined_lines = system(printf('dart2js %s %s', a:q_args, shellescape(path)))
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
let command = printf('dart2js %s %s', a:q_args, shellescape(path))
let lines = systemlist(command)
call s:cexpr('%m (%f\, line %l\, col %c)', lines, 'dart2js')
else
call s:error(printf('cannot read a file: "%s"', path))
endif

View File

@@ -18,6 +18,10 @@ function! go#config#VersionWarning() abort
return get(g:, 'go_version_warning', 1)
endfunction
function! go#config#NullModuleWarning() abort
return get(g:, 'go_null_module_warning', 1)
endfunction
function! go#config#BuildTags() abort
return get(g:, 'go_build_tags', '')
endfunction
@@ -118,7 +122,7 @@ function! go#config#ListAutoclose() abort
endfunction
function! go#config#InfoMode() abort
return get(g:, 'go_info_mode', 'gocode')
return get(g:, 'go_info_mode', 'gopls')
endfunction
function! go#config#GuruScope() abort
@@ -183,7 +187,7 @@ function! go#config#DefReuseBuffer() abort
endfunction
function! go#config#DefMode() abort
return get(g:, 'go_def_mode', 'guru')
return get(g:, 'go_def_mode', 'gopls')
endfunction
function! go#config#DeclsIncludes() abort
@@ -470,6 +474,10 @@ function! go#config#EchoGoInfo() abort
return get(g:, "go_echo_go_info", 1)
endfunction
function! go#config#CodeCompletionEnabled() abort
return get(g:, "go_code_completion_enabled", 1)
endfunction
" Set the default value. A value of "1" is a shortcut for this, for
" compatibility reasons.
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1

View File

@@ -0,0 +1,41 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
function! jsx_pretty#comment#update_commentstring(original)
let syn_current = s:syn_name(line('.'), col('.'))
let syn_start = s:syn_name(line('.'), 1)
let save_cursor = getcurpos()
if syn_start =~ '^jsx'
let line = getline(".")
let start = len(matchstr(line, '^\s*'))
let syn_name = s:syn_name(line('.'), start + 1)
if line =~ '^\s*//'
let &l:commentstring = '// %s'
elseif s:syn_contains(line('.'), col('.'), 'jsxTaggedRegion')
let &l:commentstring = '<!-- %s -->'
elseif syn_name =~ '^jsxAttrib'
let &l:commentstring = '// %s'
else
let &l:commentstring = '{/* %s */}'
endif
else
let &l:commentstring = a:original
endif
" Restore the cursor position
call setpos('.', save_cursor)
endfunction
function! s:syn_name(lnum, cnum)
let syn_id = get(synstack(a:lnum, a:cnum), -1)
return synIDattr(syn_id, "name")
endfunction
function! s:syn_contains(lnum, cnum, syn_name)
let stack = synstack(a:lnum, a:cnum)
let syn_names = map(stack, 'synIDattr(v:val, "name")')
return index(syn_names, a:syn_name) >= 0
endfunction

View File

@@ -0,0 +1,204 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
if exists('*shiftwidth')
function! s:sw()
return shiftwidth()
endfunction
else
function! s:sw()
return &sw
endfunction
endif
" Get the syntax group of start of line
function! s:syn_sol(lnum)
let line = getline(a:lnum)
let sol = matchstr(line, '^\s*')
return map(synstack(a:lnum, len(sol) + 1), 'synIDattr(v:val, "name")')
endfunction
" Get the syntax group of end of line
function! s:syn_eol(lnum)
let lnum = prevnonblank(a:lnum)
let col = strlen(getline(lnum))
return map(synstack(lnum, col), 'synIDattr(v:val, "name")')
endfunction
function! s:prev_indent(lnum)
let lnum = prevnonblank(a:lnum - 1)
return indent(lnum)
endfunction
function! s:prev_line(lnum)
let lnum = prevnonblank(a:lnum - 1)
return substitute(getline(lnum), '^\s*\|\s*$', '', 'g')
endfunction
function! s:syn_attr_jsx(synattr)
return a:synattr =~ "^jsx"
endfunction
function! s:syn_xmlish(syns)
return s:syn_attr_jsx(get(a:syns, -1))
endfunction
function! s:syn_jsx_element(syns)
return get(a:syns, -1) =~ 'jsxElement'
endfunction
function! s:syn_js_comment(syns)
return get(a:syns, -1) =~ 'Comment$'
endfunction
function! s:syn_jsx_escapejs(syns)
return get(a:syns, -1) =~ '\(\(js\(Template\)\?\|javaScript\(Embed\)\?\|typescript\)Braces\|javascriptTemplateSB\|typescriptInterpolationDelimiter\)' &&
\ (get(a:syns, -2) =~ 'jsxEscapeJs' ||
\ get(a:syns, -3) =~ 'jsxEscapeJs')
endfunction
function! s:syn_jsx_attrib(syns)
return len(filter(copy(a:syns), 'v:val =~ "jsxAttrib"'))
endfunction
let s:start_tag = '<\s*\([-:_\.\$0-9A-Za-z]\+\|>\)'
" match `/end_tag>` and `//>`
let s:end_tag = '/\%(\s*[-:_\.\$0-9A-Za-z]*\s*\|/\)>'
let s:opfirst = '^' . get(g:,'javascript_opfirst',
\ '\C\%([<>=,.?^%|/&]\|\([-:+]\)\1\@!\|\*\+\|!=\|in\%(stanceof\)\=\>\)')
function! jsx_pretty#indent#get(js_indent)
let lnum = v:lnum
let line = substitute(getline(lnum), '^\s*\|\s*$', '', 'g')
let current_syn = s:syn_sol(lnum)
let current_syn_eol = s:syn_eol(lnum)
let prev_syn_sol = s:syn_sol(lnum - 1)
let prev_syn_eol = s:syn_eol(lnum - 1)
let prev_line = s:prev_line(lnum)
let prev_ind = s:prev_indent(lnum)
if s:syn_xmlish(current_syn)
" {
" <div></div>
" ##} <--
if s:syn_jsx_element(current_syn) && line =~ '}$'
let pair_line = searchpair('{', '', '}', 'b')
return indent(pair_line)
elseif line =~ '^-->$'
if prev_line =~ '^<!--'
return prev_ind
else
return prev_ind - s:sw()
endif
elseif prev_line =~ '-->$'
return prev_ind
" close tag </tag> or /> including </>
elseif prev_line =~ s:end_tag . '$'
if line =~ '^<\s*' . s:end_tag
return prev_ind - s:sw()
elseif s:syn_jsx_attrib(prev_syn_sol)
return prev_ind - s:sw()
else
return prev_ind
endif
elseif line =~ '^\(>\|/\s*>\)'
if prev_line =~ '^<'
return prev_ind
else
return prev_ind - s:sw()
endif
elseif prev_line =~ '^\(<\|>\)' &&
\ (s:syn_xmlish(prev_syn_eol) || s:syn_js_comment(prev_syn_eol))
if line =~ '^<\s*' . s:end_tag
return prev_ind
else
return prev_ind + s:sw()
endif
elseif line =~ '^<\s*' . s:end_tag
if !s:syn_xmlish(prev_syn_sol)
if s:syn_jsx_escapejs(prev_syn_eol)
\ || s:syn_jsx_escapejs(prev_syn_sol)
return prev_ind - s:sw()
else
return prev_ind
endif
else
return prev_ind - s:sw()
endif
elseif !s:syn_xmlish(prev_syn_eol)
if prev_line =~ '\(&&\|||\|=>\|[([{]\|`\)$'
" <div>
" {
" }
" </div>
if line =~ '^[)\]}]'
return prev_ind
else
return prev_ind + s:sw()
endif
else
return prev_ind
endif
elseif !s:syn_xmlish(prev_syn_sol)
if prev_line =~ '^\<\(return\|default\|await\|yield\)'
if line !~ '^/\s*>' || line !~ '^<\s*' . s:end_tag
return prev_ind + s:sw()
else
return prev_ind
endif
else
return prev_ind
endif
else
return prev_ind
endif
elseif s:syn_jsx_escapejs(current_syn)
if line =~ '^}'
let char = getline('.')[col('.') - 1]
" When pressing enter after the }, keep the indent
if char != '}' && search('}', 'b', lnum)
return indent(lnum)
else
let pair_line = searchpair('{', '', '}', 'bW')
return indent(pair_line)
endif
elseif line =~ '^{' || line =~ '^\${'
if s:syn_jsx_escapejs(prev_syn_eol)
\ || s:syn_jsx_attrib(prev_syn_sol)
return prev_ind
elseif s:syn_xmlish(prev_syn_eol) && (prev_line =~ s:end_tag || prev_line =~ '-->$')
return prev_ind
else
return prev_ind + s:sw()
endif
endif
elseif s:syn_jsx_escapejs(current_syn_eol)
let pair_line = searchpair('{', '', '}', 'bW')
return indent(pair_line)
elseif line =~ '^/[/*]' " js comment in jsx tag
if get(prev_syn_sol, -1) =~ 'Punct'
return prev_ind + s:sw()
elseif synIDattr(synID(lnum - 1, 1, 1), 'name') =~ 'jsxTag'
return prev_ind
else
return a:js_indent()
endif
else
let ind = a:js_indent()
" If current syntax is not a jsx syntax group
if s:syn_xmlish(prev_syn_eol) && line !~ '^[)\]}]'
let sol = matchstr(line, s:opfirst)
if sol is ''
" Fix javascript continue indent
return ind - s:sw()
else
return ind
endif
endif
return ind
endif
endfunction

View File

@@ -0,0 +1,218 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
finish
endif
function! jsx_pretty#syntax#highlight()
let s:highlight_close_tag = get(g:, 'vim_jsx_pretty_highlight_close_tag', 0)
" <tag id="sample">
" ~~~~~~~~~~~~~~~~~
" and self close tag
" <tag id="sample" />
" ~~~~~~~~~~~~~~~~~~~
syntax region jsxTag
\ start=+<+
\ matchgroup=jsxOpenPunct
\ end=+>+
\ matchgroup=NONE
\ end=+\(/\_s*>\)\@=+
\ contained
\ contains=jsxOpenTag,jsxEscapeJs,jsxAttrib,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment,jsxSpreadOperator
\ keepend
\ extend
" <tag></tag>
" ~~~~~~~~~~~
" and fragment
" <></>
" ~~~~~
" and self close tag
" <tag />
" ~~~~~~~
syntax region jsxElement
\ start=+<\_s*\(>\|\${\|\z(\<[-:_\.\$0-9A-Za-z]\+\>\)\)+
\ end=+/\_s*>+
\ end=+<\_s*/\_s*\z1\_s*>+
\ contains=jsxElement,jsxEscapeJs,jsxTag,jsxComment,jsxCloseString,jsxCloseTag,@Spell
\ keepend
\ extend
\ contained
\ fold
" detect jsx region
syntax region jsxRegion
\ start=+\(\(\_[([,?:=+\-*/<>{}]\|&&\|||\|=>\|\<return\|\<default\|\<await\|\<yield\)\_s*\)\@<=<\_s*\(>\|\z(\(script\)\@!\<[_\$A-Za-z][-:_\.\$0-9A-Za-z]*\>\)\(\_s*\([-+*)\]}&|?]\|/\([/*]\|\_s*>\)\@!\)\)\@!\)+
\ end=++
\ contains=jsxElement
" <tag key={this.props.key}>
" ~~~~~~~~~~~~~~~~
syntax region jsxEscapeJs
\ start=+{+
\ end=++
\ extend
\ contained
\ contains=jsBlock,javascriptBlock,javaScriptBlockBuildIn,typescriptBlock
" <tag key={this.props.key}>
" ~~~~
" and fragment start tag
" <>
" ~~
exe 'syntax region jsxOpenTag
\ matchgroup=jsxOpenPunct
\ start=+<+
\ end=+>+
\ matchgroup=NONE
\ end=+\>+
\ contained
\ contains=jsxTagName
\ nextgroup=jsxAttrib
\ skipwhite
\ skipempty ' .(s:highlight_close_tag ? 'transparent' : '')
" <foo.bar>
" ~
syntax match jsxDot +\.+ contained display
" <foo:bar>
" ~
syntax match jsxNamespace +:+ contained display
" <tag id="sample">
" ~
syntax match jsxEqual +=+ contained display nextgroup=jsxString,jsxEscapeJs,jsxRegion skipwhite
" <tag />
" ~~
syntax match jsxCloseString +/\_s*>+ contained
" </tag>
" ~~~~~~
" and fragment close tag
" </>
" ~~~
syntax region jsxCloseTag
\ matchgroup=jsxClosePunct
\ start=+<\_s*/+
\ end=+>+
\ contained
\ contains=jsxTagName
" <tag key={this.props.key}>
" ~~~
syntax match jsxAttrib
\ +\<[-A-Za-z_][-:_\$0-9A-Za-z]*\>+
\ contained
\ nextgroup=jsxEqual
\ skipwhite
\ skipempty
\ contains=jsxAttribKeyword
\ display
" <MyComponent ...>
" ~~~~~~~~~~~
" NOT
" <someCamel ...>
" ~~~~~
exe 'syntax match jsxComponentName
\ +\<[A-Z][\$0-9A-Za-z]\+\>+
\ contained
\ display ' .(s:highlight_close_tag ? 'transparent' : '')
" <tag key={this.props.key}>
" ~~~
exe 'syntax match jsxTagName
\ +\<[-:_\.\$0-9A-Za-z]\+\>+
\ contained
\ contains=jsxComponentName,jsxDot,jsxNamespace
\ nextgroup=jsxAttrib
\ skipempty
\ skipwhite
\ display ' .(s:highlight_close_tag ? 'transparent' : '')
" <tag id="sample">
" ~~~~~~~~
" and
" <tag id='sample'>
" ~~~~~~~~
syntax region jsxString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ contained contains=@Spell display
let s:tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'raw'])
let s:enable_tagged_jsx = !empty(s:tags)
" add support to JSX inside the tagged template string
" https://github.com/developit/htm
if s:enable_tagged_jsx
exe 'syntax region jsxTaggedRegion
\ start=+\%('. join(s:tags, '\|') .'\)\@<=`+ms=s+1
\ end=+`+me=e-1
\ extend
\ contained
\ containedin=jsTemplateString,javascriptTemplate,javaScriptStringT,typescriptStringB
\ contains=jsxElement'
syntax region jsxEscapeJs
\ start=+\${+
\ end=++
\ extend
\ contained
\ contains=jsTemplateExpression,javascriptTemplateSubstitution,javaScriptEmbed,typescriptInterpolation
syntax region jsxOpenTag
\ matchgroup=jsxOpenPunct
\ start=+<\%(\${\)\@=+
\ matchgroup=NONE
\ end=++
\ contained
\ contains=jsxEscapeJs
\ nextgroup=jsxAttrib,jsxSpreadOperator
\ skipwhite
\ skipempty
syntax keyword jsxAttribKeyword class contained display
syntax match jsxSpreadOperator +\.\.\.+ contained display nextgroup=jsxEscapeJs skipwhite
syntax match jsxCloseTag +<//>+ display
syntax match jsxComment +<!--\_.\{-}-->+ display
endif
" Highlight the tag name
highlight def link jsxTag Function
highlight def link jsxTagName Identifier
highlight def link jsxComponentName Function
highlight def link jsxAttrib Type
highlight def link jsxAttribKeyword jsxAttrib
highlight def link jsxEqual Operator
highlight def link jsxString String
highlight def link jsxDot Operator
highlight def link jsxNamespace Operator
" Highlight the jsxCloseString (i.e. />), jsxPunct (i.e. <,>) and jsxCloseTag (i.e. <//>)
highlight def link jsxCloseString Comment
highlight def link jsxPunct jsxCloseString
highlight def link jsxOpenPunct jsxPunct
highlight def link jsxClosePunct jsxPunct
highlight def link jsxCloseTag jsxCloseString
highlight def link jsxComment Comment
highlight def link jsxSpreadOperator Operator
if s:highlight_close_tag
highlight! def link jsxOpenPunct jsxTag
highlight! def link jsxCloseString Identifier
endif
let s:vim_jsx_pretty_colorful_config = get(g:, 'vim_jsx_pretty_colorful_config', 0)
if s:vim_jsx_pretty_colorful_config == 1
highlight def link jsObjectKey Label
highlight def link jsArrowFuncArgs Type
highlight def link jsFuncArgs Type
endif
endfunction

View File

@@ -3,7 +3,7 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'julia') != -1
endif
" This file is autogenerated from the script 'generate_latex_symbols_table.jl'
" The symbols are based on Julia version 1.1.0-DEV.695
" The symbols are based on Julia version 1.3.0-DEV.263
scriptencoding utf-8
@@ -392,6 +392,7 @@ function! julia_latex_symbols#get_dict()
\ '\trademark': '™',
\ '\:tm:': '™',
\ '\bbZ': '',
\ '\ohm': 'Ω',
\ '\mho': '℧',
\ '\frakZ': '',
\ '\turnediota': '℩',
@@ -498,8 +499,8 @@ function! julia_latex_symbols#get_dict()
\ '\circlearrowright': '↻',
\ '\leftharpoonup': '↼',
\ '\leftharpoondown': '↽',
\ '\upharpoonleft': '↾',
\ '\upharpoonright': '↿',
\ '\upharpoonright': '↾',
\ '\upharpoonleft': '↿',
\ '\rightharpoonup': '⇀',
\ '\rightharpoondown': '⇁',
\ '\downharpoonright': '⇂',

25
autoload/terraform.vim Normal file
View File

@@ -0,0 +1,25 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'terraform') != -1
finish
endif
" Adapted from vim-hclfmt:
" https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim
function! terraform#fmt()
if !filereadable(expand('%:p'))
return
endif
let l:curw = winsaveview()
let l:tmpfile = tempname() . '.tf'
call writefile(getline(1, '$'), l:tmpfile)
let output = system('terraform fmt -write ' . l:tmpfile)
if v:shell_error == 0
try | silent undojoin | catch | endtry
call rename(l:tmpfile, resolve(expand('%')))
silent edit!
let &syntax = &syntax
else
echo output
call delete(l:tmpfile)
endif
call winrestview(l:curw)
endfunction

43
autoload/zig/config.vim Normal file
View File

@@ -0,0 +1,43 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
finish
endif
function! zig#config#ListTypeCommands() abort
return get(g:, 'zig_list_type_commands', {})
endfunction
function! zig#config#ListType() abort
return get(g:, 'zig_list_type', '')
endfunction
function! zig#config#ListAutoclose() abort
return get(g:, 'zig_list_autoclose', 1)
endfunction
function! zig#config#ListHeight() abort
return get(g:, "zig_list_height", 0)
endfunction
function! zig#config#FmtAutosave() abort
return get(g:, "zig_fmt_autosave", 0)
endfunction
function! zig#config#SetFmtAutosave(value) abort
let g:zig_fmt_autosave = a:value
endfunction
function! zig#config#FmtCommand() abort
return get(g:, "zig_fmt_command", ['zig', 'fmt', '--color', 'off'])
endfunction
function! zig#config#FmtFailSilently() abort
return get(g:, "zig_fmt_fail_silently", 0)
endfunction
function! zig#config#FmtExperimental() abort
return get(g:, "zig_fmt_experimental", 0)
endfunction
function! zig#config#Debug() abort
return get(g:, 'zig_debug', [])
endfunction

170
autoload/zig/fmt.vim Normal file
View File

@@ -0,0 +1,170 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
finish
endif
" 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.
"
function! zig#fmt#Format() abort
if zig#config#FmtExperimental()
" Using winsaveview to save/restore cursor state has the problem of
" closing folds on save:
" https://github.com/fatih/vim-go/issues/502
" One fix is to use mkview instead. Unfortunately, this sometimes causes
" other bad side effects:
" https://github.com/fatih/vim-go/issues/728
" and still closes all folds if foldlevel>0:
" https://github.com/fatih/vim-go/issues/732
let l:curw = {}
try
mkview!
catch
let l:curw = winsaveview()
endtry
" save our undo file to be restored after we are done. This is needed to
" prevent an additional undo jump due to BufWritePre auto command and also
" restore 'redo' history because it's getting being destroyed every
" BufWritePre
let tmpundofile = tempname()
exe 'wundo! ' . tmpundofile
else
" Save cursor position and many other things.
let l:curw = winsaveview()
endif
" Save cursor position and many other things.
let l:curw = winsaveview()
let bin_name = zig#config#FmtCommand()
" Get current position in file
let current_col = col('.')
let orig_line_count = line('$')
" Save current buffer first, else fmt will run on the original file and we
" will lose our changes.
silent! execute 'write' expand('%')
let [l:out, l:err] = zig#fmt#run(bin_name, expand('%'))
if l:err == 0
call zig#fmt#update_file(expand('%'))
elseif !zig#config#FmtFailSilently()
let errors = s:parse_errors(expand('%'), out)
call s:show_errors(errors)
endif
let diff_offset = line('$') - orig_line_count
if zig#config#FmtExperimental()
" restore our undo history
silent! exe 'rundo ' . tmpundofile
call delete(tmpundofile)
" Restore our cursor/windows positions, folds, etc.
if empty(l:curw)
silent! loadview
else
call winrestview(l:curw)
endif
else
" Restore our cursor/windows positions.
call winrestview(l:curw)
endif
" be smart and jump to the line the new statement was added/removed
call cursor(line('.') + diff_offset, current_col)
" Syntax highlighting breaks less often.
syntax sync fromstart
endfunction
" update_file updates the target file with the given formatted source
function! zig#fmt#update_file(target)
" remove undo point caused via BufWritePre
try | silent undojoin | catch | endtry
" reload buffer to reflect latest changes
silent edit!
let l:listtype = zig#list#Type("ZigFmt")
" the title information was introduced with 7.4-2200
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
if has('patch-7.4.2200')
" clean up previous list
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
else
let l:list_title = getloclist(0, {'title': 1})
endif
else
" can't check the title, so assume that the list was for go fmt.
let l:list_title = {'title': 'Format'}
endif
if has_key(l:list_title, "title") && l:list_title['title'] == "Format"
call zig#list#Clean(l:listtype)
endif
endfunction
" run runs the gofmt/goimport command for the given source file and returns
" the output of the executed command. Target is the real file to be formatted.
function! zig#fmt#run(bin_name, target)
let l:cmd = []
call extend(cmd, a:bin_name)
call extend(cmd, [a:target])
return zig#util#Exec(l:cmd)
endfunction
" parse_errors parses the given errors and returns a list of parsed errors
function! s:parse_errors(filename, content) abort
let splitted = split(a:content, '\n')
" list of errors to be put into location list
let errors = []
for line in splitted
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
" show_errors opens a location list and shows the given errors. If the given
" errors is empty, it closes the the location list
function! s:show_errors(errors) abort
let l:listtype = zig#list#Type("ZigFmt")
if !empty(a:errors)
call zig#list#Populate(l:listtype, a:errors, 'Format')
echohl Error | echomsg "zig fmt returned error" | echohl None
endif
" this closes the window if there are no errors or it opens
" it if there is any
call zig#list#Window(l:listtype, len(a:errors))
endfunction
function! zig#fmt#ToggleFmtAutoSave() abort
if zig#config#FmtAutosave()
call zig#config#SetFmtAutosave(0)
call zig#util#EchoProgress("auto fmt disabled")
return
end
call zig#config#SetFmtAutosave(1)
call zig#util#EchoProgress("auto fmt enabled")
endfunction
" vim: sw=2 ts=2 et

162
autoload/zig/list.vim Normal file
View File

@@ -0,0 +1,162 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
finish
endif
" Adapted from fatih/vim-go: autoload/go/list.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.
"
" Window opens the list with the given height up to 10 lines maximum.
" Otherwise g:zig_loclist_height is used.
"
" If no or zero height is given it closes the window by default.
" To prevent this, set g:zig_list_autoclose = 0
function! zig#list#Window(listtype, ...) abort
" we don't use lwindow to close the location list as we need also the
" ability to resize the window. So, we are going to use lopen and lclose
" for a better user experience. If the number of errors in a current
" location list increases/decreases, cwindow will not resize when a new
" updated height is passed. lopen in the other hand resizes the screen.
if !a:0 || a:1 == 0
call zig#list#Close(a:listtype)
return
endif
let height = zig#config#ListHeight()
if height == 0
" prevent creating a large location height for a large set of numbers
if a:1 > 10
let height = 10
else
let height = a:1
endif
endif
if a:listtype == "locationlist"
exe 'lopen ' . height
else
exe 'copen ' . height
endif
endfunction
" Get returns the current items from the list
function! zig#list#Get(listtype) abort
if a:listtype == "locationlist"
return getloclist(0)
else
return getqflist()
endif
endfunction
" Populate populate the list with the given items
function! zig#list#Populate(listtype, items, title) abort
if a:listtype == "locationlist"
call setloclist(0, a:items, 'r')
" The last argument ({what}) is introduced with 7.4.2200:
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
if has("patch-7.4.2200") | call setloclist(0, [], 'a', {'title': a:title}) | endif
else
call setqflist(a:items, 'r')
if has("patch-7.4.2200") | call setqflist([], 'a', {'title': a:title}) | endif
endif
endfunction
" Parse parses the given items based on the specified errorformat and
" populates the list.
function! zig#list#ParseFormat(listtype, errformat, items, title) abort
" backup users errorformat, will be restored once we are finished
let old_errorformat = &errorformat
" parse and populate the location list
let &errorformat = a:errformat
try
call zig#list#Parse(a:listtype, a:items, a:title)
finally
"restore back
let &errorformat = old_errorformat
endtry
endfunction
" Parse parses the given items based on the global errorformat and
" populates the list.
function! zig#list#Parse(listtype, items, title) abort
if a:listtype == "locationlist"
lgetexpr a:items
if has("patch-7.4.2200") | call setloclist(0, [], 'a', {'title': a:title}) | endif
else
cgetexpr a:items
if has("patch-7.4.2200") | call setqflist([], 'a', {'title': a:title}) | endif
endif
endfunction
" JumpToFirst jumps to the first item in the location list
function! zig#list#JumpToFirst(listtype) abort
if a:listtype == "locationlist"
ll 1
else
cc 1
endif
endfunction
" Clean cleans and closes the location list
function! zig#list#Clean(listtype) abort
if a:listtype == "locationlist"
lex []
else
cex []
endif
call zig#list#Close(a:listtype)
endfunction
" Close closes the location list
function! zig#list#Close(listtype) abort
let autoclose_window = zig#config#ListAutoclose()
if !autoclose_window
return
endif
if a:listtype == "locationlist"
lclose
else
cclose
endif
endfunction
function! s:listtype(listtype) abort
let listtype = zig#config#ListType()
if empty(listtype)
return a:listtype
endif
return listtype
endfunction
" s:default_list_type_commands is the defaults that will be used for each of
" the supported commands (see documentation for g:zig_list_type_commands). When
" defining a default, quickfix should be used if the command operates on
" multiple files, while locationlist should be used if the command operates on a
" single file or buffer. Keys that begin with an underscore are not supported
" in g:zig_list_type_commands.
let s:default_list_type_commands = {
\ "ZigFmt": "locationlist",
\ }
function! zig#list#Type(for) abort
let l:listtype = s:listtype(get(s:default_list_type_commands, a:for))
if l:listtype == "0"
call zig#util#EchoError(printf(
\ "unknown list type command value found ('%s'). Please open a bug report in the zig.vim repo.",
\ a:for))
let l:listtype = "quickfix"
endif
return get(zig#config#ListTypeCommands(), a:for, l:listtype)
endfunction
" vim: sw=2 ts=2 et

394
autoload/zig/util.vim Normal file
View File

@@ -0,0 +1,394 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
finish
endif
" Adapted from vim-go: autoload/go/util.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.
"
" PathSep returns the appropriate OS specific path separator.
function! zig#util#PathSep() abort
if zig#util#IsWin()
return '\'
endif
return '/'
endfunction
" PathListSep returns the appropriate OS specific path list separator.
function! zig#util#PathListSep() abort
if zig#util#IsWin()
return ";"
endif
return ":"
endfunction
" LineEnding returns the correct line ending, based on the current fileformat
function! zig#util#LineEnding() abort
if &fileformat == 'dos'
return "\r\n"
elseif &fileformat == 'mac'
return "\r"
endif
return "\n"
endfunction
" Join joins any number of path elements into a single path, adding a
" Separator if necessary and returns the result
function! zig#util#Join(...) abort
return join(a:000, zig#util#PathSep())
endfunction
" IsWin returns 1 if current OS is Windows or 0 otherwise
function! zig#util#IsWin() abort
let win = ['win16', 'win32', 'win64', 'win95']
for w in win
if (has(w))
return 1
endif
endfor
return 0
endfunction
" IsMac returns 1 if current OS is macOS or 0 otherwise.
function! zig#util#IsMac() abort
return has('mac') ||
\ has('macunix') ||
\ has('gui_macvim') ||
\ zig#util#Exec(['uname'])[0] =~? '^darwin'
endfunction
" Checks if using:
" 1) Windows system,
" 2) And has cygpath executable,
" 3) And uses *sh* as 'shell'
function! zig#util#IsUsingCygwinShell()
return zig#util#IsWin() && executable('cygpath') && &shell =~ '.*sh.*'
endfunction
" Check if Vim jobs API is supported.
"
" The (optional) first paramter can be added to indicate the 'cwd' or 'env'
" parameters will be used, which wasn't added until a later version.
function! zig#util#has_job(...) abort
" cwd and env parameters to job_start was added in this version.
if a:0 > 0 && a:1 is 1
return has('job') && has("patch-8.0.0902")
endif
" job was introduced in 7.4.xxx however there are multiple bug fixes and one
" of the latest is 8.0.0087 which is required for a stable async API.
return has('job') && has("patch-8.0.0087")
endfunction
let s:env_cache = {}
" env returns the go environment variable for the given key. Where key can be
" GOARCH, GOOS, GOROOT, etc... It caches the result and returns the cached
" version.
function! zig#util#env(key) abort
let l:key = tolower(a:key)
if has_key(s:env_cache, l:key)
return s:env_cache[l:key]
endif
if executable('go')
let l:var = call('zig#util#'.l:key, [])
if zig#util#ShellError() != 0
call zig#util#EchoError(printf("'go env %s' failed", toupper(l:key)))
return ''
endif
else
let l:var = eval("$".toupper(a:key))
endif
let s:env_cache[l:key] = l:var
return l:var
endfunction
" Run a shell command.
"
" It will temporary set the shell to /bin/sh for Unix-like systems if possible,
" so that we always use a standard POSIX-compatible Bourne shell (and not e.g.
" csh, fish, etc.) See #988 and #1276.
function! s:system(cmd, ...) abort
" Preserve original shell and shellredir values
let l:shell = &shell
let l:shellredir = &shellredir
if !zig#util#IsWin() && executable('/bin/sh')
set shell=/bin/sh shellredir=>%s\ 2>&1
endif
try
return call('system', [a:cmd] + a:000)
finally
" Restore original values
let &shell = l:shell
let &shellredir = l:shellredir
endtry
endfunction
" System runs a shell command "str". Every arguments after "str" is passed to
" stdin.
function! zig#util#System(str, ...) abort
return call('s:system', [a:str] + a:000)
endfunction
" Exec runs a shell command "cmd", which must be a list, one argument per item.
" Every list entry will be automatically shell-escaped
" Every other argument is passed to stdin.
function! zig#util#Exec(cmd, ...) abort
if len(a:cmd) == 0
call zig#util#EchoError("zig#util#Exec() called with empty a:cmd")
return ['', 1]
endif
let l:bin = a:cmd[0]
if !executable(l:bin)
call zig#util#EchoError(printf("could not find binary '%s'", a:cmd[0]))
return ['', 1]
endif
return call('s:exec', [a:cmd] + a:000)
endfunction
function! s:exec(cmd, ...) abort
let l:bin = a:cmd[0]
let l:cmd = zig#util#Shelljoin([l:bin] + a:cmd[1:])
if zig#util#HasDebug('shell-commands')
call zig#util#EchoInfo('shell command: ' . l:cmd)
endif
let l:out = call('s:system', [l:cmd] + a:000)
return [l:out, zig#util#ShellError()]
endfunction
function! zig#util#ShellError() abort
return v:shell_error
endfunction
" StripPath strips the path's last character if it's a path separator.
" example: '/foo/bar/' -> '/foo/bar'
function! zig#util#StripPathSep(path) abort
let last_char = strlen(a:path) - 1
if a:path[last_char] == zig#util#PathSep()
return strpart(a:path, 0, last_char)
endif
return a:path
endfunction
" StripTrailingSlash strips the trailing slash from the given path list.
" example: ['/foo/bar/'] -> ['/foo/bar']
function! zig#util#StripTrailingSlash(paths) abort
return map(copy(a:paths), 'zig#util#StripPathSep(v:val)')
endfunction
" Shelljoin returns a shell-safe string representation of arglist. The
" {special} argument of shellescape() may optionally be passed.
function! zig#util#Shelljoin(arglist, ...) abort
try
let ssl_save = &shellslash
set noshellslash
if a:0
return join(map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')'), ' ')
endif
return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ')
finally
let &shellslash = ssl_save
endtry
endfunction
fu! zig#util#Shellescape(arg)
try
let ssl_save = &shellslash
set noshellslash
return shellescape(a:arg)
finally
let &shellslash = ssl_save
endtry
endf
" Shelllist returns a shell-safe representation of the items in the given
" arglist. The {special} argument of shellescape() may optionally be passed.
function! zig#util#Shelllist(arglist, ...) abort
try
let ssl_save = &shellslash
set noshellslash
if a:0
return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')')
endif
return map(copy(a:arglist), 'shellescape(v:val)')
finally
let &shellslash = ssl_save
endtry
endfunction
" Returns the byte offset for line and column
function! zig#util#Offset(line, col) abort
if &encoding != 'utf-8'
let sep = zig#util#LineEnding()
let buf = a:line == 1 ? '' : (join(getline(1, a:line-1), sep) . sep)
let buf .= a:col == 1 ? '' : getline('.')[:a:col-2]
return len(iconv(buf, &encoding, 'utf-8'))
endif
return line2byte(a:line) + (a:col-2)
endfunction
"
" Returns the byte offset for the cursor
function! zig#util#OffsetCursor() abort
return zig#util#Offset(line('.'), col('.'))
endfunction
" Windo is like the built-in :windo, only it returns to the window the command
" was issued from
function! zig#util#Windo(command) abort
let s:currentWindow = winnr()
try
execute "windo " . a:command
finally
execute s:currentWindow. "wincmd w"
unlet s:currentWindow
endtry
endfunction
" snippetcase converts the given word to given preferred snippet setting type
" case.
function! zig#util#snippetcase(word) abort
let l:snippet_case = zig#config#AddtagsTransform()
if l:snippet_case == "snakecase"
return zig#util#snakecase(a:word)
elseif l:snippet_case == "camelcase"
return zig#util#camelcase(a:word)
else
return a:word " do nothing
endif
endfunction
" snakecase converts a string to snake case. i.e: FooBar -> foo_bar
" Copied from tpope/vim-abolish
function! zig#util#snakecase(word) abort
let word = substitute(a:word, '::', '/', 'g')
let word = substitute(word, '\(\u\+\)\(\u\l\)', '\1_\2', 'g')
let word = substitute(word, '\(\l\|\d\)\(\u\)', '\1_\2', 'g')
let word = substitute(word, '[.-]', '_', 'g')
let word = tolower(word)
return word
endfunction
" camelcase converts a string to camel case. e.g. FooBar or foo_bar will become
" fooBar.
" Copied from tpope/vim-abolish.
function! zig#util#camelcase(word) abort
let word = substitute(a:word, '-', '_', 'g')
if word !~# '_' && word =~# '\l'
return substitute(word, '^.', '\l&', '')
else
return substitute(word, '\C\(_\)\=\(.\)', '\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g')
endif
endfunction
" pascalcase converts a string to 'PascalCase'. e.g. fooBar or foo_bar will
" become FooBar.
function! zig#util#pascalcase(word) abort
let word = zig#util#camelcase(a:word)
return toupper(word[0]) . word[1:]
endfunction
" Echo a message to the screen and highlight it with the group in a:hi.
"
" The message can be a list or string; every line with be :echomsg'd separately.
function! s:echo(msg, hi)
let l:msg = []
if type(a:msg) != type([])
let l:msg = split(a:msg, "\n")
else
let l:msg = a:msg
endif
" Tabs display as ^I or <09>, so manually expand them.
let l:msg = map(l:msg, 'substitute(v:val, "\t", " ", "")')
exe 'echohl ' . a:hi
for line in l:msg
echom "zig.vim: " . line
endfor
echohl None
endfunction
function! zig#util#EchoSuccess(msg)
call s:echo(a:msg, 'Function')
endfunction
function! zig#util#EchoError(msg)
call s:echo(a:msg, 'ErrorMsg')
endfunction
function! zig#util#EchoWarning(msg)
call s:echo(a:msg, 'WarningMsg')
endfunction
function! zig#util#EchoProgress(msg)
redraw
call s:echo(a:msg, 'Identifier')
endfunction
function! zig#util#EchoInfo(msg)
call s:echo(a:msg, 'Debug')
endfunction
" Get all lines in the buffer as a a list.
function! zig#util#GetLines()
let buf = getline(1, '$')
if &encoding != 'utf-8'
let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")')
endif
if &l:fileformat == 'dos'
" XXX: line2byte() depend on 'fileformat' option.
" so if fileformat is 'dos', 'buf' must include '\r'.
let buf = map(buf, 'v:val."\r"')
endif
return buf
endfunction
" Make a named temporary directory which starts with "prefix".
"
" Unfortunately Vim's tempname() is not portable enough across various systems;
" see: https://github.com/mattn/vim-go/pull/3#discussion_r138084911
function! zig#util#tempdir(prefix) abort
" See :help tempfile
if zig#util#IsWin()
let l:dirs = [$TMP, $TEMP, 'c:\tmp', 'c:\temp']
else
let l:dirs = [$TMPDIR, '/tmp', './', $HOME]
endif
let l:dir = ''
for l:d in dirs
if !empty(l:d) && filewritable(l:d) == 2
let l:dir = l:d
break
endif
endfor
if l:dir == ''
call zig#util#EchoError('Unable to find directory to store temporary directory in')
return
endif
" Not great randomness, but "good enough" for our purpose here.
let l:rnd = sha256(printf('%s%s', localtime(), fnamemodify(bufname(''), ":p")))
let l:tmp = printf("%s/%s%s", l:dir, a:prefix, l:rnd)
call mkdir(l:tmp, 'p', 0700)
return l:tmp
endfunction
" Report if the user enabled a debug flag in g:zig_debug.
function! zig#util#HasDebug(flag)
return index(zig#config#Debug(), a:flag) >= 0
endfunction
" vim: sw=2 ts=2 et

17
build
View File

@@ -25,8 +25,10 @@ download() {
for pack in $1; do
path="$(cut -d ':' -f 2 <<<"$pack")"
dir="tmp/$(cut -d '/' -f 2 <<<"$path")"
repo="$(awk -F\# '{print $1}' <<<"$path")"
branch="$(awk -F\# '{print $2}' <<<"$path")"
rm -rf "$dir"
(mkdir -p "$dir" && curl --silent -L "https://codeload.github.com/$path/tar.gz/master" | tar -zx -C "$dir" --strip 1 && printf '.') &
(mkdir -p "$dir" && curl --silent -L "https://codeload.github.com/$repo/tar.gz/${branch:-master}" | tar -zx -C "$dir" --strip 1 && printf '.') &
done
wait
@@ -176,6 +178,7 @@ PACKS="
cucumber:tpope/vim-cucumber
cue:mgrabovsky/vim-cuesheet
dart:dart-lang/dart-vim-plugin
dlang:JesseKPhillips/d.vim
dockerfile:ekalinin/Dockerfile.vim
elixir:elixir-lang/vim-elixir
elm:ElmCast/elm-vim
@@ -199,9 +202,12 @@ PACKS="
haproxy:CH-DanReif/haproxy.vim
haskell:neovimhaskell/haskell-vim
haxe:yaymukund/vim-haxe
hcl:b4b4r07/vim-hcl
hive:zebradil/hive.vim
html5:othree/html5.vim
i3:mboughaba/i3config.vim
idris:idris-hackers/idris-vim
ion:vmchale/ion-vim
jasmine:glanotte/vim-jasmine
javascript:pangloss/vim-javascript:_JAVASCRIPT
jenkins:martinda/Jenkinsfile-vim-syntax
@@ -209,7 +215,7 @@ PACKS="
json5:GutenYe/json5.vim
json:elzr/vim-json
jst:briancollins/vim-jst
jsx:amadeus/vim-jsx
jsx:MaxMEllon/vim-jsx-pretty
julia:JuliaEditorSupport/julia-vim
kotlin:udalov/kotlin-vim
latex:LaTeX-Box-Team/LaTeX-Box
@@ -217,6 +223,7 @@ PACKS="
lilypond:anowlcalledjosh/vim-lilypond
livescript:gkz/vim-ls
llvm:rhysd/vim-llvm
log:MTDL9/vim-log-highlighting
lua:tbastos/vim-lua
mako:sophacles/vim-bundle-mako
markdown:plasticboy/vim-markdown:_SYNTAX
@@ -251,6 +258,7 @@ PACKS="
ragel:jneen/ragel.vim
raml:IN3D/vim-raml
reason:reasonml-editor/vim-reason-plus
rego:tsandall/vim-rego
rspec:sheerun/rspec.vim
rst:marshallward/vim-restructuredtext
ruby:vim-ruby/vim-ruby
@@ -262,6 +270,7 @@ PACKS="
slime:slime-lang/vim-slime-syntax
smt2:bohlender/vim-smt2
solidity:tomlion/vim-solidity
styled-components:styled-components/vim-styled-components#main
stylus:wavded/vim-stylus
svg-indent:jasonshell/vim-svg-indent
svg:vim-scripts/svg.vim
@@ -271,9 +280,10 @@ PACKS="
terraform:hashivim/vim-terraform
textile:timcharper/textile.vim
thrift:solarnz/thrift.vim
tmux:keith/tmux.vim
tmux:ericpruitt/tmux.vim
tomdoc:wellbredgrapefruit/tomdoc.vim
toml:cespare/vim-toml
tptp:c-cube/vim-tptp
twig:lumiliet/vim-twig
typescript:leafgarland/typescript-vim
vala:arrufat/vala.vim
@@ -287,6 +297,7 @@ PACKS="
xls:vim-scripts/XSLT-syntax
yaml:stephpy/vim-yaml
yard:sheerun/vim-yardoc
zig:ziglang/zig.vim
"
rm -rf tmp

View File

@@ -1,3 +1,9 @@
function! s:setf(filetype) abort
if &filetype !=# a:filetype
let &filetype = a:filetype
endif
endfunction
" Enable jsx syntax by default
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 0
@@ -79,12 +85,13 @@ augroup filetypedetect
"jinja
autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja,*.nunjucks,*.nunjs,*.njk set ft=jinja
"tsx
autocmd BufNewFile,BufRead *.tsx setfiletype typescript.jsx
augroup END
" Fix for https://github.com/sheerun/vim-polyglot/issues/236#issuecomment-387984954
if (!exists('g:graphql_javascript_tags'))
let g:graphql_javascript_tags = ['gql', 'graphql', 'Relay.QL']
endif
augroup filetypedetect
autocmd BufNewFile,BufReadPost *.tsx setlocal filetype=typescript.tsx
augroup END

View File

@@ -1,3 +1,9 @@
function! s:setf(filetype) abort
if &filetype !=# a:filetype
let &filetype = a:filetype
endif
endfunction
" Enable jsx syntax by default
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 0
@@ -79,15 +85,16 @@ augroup filetypedetect
"jinja
autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja,*.nunjucks,*.nunjs,*.njk set ft=jinja
"tsx
autocmd BufNewFile,BufRead *.tsx setfiletype typescript.jsx
augroup END
" Fix for https://github.com/sheerun/vim-polyglot/issues/236#issuecomment-387984954
if (!exists('g:graphql_javascript_tags'))
let g:graphql_javascript_tags = ['gql', 'graphql', 'Relay.QL']
endif
augroup filetypedetect
autocmd BufNewFile,BufReadPost *.tsx setlocal filetype=typescript.tsx
augroup END
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'acpiasl') == -1
augroup filetypedetect
" acpiasl, from asl.vim in martinlroth/vim-acpi-asl
@@ -287,12 +294,48 @@ autocmd BufRead,BufNewFile *.dart set filetype=dart
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
augroup filetypedetect
" dlang, from d.vim in JesseKPhillips/d.vim
autocmd BufNewFile,BufRead *.d setf d
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
augroup filetypedetect
" dlang, from dcov.vim in JesseKPhillips/d.vim
autocmd BufNewFile,BufRead *.lst set filetype=dcov
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
augroup filetypedetect
" dlang, from dd.vim in JesseKPhillips/d.vim
au BufRead,BufNewFile *.dd set filetype=dd
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
augroup filetypedetect
" dlang, from ddoc.vim in JesseKPhillips/d.vim
au BufRead,BufNewFile *.ddoc set filetype=ddoc
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
augroup filetypedetect
" dlang, from dsdl.vim in JesseKPhillips/d.vim
autocmd BufNewFile,BufRead *.sdl set filetype=dsdl
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
augroup filetypedetect
" dockerfile, from Dockerfile.vim in ekalinin/Dockerfile.vim
" Dockerfile
autocmd BufRead,BufNewFile Dockerfile set ft=Dockerfile
autocmd BufRead,BufNewFile [Dd]ockerfile set ft=Dockerfile
autocmd BufRead,BufNewFile Dockerfile* set ft=Dockerfile
autocmd BufRead,BufNewFile [Dd]ockerfile.vim set ft=vim
autocmd BufRead,BufNewFile *.dock set ft=Dockerfile
autocmd BufRead,BufNewFile *.[Dd]ockerfile set ft=Dockerfile
augroup end
@@ -503,6 +546,25 @@ autocmd BufNewFile,BufRead *.hx setf haxe
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'hcl') == -1
augroup filetypedetect
" hcl, from hcl.vim in b4b4r07/vim-hcl
autocmd BufNewFile,BufRead *.hcl set filetype=hcl
autocmd BufNewFile,BufRead *.nomad set filetype=hcl
autocmd BufNewFile,BufRead *.tf set filetype=hcl
autocmd BufNewFile,BufRead Appfile set filetype=hcl
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'hive') == -1
augroup filetypedetect
" hive, from hive.vim in zebradil/hive.vim
autocmd BufNewFile,BufRead *.hql set filetype=hive
autocmd BufNewFile,BufRead *.ql set filetype=hive
autocmd BufNewFile,BufRead *.q set filetype=hive
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'i3') == -1
augroup filetypedetect
" i3, from i3config.vim in mboughaba/i3config.vim
@@ -528,6 +590,19 @@ au BufNewFile,BufRead *.lidr setf lidris
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ion') == -1
augroup filetypedetect
" ion, from ion.vim in vmchale/ion-vim
autocmd BufNewFile,BufRead ~/.config/ion/initrc set filetype=ion
autocmd BufNewFile,BufRead *.ion set filetype=ion
autocmd BufNewFile,BufRead,StdinReadPost *
\ if getline(1) =~ '^#!.*\Wion\s*$' |
\ set ft=ion |
\ endif
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1
augroup filetypedetect
" jasmine, from jasmine.vim in glanotte/vim-jasmine
@@ -593,59 +668,6 @@ au BufNewFile,BufRead *.ect set filetype=jst
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
augroup filetypedetect
" jsx, from javascript.vim in amadeus/vim-jsx
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim ftdetect file
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
" if g:jsx_check_react_import == 1
" parse the first line of js file (skipping comments). When it has a 'react'
" importation, we guess the user writes jsx
" endif
let s:jsx_prevalent_pattern =
\ '\v\C%^\_s*%(%(//.*\_$|/\*\_.{-}\*/)@>\_s*)*%(import\s+\k+\s+from\s+|%(\l+\s+)=\k+\s*\=\s*require\s*\(\s*)[`"'']react>'
" Whether to set the JSX filetype on *.js files.
fu! <SID>EnableJSX()
" Whether the .jsx extension is required.
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 0
endif
" Whether the @jsx pragma is required.
if !exists('g:jsx_pragma_required')
let g:jsx_pragma_required = 0
endif
if g:jsx_pragma_required && !exists('b:jsx_ext_found')
" Look for the @jsx pragma. It must be included in a docblock comment
" before anything else in the file (except whitespace).
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
endif
if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif
if g:jsx_ext_required && !exists('b:jsx_ext_found') &&
\ !(get(g:,'jsx_check_react_import') && search(s:jsx_prevalent_pattern, 'nw'))
return 0
endif
return 1
endfu
autocmd BufNewFile,BufRead *.jsx let b:jsx_ext_found = 1
autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx
autocmd BufNewFile,BufRead *.js
\ if <SID>EnableJSX() | set filetype=javascript.jsx | endif
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
augroup filetypedetect
" kotlin, from kotlin.vim in udalov/kotlin-vim
@@ -705,6 +727,15 @@ au BufRead,BufNewFile *.td set filetype=tablegen
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'log') == -1
augroup filetypedetect
" log, from log.vim in MTDL9/vim-log-highlighting
au BufNewFile,BufRead *.log set filetype=log
au BufNewFile,BufRead *_log set filetype=log
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
augroup filetypedetect
" mako, from mako.vim in sophacles/vim-bundle-mako
@@ -1076,6 +1107,17 @@ au BufNewFile,BufRead .merlin set ft=merlin
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rego') == -1
augroup filetypedetect
" rego, from rego.vim in tsandall/vim-rego
autocmd BufRead,BufNewFile *.rego set filetype=rego
" Use # as a comment prefix
setlocal comments=b:#,fb:-
setlocal commentstring=#\ %s
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
augroup filetypedetect
" ruby, from ruby.vim in vim-ruby/vim-ruby
@@ -1201,9 +1243,15 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" rust, from rust.vim in rust-lang/rust.vim
" vint: -ProhibitAutocmdWithNoGroup
autocmd BufRead,BufNewFile *.rs setf rust
autocmd BufRead,BufNewFile *.rs call s:set_rust_filetype()
autocmd BufRead,BufNewFile Cargo.toml setf FALLBACK cfg
function! s:set_rust_filetype() abort
if &filetype !=# 'rust'
set filetype=rust
endif
endfunction
" vim: set et sw=4 sts=4 ts=8:
augroup end
endif
@@ -1293,10 +1341,10 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
augroup filetypedetect
" terraform, from terraform.vim in hashivim/vim-terraform
au BufRead,BufNewFile *.tf setlocal filetype=terraform
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
au BufRead,BufNewFile *.tfstate setlocal filetype=json
au BufRead,BufNewFile *.tfstate.backup setlocal filetype=json
autocmd BufRead,BufNewFile *.tf set filetype=terraform
autocmd BufRead,BufNewFile *.tfvars set filetype=terraform
autocmd BufRead,BufNewFile *.tfstate set filetype=json
autocmd BufRead,BufNewFile *.tfstate.backup set filetype=json
augroup end
endif
@@ -1321,13 +1369,6 @@ au BufNewFile,BufRead *.thrift setlocal filetype=thrift
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
augroup filetypedetect
" tmux, from tmux.vim in keith/tmux.vim
autocmd BufNewFile,BufRead {.,}tmux*.conf* setfiletype tmux
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1
augroup filetypedetect
" toml, from toml.vim in cespare/vim-toml
@@ -1336,6 +1377,19 @@ autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config,*/.cargo
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tptp') == -1
augroup filetypedetect
" tptp, from tptp.vim in c-cube/vim-tptp
au BufRead,BufNewFile *.p set filetype=tptp
au BufRead,BufNewFile *.p set syntax=tptp
au BufRead,BufNewFile *.tptp set filetype=tptp
au BufRead,BufNewFile *.tptp set syntax=tptp
au BufRead,BufNewFile *.ax set filetype=tptp
au BufRead,BufNewFile *.ax set syntax=tptp
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
augroup filetypedetect
" twig, from twig.vim in lumiliet/vim-twig
@@ -1410,3 +1464,10 @@ autocmd BufNewFile,BufRead *.xdc setfiletype xdc
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1
augroup filetypedetect
" zig, from zig.vim in ziglang/zig.vim
au BufRead,BufNewFile *.zig set filetype=zig
augroup end
endif

41
ftplugin/hcl.vim Normal file
View File

@@ -0,0 +1,41 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hcl') != -1
finish
endif
" File: ftplugin/hcl.vim
" Author: BABAROT <b4b4r07@gmail.com>
" Description: FileType Plugin for HCL
" Last Change: Nob 05, 2015
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo&vim
setlocal commentstring=#\ %s
" Add NERDCommenter delimiters
let s:delims = { 'left': '#' }
if exists('g:NERDDelimiterMap')
if !has_key(g:NERDDelimiterMap, 'hcl')
let g:NERDDelimiterMap.hcl = s:delims
endif
elseif exists('g:NERDCustomDelimiters')
if !has_key(g:NERDCustomDelimiters, 'hcl')
let g:NERDCustomDelimiters.hcl = s:delims
endif
else
let g:NERDCustomDelimiters = { 'hcl': s:delims }
endif
unlet s:delims
let b:undo_ftplugin = ""
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sw=4 ts=4:

6
ftplugin/hive.vim Normal file
View File

@@ -0,0 +1,6 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hive') != -1
finish
endif
setlocal comments=:--
setlocal commentstring=--\ %s

9
ftplugin/ion.vim Normal file
View File

@@ -0,0 +1,9 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ion') != -1
finish
endif
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
setlocal commentstring=#%s

View File

@@ -2,7 +2,7 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'kotlin') != -1
finish
endif
if exists("b:did_ftplugin") | finish | endif
if exists('b:did_ftplugin') | finish | endif
let b:did_ftplugin = 1
setlocal comments=://

View File

@@ -12,11 +12,14 @@ if (exists("b:did_ftplugin"))
endif
let b:did_ftplugin = 1
setlocal
\ comments=:#
\ commentstring=#\ %s
\ comments=:#
\ commentstring=#\ %s
\ iskeyword+=-
if get(g:, 'nix_recommended_style', 1)
setlocal
\ shiftwidth=2
\ softtabstop=2
\ expandtab
\ iskeyword+=-
\ expandtab
endif

View File

@@ -2,12 +2,18 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'plantuml') != -1
finish
endif
scriptencoding utf-8
" Vim filetype plugin file
" Language: PlantUML
" Maintainer: Anders Thøgersen <first name at bladre dot dk>
" License: VIM LICENSE
if exists('b:loaded_plantuml_plugin')
finish
endif
let b:loaded_plantuml_plugin = 1
let s:cpo_save = &cpo
set cpo&vim
let s:cpo_save = &cpoptions
set cpoptions&vim
if !exists('g:plantuml_executable_script')
let g:plantuml_executable_script='plantuml'
@@ -21,10 +27,13 @@ if exists('loaded_matchit')
\ ',\<rnote\>:\<endrnote\>' .
\ ',\<hnote\>:\<endhnote\>' .
\ ',\<title\>:\<endtitle\>' .
\ ',\<\while\>:\<endwhile\>'
\ ',\<\while\>:\<endwhile\>' .
\ ',@startuml:@enduml'
endif
let &l:makeprg=g:plantuml_executable_script . ' ' . fnameescape(expand('%'))
if get(g:, 'plantuml_set_makeprg', 1)
let &l:makeprg=g:plantuml_executable_script . ' %'
endif
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
@@ -33,5 +42,5 @@ let b:endwise_words = 'loop,group,alt,note,legend'
let b:endwise_pattern = '^\s*\zs\<\(loop\|group\|alt\|note\ze[^:]*$\|legend\)\>.*$'
let b:endwise_syngroups = 'plantumlKeyword'
let &cpo = s:cpo_save
let &cpoptions = s:cpo_save
unlet s:cpo_save

View File

@@ -5,71 +5,154 @@ endif
" terraform.vim - basic vim/terraform integration
" Maintainer: HashiVim <https://github.com/hashivim>
set formatoptions-=t
if exists("g:loaded_terraform") || v:version < 700 || &cp || !executable('terraform')
if exists('b:did_ftplugin') || v:version < 700 || &compatible
finish
endif
let g:loaded_terraform = 1
let b:did_ftplugin = 1
if !exists("g:terraform_fmt_on_save") || !filereadable(expand("%:p"))
let s:cpo_save = &cpoptions
setlocal formatoptions-=t
let b:undo_ftplugin = 'setlocal formatoptions<'
" Include hyphens as keyword characters so that a keyword appearing as part of
" a longer name doesn't get partially highlighted.
setlocal iskeyword+=-
let b:undo_ftplugin .= ' iskeyword<'
set cpoptions&vim
if !exists('g:terraform_align')
let g:terraform_align = 0
endif
if !exists('g:terraform_remap_spacebar')
let g:terraform_remap_spacebar = 0
endif
if !exists('g:terraform_fold_sections')
let g:terraform_fold_sections = 0
endif
if g:terraform_align && exists(':Tabularize')
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
function! s:terraformalign()
let p = '^.*=[^>]*$'
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
Tabularize/=/l1
normal! 0
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
endif
if g:terraform_fold_sections
function! TerraformFolds()
let thisline = getline(v:lnum)
if match(thisline, '^resource') >= 0
return '>1'
elseif match(thisline, '^provider') >= 0
return '>1'
elseif match(thisline, '^module') >= 0
return '>1'
elseif match(thisline, '^variable') >= 0
return '>1'
elseif match(thisline, '^output') >= 0
return '>1'
elseif match(thisline, '^data') >= 0
return '>1'
elseif match(thisline, '^terraform') >= 0
return '>1'
elseif match(thisline, '^locals') >= 0
return '>1'
else
return '='
endif
endfunction
setlocal foldmethod=expr
setlocal foldexpr=TerraformFolds()
setlocal foldlevel=1
let b:undo_ftplugin .= ' foldmethod< foldexpr< foldlevel<'
function! TerraformFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
setlocal foldtext=TerraformFoldText()
let b:undo_ftplugin .= ' foldtext<'
endif
" Re-map the space bar to fold and unfold
if get(g:, 'terraform_remap_spacebar', 1)
"inoremap <space> <C-O>za
nnoremap <space> za
onoremap <space> <C-C>za
vnoremap <space> zf
endif
" Set the commentstring
if exists('g:terraform_commentstring')
let &l:commentstring=g:terraform_commentstring
else
setlocal commentstring=#%s
endif
let b:undo_ftplugin .= ' commentstring<'
if !exists('g:terraform_fmt_on_save')
let g:terraform_fmt_on_save = 0
endif
function! s:commands(A, L, P)
return join([
\ "apply",
\ "console",
\ "destroy",
\ "env",
\ "fmt",
\ "get",
\ "graph",
\ "import",
\ "init",
\ "output",
\ "plan",
\ "providers",
\ "push",
\ "refresh",
\ "show",
\ "taint",
\ "untaint",
\ "validate",
\ "version",
\ "workspace",
\ "debug",
\ "force-unlock",
\ "state"
\ ], "\n")
return [
\ 'apply',
\ 'console',
\ 'destroy',
\ 'env',
\ 'fmt',
\ 'get',
\ 'graph',
\ 'import',
\ 'init',
\ 'output',
\ 'plan',
\ 'providers',
\ 'push',
\ 'refresh',
\ 'show',
\ 'taint',
\ 'untaint',
\ 'validate',
\ 'version',
\ 'workspace',
\ '0.12checklist',
\ 'debug',
\ 'force-unlock',
\ 'state'
\ ]
endfunction
" Adapted from vim-hclfmt:
" https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim
function! terraform#fmt()
let l:curw = winsaveview()
let l:tmpfile = tempname() . ".tf"
call writefile(getline(1, "$"), l:tmpfile)
let output = system("terraform fmt -write " . l:tmpfile)
if v:shell_error == 0
try | silent undojoin | catch | endtry
call rename(l:tmpfile, resolve(expand("%")))
silent edit!
let &syntax = &syntax
else
echo output
call delete(l:tmpfile)
endif
call winrestview(l:curw)
endfunction
let &cpoptions = s:cpo_save
unlet s:cpo_save
augroup terraform
autocmd!
autocmd BufEnter *
\ command! -nargs=+ -complete=custom,s:commands Terraform execute '!terraform '.<q-args>. ' -no-color'
autocmd BufEnter * command! -nargs=0 TerraformFmt call terraform#fmt()
if get(g:, "terraform_fmt_on_save", 1)
if !executable('terraform')
finish
endif
let s:cpo_save = &cpoptions
command! -nargs=+ -complete=customlist,s:commands -buffer Terraform execute '!terraform '.<q-args>. ' -no-color'
command! -nargs=0 -buffer TerraformFmt call terraform#fmt()
let b:undo_ftplugin .= '|delcommand Terraform|delcommand TerraformFmt'
if get(g:, 'terraform_fmt_on_save', 1)
augroup terraform
autocmd!
autocmd BufWritePre *.tf call terraform#fmt()
autocmd BufWritePre *.tfvars call terraform#fmt()
endif
augroup END
augroup END
endif
let &cpoptions = s:cpo_save
unlet s:cpo_save

18
ftplugin/zig.vim Normal file
View File

@@ -0,0 +1,18 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
finish
endif
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
finish
endif
let b:did_ftplugin = 1
set expandtab
set tabstop=4
set shiftwidth=4
setlocal suffixesadd=.zig
setlocal commentstring=//\ %s
setlocal makeprg=zig\ build

View File

@@ -52,13 +52,13 @@ if !exists('g:python_pep8_indent_searchpair_timeout')
endif
let s:block_rules = {
\ '^\s*elif\>': ['if', 'elif'],
\ '^\s*except\>': ['try', 'except'],
\ '^\s*finally\>': ['try', 'except', 'else']
\ }
\ '^\s*elif\>': [['if', 'elif'], ['else']],
\ '^\s*except\>': [['try', 'except'], []],
\ '^\s*finally\>': [['try', 'except', 'else'], []]
\ }
let s:block_rules_multiple = {
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
\ }
\ '^\s*else\>': [['if', 'elif', 'for', 'try', 'except'], []]
\ }
" Pairs to look for when searching for opening parenthesis.
" The value is the maximum offset in lines.
let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
@@ -73,13 +73,15 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
\ '=~? "\\vcomment|jedi\\S"'
let s:special_chars_syn_pattern = "\\vstring|comment|^pythonbytes%(contents)=$|pythonTodo|jedi\\S"
if !get(g:, 'python_pep8_indent_skip_concealed', 0) || !has('conceal')
" Skip strings and comments. Return 1 for chars to skip.
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
" are inserted temporarily into the buffer.
function! s:_skip_special_chars(line, col)
return synIDattr(synID(a:line, a:col, 0), 'name')
\ =~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"
\ =~? s:special_chars_syn_pattern
endfunction
else
" Also ignore anything concealed.
@@ -94,8 +96,8 @@ else
function! s:_skip_special_chars(line, col)
return synIDattr(synID(a:line, a:col, 0), 'name')
\ =~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"
\ || s:is_concealed(a:line, a:col)
\ =~? s:special_chars_syn_pattern
\ || s:is_concealed(a:line, a:col)
endfunction
endif
@@ -152,15 +154,23 @@ function! s:find_start_of_multiline_statement(lnum)
endfunction
" Find possible indent(s) of the block starter that matches the current line.
function! s:find_start_of_block(lnum, types, multiple)
function! s:find_start_of_block(lnum, types, skip, multiple) abort
let r = []
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
if !empty(a:skip)
let re_skip = '\V\^\s\*\('.join(a:skip, '\|').'\)\>'
else
let re_skip = ''
endif
let lnum = a:lnum
let last_indent = indent(lnum) + 1
while lnum > 0 && last_indent > 0
let indent = indent(lnum)
if indent < last_indent
if getline(lnum) =~# re
let line = getline(lnum)
if !empty(re_skip) && line =~# re_skip
let last_indent = indent
elseif line =~# re
if !a:multiple
return [indent]
endif
@@ -217,6 +227,11 @@ function! s:indent_like_opening_paren(lnum)
let res = base
else
let res = base + s:sw()
" Special case for parenthesis.
if text[paren_col-1] ==# '(' && getline(a:lnum) !~# '\v\)\s*:?\s*$'
return res
endif
endif
else
" Indent to match position of opening paren.
@@ -241,14 +256,16 @@ function! s:indent_like_block(lnum)
let text = getline(a:lnum)
for [multiple, block_rules] in [
\ [0, s:block_rules],
\ [1, s:block_rules_multiple]]
for [line_re, blocks] in items(block_rules)
\ [1, s:block_rules_multiple],
\ ]
for [line_re, blocks_ignore] in items(block_rules)
if text !~# line_re
continue
endif
let indents = s:find_start_of_block(a:lnum - 1, blocks, multiple)
if !len(indents)
let [blocks, skip] = blocks_ignore
let indents = s:find_start_of_block(a:lnum - 1, blocks, skip, multiple)
if empty(indents)
return -1
endif
if len(indents) == 1

81
indent/d.vim Normal file
View File

@@ -0,0 +1,81 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dlang') != -1
finish
endif
" Vim indent file for the D programming language (version 1.076 and 2.063).
"
" Language: D
" Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
" Last Change: 2014 January 19
" Version: 0.26
"
" Please submit bugs/comments/suggestions to the github repo:
" https://github.com/JesseKPhillips/d.vim
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal cindent
setlocal indentkeys& indentkeys+=0=in indentkeys+=0=out indentkeys+=0=body
setlocal indentexpr=GetDIndent()
if exists("*GetDIndent")
finish
endif
function! SkipBlanksAndComments(startline)
let lnum = a:startline
while lnum > 1
let lnum = prevnonblank(lnum)
if getline(lnum) =~ '[*+]/\s*$'
while getline(lnum) !~ '/[*+]' && lnum > 1
let lnum = lnum - 1
endwhile
if getline(lnum) =~ '^\s*/[*+]'
let lnum = lnum - 1
else
break
endif
elseif getline(lnum) =~ '\s*//'
let lnum = lnum - 1
else
break
endif
endwhile
return lnum
endfunction
function GetDIndent()
let lnum = v:lnum
let line = getline(lnum)
let cind = cindent(lnum)
" Align contract blocks with function signature.
if line =~ '^\s*\(body\|in\|out\)\>'
" Skip in/out parameters.
if getline(lnum - 1) =~ '[(,]\s*$'
return cind
endif
" Find the end of the last block or the function signature.
if line !~ '^\s*}' && getline(lnum - 1) !~ '('
while lnum > 1 && getline(lnum - 1) !~ '[(}]'
let lnum = lnum - 1
endwhile
endif
let lnum = SkipBlanksAndComments(lnum)
return cindent(lnum - 1)
endif
" Align multiline array literals. e.g.:
" auto a = [
" [ 1, 2, 3 ],
" [ 4, 5, 6 ],
if line =~ '^\s*\[' && getline(lnum - 1) =~ '^\s*\['
return indent(lnum - 1)
endif
return cind
endfunction

15
indent/hcl.vim Normal file
View File

@@ -0,0 +1,15 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hcl') != -1
finish
endif
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
" cindent seems to work adequately with HCL's brace-y syntax
setlocal cindent
" don't de-indent comments (cindent treats them like preprocessor directives)
setlocal cinkeys-=0#

View File

@@ -5,9 +5,9 @@ endif
" Vim indent file
" Language: Kotlin
" Maintainer: Alexander Udalov
" Latest Revision: 15 July 2017
" Latest Revision: 26 May 2019
if exists("b:did_indent")
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
@@ -45,24 +45,14 @@ function! GetKotlinIndent()
let prev_open_paren = prev =~ '^.*(\s*$'
let cur_close_paren = cur =~ '^\s*).*$'
if prev_open_paren && !cur_close_paren
return prev_indent + 2 * &shiftwidth
endif
if cur_close_paren && !prev_open_paren
return prev_indent - 2 * &shiftwidth
endif
let prev_open_brace = prev =~ '^.*\({\|->\)\s*$'
let cur_close_brace = cur =~ '^\s*}.*$'
if prev_open_brace && !cur_close_brace
if prev_open_paren && !cur_close_paren || prev_open_brace && !cur_close_brace
return prev_indent + &shiftwidth
endif
if cur_close_brace && !prev_open_brace
if cur_close_paren && !prev_open_paren || cur_close_brace && !prev_open_brace
return prev_indent - &shiftwidth
endif

View File

@@ -174,66 +174,101 @@ endfun
" [-- <ELEMENT ? - - ...> --]
call <SID>HtmlIndentPush('a')
call <SID>HtmlIndentPush('abbr')
call <SID>HtmlIndentPush('acronym')
call <SID>HtmlIndentPush('address')
call <SID>HtmlIndentPush('applet')
call <SID>HtmlIndentPush('article')
call <SID>HtmlIndentPush('aside')
call <SID>HtmlIndentPush('audio')
call <SID>HtmlIndentPush('b')
call <SID>HtmlIndentPush('bdi')
call <SID>HtmlIndentPush('bdo')
call <SID>HtmlIndentPush('big')
call <SID>HtmlIndentPush('blockquote')
call <SID>HtmlIndentPush('button')
call <SID>HtmlIndentPush('canvas')
call <SID>HtmlIndentPush('caption')
call <SID>HtmlIndentPush('center')
call <SID>HtmlIndentPush('cite')
call <SID>HtmlIndentPush('code')
call <SID>HtmlIndentPush('colgroup')
call <SID>HtmlIndentPush('content')
call <SID>HtmlIndentPush('data')
call <SID>HtmlIndentPush('datalist')
call <SID>HtmlIndentPush('del')
call <SID>HtmlIndentPush('details')
call <SID>HtmlIndentPush('dfn')
call <SID>HtmlIndentPush('dialog')
call <SID>HtmlIndentPush('dir')
call <SID>HtmlIndentPush('div')
call <SID>HtmlIndentPush('dl')
call <SID>HtmlIndentPush('element')
call <SID>HtmlIndentPush('em')
call <SID>HtmlIndentPush('fieldset')
call <SID>HtmlIndentPush('font')
call <SID>HtmlIndentPush('figcaption')
call <SID>HtmlIndentPush('figure')
call <SID>HtmlIndentPush('footer')
call <SID>HtmlIndentPush('form')
call <SID>HtmlIndentPush('frameset')
call <SID>HtmlIndentPush('h1')
call <SID>HtmlIndentPush('h2')
call <SID>HtmlIndentPush('h3')
call <SID>HtmlIndentPush('h4')
call <SID>HtmlIndentPush('h5')
call <SID>HtmlIndentPush('h6')
call <SID>HtmlIndentPush('header')
call <SID>HtmlIndentPush('hgroup')
call <SID>HtmlIndentPush('i')
call <SID>HtmlIndentPush('iframe')
call <SID>HtmlIndentPush('ins')
call <SID>HtmlIndentPush('kbd')
call <SID>HtmlIndentPush('label')
call <SID>HtmlIndentPush('legend')
call <SID>HtmlIndentPush('li')
call <SID>HtmlIndentPush('main')
call <SID>HtmlIndentPush('map')
call <SID>HtmlIndentPush('mark')
call <SID>HtmlIndentPush('MediaStream')
call <SID>HtmlIndentPush('menu')
call <SID>HtmlIndentPush('noframes')
call <SID>HtmlIndentPush('menuitem')
call <SID>HtmlIndentPush('meter')
call <SID>HtmlIndentPush('nav')
call <SID>HtmlIndentPush('noembed')
call <SID>HtmlIndentPush('noscript')
call <SID>HtmlIndentPush('object')
call <SID>HtmlIndentPush('ol')
call <SID>HtmlIndentPush('optgroup')
call <SID>HtmlIndentPush('option')
call <SID>HtmlIndentPush('output')
call <SID>HtmlIndentPush('picture')
call <SID>HtmlIndentPush('pre')
call <SID>HtmlIndentPush('progress')
call <SID>HtmlIndentPush('q')
call <SID>HtmlIndentPush('rb')
call <SID>HtmlIndentPush('rp')
call <SID>HtmlIndentPush('rt')
call <SID>HtmlIndentPush('rtc')
call <SID>HtmlIndentPush('ruby')
call <SID>HtmlIndentPush('s')
call <SID>HtmlIndentPush('samp')
call <SID>HtmlIndentPush('script')
call <SID>HtmlIndentPush('section')
call <SID>HtmlIndentPush('select')
call <SID>HtmlIndentPush('shadow')
call <SID>HtmlIndentPush('slot')
call <SID>HtmlIndentPush('small')
call <SID>HtmlIndentPush('span')
call <SID>HtmlIndentPush('strong')
call <SID>HtmlIndentPush('style')
call <SID>HtmlIndentPush('sub')
call <SID>HtmlIndentPush('summary')
call <SID>HtmlIndentPush('sup')
call <SID>HtmlIndentPush('table')
call <SID>HtmlIndentPush('template')
call <SID>HtmlIndentPush('textarea')
call <SID>HtmlIndentPush('time')
call <SID>HtmlIndentPush('title')
call <SID>HtmlIndentPush('tt')
call <SID>HtmlIndentPush('u')
call <SID>HtmlIndentPush('ul')
call <SID>HtmlIndentPush('var')
call <SID>HtmlIndentPush('video')
" For some reason the default HTML indentation script doesn't consider these
" elements to be worthy of indentation.
@@ -260,6 +295,44 @@ if !exists('g:html_indent_strict_table')
call <SID>HtmlIndentPush('thead')
endif
" [-- <OBSOLETE ELEMENTS ? - - ...> --]
call <SID>HtmlIndentPush('abbr')
call <SID>HtmlIndentPush('acronym')
call <SID>HtmlIndentPush('applet')
call <SID>HtmlIndentPush('audio')
call <SID>HtmlIndentPush('basefont')
call <SID>HtmlIndentPush('bgsound')
call <SID>HtmlIndentPush('big')
call <SID>HtmlIndentPush('blink')
call <SID>HtmlIndentPush('center')
call <SID>HtmlIndentPush('command')
call <SID>HtmlIndentPush('content')
call <SID>HtmlIndentPush('dir')
call <SID>HtmlIndentPush('element')
call <SID>HtmlIndentPush('embed')
call <SID>HtmlIndentPush('font')
call <SID>HtmlIndentPush('frame')
call <SID>HtmlIndentPush('frameset')
call <SID>HtmlIndentPush('image')
call <SID>HtmlIndentPush('img')
call <SID>HtmlIndentPush('isindex')
call <SID>HtmlIndentPush('keygen')
call <SID>HtmlIndentPush('listing')
call <SID>HtmlIndentPush('marquee')
call <SID>HtmlIndentPush('menuitem')
call <SID>HtmlIndentPush('multicol')
call <SID>HtmlIndentPush('nextid')
call <SID>HtmlIndentPush('nobr')
call <SID>HtmlIndentPush('noembed')
call <SID>HtmlIndentPush('noframes')
call <SID>HtmlIndentPush('object')
call <SID>HtmlIndentPush('plaintext')
call <SID>HtmlIndentPush('shadow')
call <SID>HtmlIndentPush('spacer')
call <SID>HtmlIndentPush('strike')
call <SID>HtmlIndentPush('tt')
call <SID>HtmlIndentPush('xmp')
" [-- <Mako Elements> --]
call <SID>MakoIndentPush('%def')
call <SID>MakoIndentPush('%block')

View File

@@ -122,7 +122,7 @@ function! GetNimIndent(lnum)
return plindent + &sw
endif
if pline =~ '\(type\|import\|const\|var\)\s*$'
if pline =~ '\(type\|import\|const\|var\|let\)\s*$'
\ || pline =~ '=\s*\(object\|enum\|tuple\|concept\)'
return plindent + &sw
endif

View File

@@ -2,6 +2,12 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'plantuml') != -1
finish
endif
scriptencoding utf-8
" Vim indent file
" Language: PlantUML
" Maintainer: Anders Thøgersen <first name at bladre dot dk>
" License: VIM LICENSE
if exists('b:did_indent')
finish
endif
@@ -15,14 +21,6 @@ if exists('*GetPlantUMLIndent')
finish
endif
let s:incIndent =
\ '^\s*\%(loop\|alt\|opt\|group\|critical\|else\|legend\|box\|if\|while\)\>\|' .
\ '^\s*ref\>[^:]*$\|' .
\ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' .
\ '^\s*title\s*$\|' .
\ '^\s*skinparam\>.*{\s*$\|' .
\ '^\s*\%(state\|class\|partition\|rectangle\|enum\|interface\|namespace\|object\)\>.*{'
let s:decIndent = '^\s*\%(end\|else\|}\)'
function! GetPlantUMLIndent(...) abort
@@ -38,6 +36,8 @@ function! GetPlantUMLIndent(...) abort
let pline = getline(pnum)
let cline = getline(clnum)
let s:incIndent = s:getIncIndent()
if cline =~ s:decIndent
if pline =~ s:incIndent
return pindent
@@ -57,3 +57,33 @@ function! s:insidePlantUMLTags(lnum) abort
call cursor(a:lnum, 1)
return search('@startuml', 'Wbn') && search('@enduml', 'Wn')
endfunction
function! s:listSyntax(syntaxKeyword) abort
" Get a list of words assigned to a syntax keyword
" The 'syntax list <syntax keyword>' command returns
" a string with the keyword itself, followed by xxx,
" on which we can split to extract the keywords string.
" This string must then be split on whitespace
let syntaxWords = split(
\ execute('syntax list ' . a:syntaxKeyword),
\ a:syntaxKeyword . ' xxx ')[-1]
return split(syntaxWords)
endfunction
function! s:typeKeywordIncPattern() abort
" Extract keywords for plantumlTypeKeyword, returning the inc pattern
let syntaxWords = join(s:listSyntax('plantumlTypeKeyword'), '\\\|')
return '^\s*\%(' . syntaxWords . '\)\>.*{'
endfunction
function! s:getIncIndent() abort
" Function to determine the s:incIndent pattern
return
\ '^\s*\%(class\|object\|interface\|partition\|rectangle\|enum\|namespace\)\>.*{\s*$\|' .
\ '^\s*\%(loop\|alt\|opt\|group\|critical\|else\|legend\|box\|if\|while\|fork\|split\)\>\|' .
\ '^\s*ref\>[^:]*$\|' .
\ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' .
\ '^\s*title\s*$\|' .
\ '^\s*skinparam\>.*{\s*$\|' .
\ s:typeKeywordIncPattern()
endfunction

View File

@@ -52,13 +52,13 @@ if !exists('g:python_pep8_indent_searchpair_timeout')
endif
let s:block_rules = {
\ '^\s*elif\>': ['if', 'elif'],
\ '^\s*except\>': ['try', 'except'],
\ '^\s*finally\>': ['try', 'except', 'else']
\ }
\ '^\s*elif\>': [['if', 'elif'], ['else']],
\ '^\s*except\>': [['try', 'except'], []],
\ '^\s*finally\>': [['try', 'except', 'else'], []]
\ }
let s:block_rules_multiple = {
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
\ }
\ '^\s*else\>': [['if', 'elif', 'for', 'try', 'except'], []]
\ }
" Pairs to look for when searching for opening parenthesis.
" The value is the maximum offset in lines.
let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
@@ -73,13 +73,15 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
\ '=~? "\\vcomment|jedi\\S"'
let s:special_chars_syn_pattern = "\\vstring|comment|^pythonbytes%(contents)=$|pythonTodo|jedi\\S"
if !get(g:, 'python_pep8_indent_skip_concealed', 0) || !has('conceal')
" Skip strings and comments. Return 1 for chars to skip.
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
" are inserted temporarily into the buffer.
function! s:_skip_special_chars(line, col)
return synIDattr(synID(a:line, a:col, 0), 'name')
\ =~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"
\ =~? s:special_chars_syn_pattern
endfunction
else
" Also ignore anything concealed.
@@ -94,8 +96,8 @@ else
function! s:_skip_special_chars(line, col)
return synIDattr(synID(a:line, a:col, 0), 'name')
\ =~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"
\ || s:is_concealed(a:line, a:col)
\ =~? s:special_chars_syn_pattern
\ || s:is_concealed(a:line, a:col)
endfunction
endif
@@ -152,15 +154,23 @@ function! s:find_start_of_multiline_statement(lnum)
endfunction
" Find possible indent(s) of the block starter that matches the current line.
function! s:find_start_of_block(lnum, types, multiple)
function! s:find_start_of_block(lnum, types, skip, multiple) abort
let r = []
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
if !empty(a:skip)
let re_skip = '\V\^\s\*\('.join(a:skip, '\|').'\)\>'
else
let re_skip = ''
endif
let lnum = a:lnum
let last_indent = indent(lnum) + 1
while lnum > 0 && last_indent > 0
let indent = indent(lnum)
if indent < last_indent
if getline(lnum) =~# re
let line = getline(lnum)
if !empty(re_skip) && line =~# re_skip
let last_indent = indent
elseif line =~# re
if !a:multiple
return [indent]
endif
@@ -217,6 +227,11 @@ function! s:indent_like_opening_paren(lnum)
let res = base
else
let res = base + s:sw()
" Special case for parenthesis.
if text[paren_col-1] ==# '(' && getline(a:lnum) !~# '\v\)\s*:?\s*$'
return res
endif
endif
else
" Indent to match position of opening paren.
@@ -241,14 +256,16 @@ function! s:indent_like_block(lnum)
let text = getline(a:lnum)
for [multiple, block_rules] in [
\ [0, s:block_rules],
\ [1, s:block_rules_multiple]]
for [line_re, blocks] in items(block_rules)
\ [1, s:block_rules_multiple],
\ ]
for [line_re, blocks_ignore] in items(block_rules)
if text !~# line_re
continue
endif
let indents = s:find_start_of_block(a:lnum - 1, blocks, multiple)
if !len(indents)
let [blocks, skip] = blocks_ignore
let indents = s:find_start_of_block(a:lnum - 1, blocks, skip, multiple)
if empty(indents)
return -1
endif
if len(indents) == 1

View File

@@ -3,20 +3,31 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'terraform') != -
endif
" Only load this file if no other indent file was loaded
if exists("b:did_indent")
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
let s:cpo_save = &cpoptions
set cpoptions&vim
setlocal nolisp
setlocal autoindent sw=2 ts=2
setlocal autoindent shiftwidth=2 tabstop=2 softtabstop=2
setlocal indentexpr=TerraformIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=)
let b:undo_indent = 'setlocal lisp< autoindent< shiftwidth< tabstop< softtabstop<'
\ . ' indentexpr< indentkeys<'
if exists("*TerraformIndent")
let &cpoptions = s:cpo_save
unlet s:cpo_save
if exists('*TerraformIndent')
finish
endif
let s:cpo_save = &cpoptions
set cpoptions&vim
function! TerraformIndent(lnum)
" Beginning of the file should have no indent
if a:lnum == 0
@@ -32,8 +43,8 @@ function! TerraformIndent(lnum)
let thisindent = previndent
" Config block starting with [ { ( should increase the indent level
if prevline =~ '[\[{\(]\s*$'
let thisindent += &sw
if prevline =~# '[\[{\(]\s*$'
let thisindent += &shiftwidth
endif
" Current line without comments should continue the indent level
@@ -41,9 +52,12 @@ function! TerraformIndent(lnum)
" Config block ending with ) } ] should get the indentation
" level from the initial config block
if thisline =~ '^\s*[\)}\]]'
let thisindent -= &sw
if thisline =~# '^\s*[\)}\]]'
let thisindent -= &shiftwidth
endif
return thisindent
endfunction
let &cpoptions = s:cpo_save
unlet s:cpo_save

View File

@@ -9,7 +9,7 @@ describe "My Vim plugin" do
extensions = extensions.split(/[\n,]/)
extensions.each do |ext|
extensions.sort!.uniq!.each do |ext|
if ext.match?(/^[a-z\.]+$/i)
it "should parse #{ext} file" do
Timeout::timeout(20) do
@@ -21,4 +21,8 @@ describe "My Vim plugin" do
end
end
end
after(:all) do
vim.kill
end
end

View File

@@ -4,7 +4,7 @@ require 'vimrunner/rspec'
$plugin_path = File.expand_path('../..', __FILE__)
Vimrunner::RSpec.configure do |config|
config.reuse_server = true
config.reuse_server = false
# Decide how to start a Vim instance. In this block, an instance should be
# spawned and set up with anything project-specific.

View File

@@ -19,7 +19,7 @@ endif
syn keyword dockerfileKeywords FROM AS MAINTAINER RUN CMD COPY
syn keyword dockerfileKeywords EXPOSE ADD ENTRYPOINT
syn keyword dockerfileKeywords VOLUME USER WORKDIR ONBUILD
syn keyword dockerfileKeywords LABEL ARG HEALTHCHECK SHELL
syn keyword dockerfileKeywords LABEL ARG HEALTHCHECK SHELL STOPSIGNAL
" Bash statements
setlocal iskeyword+=-

View File

@@ -30,9 +30,13 @@ syn keyword carpSyntax add-cflag add-lib project load reload let-do ignore
syn keyword carpSyntax fmt mac-only linux-only windows-only use-all when
syn keyword carpSyntax unless defn-do comment forever-do case and* or*
syn keyword carpSyntax str* println* break doc sig hidden private
syn keyword carpSyntax while-do const-assert save-docs defproject
syn keyword carpSyntax relative-include not-on-windows load-and-use
syn keyword carpSyntax deftest
syn match carpSyntax "\vc(a|d){1,4}r"
syn keyword carpFunc Int Float Double Bool String Char Array Fn Ref Long λ
syn keyword carpFunc Maybe Map Result Set Pair
syn keyword carpFunc Pattern
syn keyword carpFunc not or and + - * / = /= >= <= > < inc dec
syn keyword carpFunc println print get-line from-string mod random
@@ -45,6 +49,7 @@ syn keyword carpFunc bit-shift-right bit-and bit-or bit-xor bit-not safe-add
syn keyword carpFunc safe-sub safe-mul even? odd? cmp allocate repeat-indexed
syn keyword carpFunc sanitize-addresses memory-balance reset-memory-balance!
syn keyword carpFunc log-memory-balance! memory-logged assert-balanced trace
syn keyword carpFunc assert
syn keyword carpFunc pi e swap! update! char-at tail head split-by words lines
syn keyword carpFunc pad-left pad-right count-char empty? random-sized substring
syn keyword carpFunc prefix-string suffix-string starts-with? ends-with?
@@ -54,7 +59,24 @@ syn keyword carpFunc from-float tan asin atan cosh sinh tanh exp frexp ldexp
syn keyword carpFunc log log10 modf pow ceil clamp approx refstr foreach
syn keyword carpFunc => ==> repeat nth replicate range raw aset aset!
syn keyword carpFunc push-back pop-back sort index-of element-count
syn keyword carpFunc apply unsafe-from from just? nothing? ptr from-ptr
syn keyword carpFunc map and-then unwrap-or-zero or-else unwrap-or-else
syn keyword carpFunc unsafe-from-success from-success unsafe-from-error
syn keyword carpFunc from-error to-maybe success? error? to-result
syn keyword carpFunc create create-with-len put put! get-with-default get
syn keyword carpFunc get-maybe update update-with-default contains? remove
syn keyword carpFunc all? for-each endo-map kv-reduce vals keys from-array
syn keyword carpFunc to-array subset? union difference intersection
syn keyword carpFunc init-from-refs
syn keyword carpFunc car cdr caar cadr cdar cddr caaar caadr cadar cdaar caddr
syn keyword carpFunc cdadr cddar cdddr caaaar caaadr caaddr cadaar cadadr caddar
syn keyword carpFunc cadddr cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar
syn keyword carpFunc cddddr
syn keyword carpFunc private? hidden?
syn keyword carpFunc print-sig print-doc
syn keyword carpFunc assert-op assert-equal assert-not-equal assert-true
syn keyword carpFunc assert-false assert-exit print-test-results with-test
syn keyword carpFunc dir-from-path file-from-path
syn match carpSymbol ,\k+, contained
syn match carpTodo /\v<(FIXME|NOTE|TODO|OPTIMIZE)/ containedin=carpComment,carpString

View File

@@ -4,14 +4,14 @@ endif
" Vim syntax file
" Program: CMake - Cross-Platform Makefile Generator
" Version: cmake version 3.14.20190402-g56ae2
" Version: cmake version 3.14.20190529-g067a4f
" Language: CMake
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>,
" Nicholas Hutchinson <nshutchinson@gmail.com>,
" Patrick Boettcher <patrick.boettcher@posteo.de>
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
" Last Change: 2019 Apr 15
" Last Change: 2019 May 29
"
" Licence: The CMake license applies to this file. See
" https://cmake.org/licensing
@@ -39,12 +39,13 @@ syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmak
syn region cmakeEnvironment start="$ENV{" end="}" contained oneline contains=cmakeTodo
syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeCommandManuallyAdded,cmakeArguments,cmakeTodo
syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeGeneratorExpressions,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeCommandManuallyAdded,cmakeArguments,cmakeTodo
syn case match
syn keyword cmakeProperty contained
\ ABSTRACT
\ ADDITIONAL_CLEAN_FILES
\ ADDITIONAL_MAKE_CLEAN_FILES
\ ADVANCED
\ ALIASED_TARGET
@@ -251,6 +252,7 @@ syn keyword cmakeProperty contained
\ MANUALLY_ADDED_DEPENDENCIES
\ MEASUREMENT
\ MODIFIED
\ MSVC_RUNTIME_LIBRARY
\ NAME
\ NO_SONAME
\ NO_SYSTEM_FROM_IMPORTED
@@ -300,6 +302,10 @@ syn keyword cmakeProperty contained
\ SUBDIRECTORIES
\ SUFFIX
\ SYMBOLIC
\ Swift_DEPENDENCIES_FILE
\ Swift_DIAGNOSTICS_FILE
\ Swift_MODULE_DIRECTORY
\ Swift_MODULE_NAME
\ TARGET_ARCHIVES_MAY_BE_SHARED_LIBS
\ TARGET_MESSAGES
\ TARGET_SUPPORTS_SHARED_LIBS
@@ -332,9 +338,11 @@ syn keyword cmakeProperty contained
\ VS_INCLUDE_IN_VSIX
\ VS_IOT_EXTENSIONS_VERSION
\ VS_IOT_STARTUP_TASK
\ VS_JUST_MY_CODE_DEBUGGING
\ VS_KEYWORD
\ VS_MOBILE_EXTENSIONS_VERSION
\ VS_NO_SOLUTION_DEPLOY
\ VS_PROJECT_IMPORT
\ VS_RESOURCE_GENERATOR
\ VS_SCC_AUXPATH
\ VS_SCC_LOCALPATH
@@ -917,6 +925,7 @@ syn keyword cmakeVariable contained
\ CMAKE_ERROR_DEPRECATED
\ CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
\ CMAKE_EXECUTABLE_SUFFIX
\ CMAKE_EXECUTE_PROCESS_COMMAND_ECHO
\ CMAKE_EXE_LINKER_FLAGS
\ CMAKE_EXE_LINKER_FLAGS_INIT
\ CMAKE_EXPORT_COMPILE_COMMANDS
@@ -933,6 +942,7 @@ syn keyword cmakeVariable contained
\ CMAKE_FIND_PACKAGE_NAME
\ CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
\ CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
\ CMAKE_FIND_PACKAGE_PREFER_CONFIG
\ CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS
\ CMAKE_FIND_PACKAGE_SORT_DIRECTION
\ CMAKE_FIND_PACKAGE_SORT_ORDER
@@ -943,6 +953,7 @@ syn keyword cmakeVariable contained
\ CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
\ CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
\ CMAKE_FOLDER
\ CMAKE_FRAMEWORK
\ CMAKE_FRAMEWORK_PATH
\ CMAKE_Fortran
\ CMAKE_Fortran_ANDROID_TOOLCHAIN_MACHINE
@@ -1136,6 +1147,7 @@ syn keyword cmakeVariable contained
\ CMAKE_MODULE_LINKER_FLAGS_INIT
\ CMAKE_MODULE_PATH
\ CMAKE_MSVCIDE_RUN_PATH
\ CMAKE_MSVC_RUNTIME_LIBRARY
\ CMAKE_NETRC
\ CMAKE_NETRC_FILE
\ CMAKE_NINJA_OUTPUT_PATH_PREFIX
@@ -1155,6 +1167,7 @@ syn keyword cmakeVariable contained
\ CMAKE_PROJECT_DESCRIPTION
\ CMAKE_PROJECT_HOMEPAGE_URL
\ CMAKE_PROJECT_INCLUDE
\ CMAKE_PROJECT_INCLUDE_BEFORE
\ CMAKE_PROJECT_NAME
\ CMAKE_PROJECT_VERSION
\ CMAKE_PROJECT_VERSION_MAJOR
@@ -1311,6 +1324,7 @@ syn keyword cmakeVariable contained
\ CMAKE_Swift_LINKER_WRAPPER_FLAG
\ CMAKE_Swift_LINKER_WRAPPER_FLAG_SEP
\ CMAKE_Swift_LINK_EXECUTABLE
\ CMAKE_Swift_MODULE_DIRECTORY
\ CMAKE_Swift_OUTPUT_EXTENSION
\ CMAKE_Swift_PLATFORM_ID
\ CMAKE_Swift_SIMULATE_ID
@@ -1346,9 +1360,11 @@ syn keyword cmakeVariable contained
\ CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD
\ CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD
\ CMAKE_VS_INTEL_Fortran_PROJECT_VERSION
\ CMAKE_VS_JUST_MY_CODE_DEBUGGING
\ CMAKE_VS_MSBUILD_COMMAND
\ CMAKE_VS_NsightTegra_VERSION
\ CMAKE_VS_PLATFORM_NAME
\ CMAKE_VS_PLATFORM_NAME_DEFAULT
\ CMAKE_VS_PLATFORM_TOOLSET
\ CMAKE_VS_PLATFORM_TOOLSET_CUDA
\ CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE
@@ -1463,6 +1479,7 @@ syn keyword cmakeVariable contained
\ CTEST_UPDATE_COMMAND
\ CTEST_UPDATE_OPTIONS
\ CTEST_UPDATE_VERSION_ONLY
\ CTEST_UPDATE_VERSION_OVERRIDE
\ CTEST_USE_LAUNCHERS
\ CYGWIN
\ ENV
@@ -1541,6 +1558,7 @@ syn keyword cmakeKWExternalProject contained
\ EP_UPDATE_DISCONNECTED
\ EXCLUDE_FROM_ALL
\ FORCE
\ GHS
\ GIT_CONFIG
\ GIT_PROGRESS
\ GIT_REMOTE_NAME
@@ -1570,6 +1588,7 @@ syn keyword cmakeKWExternalProject contained
\ LOG_TEST
\ LOG_UPDATE
\ MAKE_EXE
\ MULTI
\ NAMES
\ NETRC
\ NETRC_FILE
@@ -1635,6 +1654,8 @@ syn keyword cmakeKWadd_custom_command contained
\ GENERATED
\ IMPLICIT_DEPENDS
\ INCLUDE_DIRECTORIES
\ JOB_POOL
\ JOB_POOLS
\ JOIN
\ MAIN_DEPENDENCY
\ NOT
@@ -1660,6 +1681,8 @@ syn keyword cmakeKWadd_custom_target contained
\ DEPENDS
\ GENERATED
\ INCLUDE_DIRECTORIES
\ JOB_POOL
\ JOB_POOLS
\ JOIN
\ SOURCES
\ TARGET_PROPERTY
@@ -1715,6 +1738,7 @@ syn keyword cmakeKWadd_library contained
\ POST_BUILD
\ PRE_BUILD
\ PRE_LINK
\ PUBLIC_HEADER
\ RUNTIME_OUTPUT_DIRECTORY
\ SHARED
\ STATIC
@@ -1729,6 +1753,7 @@ syn keyword cmakeKWadd_link_options contained
\ LINKER
\ LINK_OPTIONS
\ SHELL
\ STATIC_LIBRARY_OPTIONS
\ UNIX_COMMAND
\ _LINKER_WRAPPER_FLAG
\ _LINKER_WRAPPER_FLAG_SEP
@@ -1985,6 +2010,7 @@ syn keyword cmakeKWexecute_process contained
\ ANSI
\ AUTO
\ COMMAND
\ COMMAND_ECHO
\ ENCODING
\ ERROR_FILE
\ ERROR_QUIET
@@ -2000,6 +2026,8 @@ syn keyword cmakeKWexecute_process contained
\ RESULTS_VARIABLE
\ RESULT_VARIABLE
\ RFC
\ STDERR
\ STDOUT
\ TIMEOUT
\ UTF
\ VERBATIM
@@ -2049,6 +2077,7 @@ syn keyword cmakeKWfile contained
\ FILES_MATCHING
\ FILE_PERMISSIONS
\ FOLLOW_SYMLINKS
\ FOLLOW_SYMLINK_CHAIN
\ FUNCTION
\ GENERATE
\ GLOB
@@ -2157,6 +2186,7 @@ syn keyword cmakeKWfind_library contained
syn keyword cmakeKWfind_package contained
\ ABI
\ BUNDLE
\ CMAKE_DISABLE_FIND_PACKAGE_
\ CMAKE_FIND_ROOT_PATH_BOTH
\ COMPONENTS
@@ -2165,6 +2195,7 @@ syn keyword cmakeKWfind_package contained
\ DEC
\ DVAR
\ EXACT
\ FRAMEWORK
\ HINTS
\ MODULE
\ NAMES
@@ -2574,11 +2605,15 @@ syn keyword cmakeKWmath contained
syn keyword cmakeKWmessage contained
\ AUTHOR_WARNING
\ DEBUG
\ DEPRECATION
\ FATAL_ERROR
\ GUI
\ NOTICE
\ SEND_ERROR
\ STATUS
\ TRACE
\ VERBOSE
\ WARNING
syn keyword cmakeKWoption contained
@@ -2700,6 +2735,7 @@ syn keyword cmakeKWstring contained
\ RANDOM
\ RANDOM_SEED
\ REGEX
\ REPEAT
\ REPLACE
\ REVERSE
\ RFC
@@ -2796,7 +2832,6 @@ syn keyword cmakeKWtarget_link_libraries contained
\ LINK_PUBLIC
\ OBJECT
\ OLD
\ OSX
\ PRIVATE
\ PUBLIC
\ SHARED
@@ -2817,6 +2852,7 @@ syn keyword cmakeKWtarget_link_options contained
\ PRIVATE
\ PUBLIC
\ SHELL
\ STATIC_LIBRARY_OPTIONS
\ UNIX_COMMAND
\ _LINKER_WRAPPER_FLAG
\ _LINKER_WRAPPER_FLAG_SEP
@@ -2915,6 +2951,8 @@ syn keyword cmakeKWwrite_file contained
syn keyword cmakeGeneratorExpressions contained
\ AND
\ ANGLE
\ ARCHIVE_OUTPUT_NAME
\ ARCHIVE_OUTPUT_NAME_
\ BAR
\ BOOL
\ BUILD_INTERFACE
@@ -2924,8 +2962,11 @@ syn keyword cmakeGeneratorExpressions contained
\ COMPILE_DEFINITIONS
\ COMPILE_FEATURES
\ COMPILE_LANGUAGE
\ COMPILE_LANG_AND_ID
\ COMPILING_CUDA
\ COMPILING_CXX
\ COMPILING_CXX_WITH_CLANG
\ COMPILING_CXX_WITH_INTEL
\ COMPILING_C_WITH_CLANG
\ CONFIG
\ CONFIGURATION
\ CUDA_COMPILER_ID
@@ -2938,14 +2979,19 @@ syn keyword cmakeGeneratorExpressions contained
\ C_COMPILER_VERSION
\ C_STANDARD
\ DEBUG_MODE
\ DEBUG_POSTFIX
\ EXCLUDE
\ EXPORT
\ FALSE
\ FILTER
\ FOO_EXTRA_THINGS
\ GENERATE
\ GENEX_EVAL
\ GNU
\ IF
\ IGNORE
\ IMPORT_PREFIX
\ IMPORT_SUFFIX
\ INCLUDE_DIRECTORIES
\ INSTALL_INTERFACE
\ INSTALL_PREFIX
@@ -2953,6 +2999,9 @@ syn keyword cmakeGeneratorExpressions contained
\ IN_LIST
\ JOIN
\ LANG
\ LANG_COMPILER_ID
\ LIBRARY_OUTPUT_NAME
\ LIBRARY_OUTPUT_NAME_
\ LINK_LIBRARIES
\ LINK_ONLY
\ LOWER_CASE
@@ -2960,9 +3009,10 @@ syn keyword cmakeGeneratorExpressions contained
\ MAP_IMPORTED_CONFIG_
\ NO
\ NOT
\ OBJECT_LIBRARY
\ OFF
\ OLD_COMPILER
\ OUTPUT_NAME
\ OUTPUT_NAME_
\ PDB_NAME
\ PDB_NAME_
\ PDB_OUTPUT_DIRECTORY
@@ -2971,6 +3021,9 @@ syn keyword cmakeGeneratorExpressions contained
\ POSIX
\ PRIVATE
\ PUBLIC
\ REMOVE_DUPLICATES
\ RUNTIME_OUTPUT_NAME
\ RUNTIME_OUTPUT_NAME_
\ SDK
\ SEMICOLON
\ SHELL_PATH
@@ -2979,15 +3032,22 @@ syn keyword cmakeGeneratorExpressions contained
\ TARGET_BUNDLE_DIR
\ TARGET_EXISTS
\ TARGET_FILE
\ TARGET_FILE_BASE_NAME
\ TARGET_FILE_DIR
\ TARGET_FILE_NAME
\ TARGET_FILE_PREFIX
\ TARGET_FILE_SUFFIX
\ TARGET_GENEX_EVAL
\ TARGET_LINKER_FILE
\ TARGET_LINKER_FILE_BASE_NAME
\ TARGET_LINKER_FILE_DIR
\ TARGET_LINKER_FILE_NAME
\ TARGET_LINKER_FILE_PREFIX
\ TARGET_LINKER_FILE_SUFFIX
\ TARGET_NAME_IF_EXISTS
\ TARGET_OBJECTS
\ TARGET_PDB_FILE
\ TARGET_PDB_FILE_BASE_NAME
\ TARGET_PDB_FILE_DIR
\ TARGET_PDB_FILE_NAME
\ TARGET_POLICY
@@ -3001,6 +3061,7 @@ syn keyword cmakeGeneratorExpressions contained
\ VERSION_GREATER_EQUAL
\ VERSION_LESS
\ VERSION_LESS_EQUAL
\ _POSTFIX
syn case ignore

577
syntax/d.vim Normal file
View File

@@ -0,0 +1,577 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dlang') != -1
finish
endif
" Vim syntax file for the D programming language (version 1.076 and 2.069).
"
" Language: D
" Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
" Last Change: 2016 Feb 2
" Version: 0.28
"
" Please submit bugs/comments/suggestions to the github repo:
" https://github.com/JesseKPhillips/d.vim
"
" Options:
" d_comment_strings - Set to highlight strings and numbers in comments.
"
" d_hl_operator_overload - Set to highlight D's specially named functions
" that when overloaded implement unary and binary operators (e.g. opCmp).
"
" d_hl_object_types - Set to highlight some common types from object.di.
"load the ddoc syntax
runtime! /syntax/ddoc.vim
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" Support cpoptions
let s:cpo_save = &cpo
set cpo&vim
" Set the current syntax to be known as d
let b:current_syntax = "d"
" Keyword definitions
"
syn keyword dExternal contained import module
syn keyword dAssert assert
syn keyword dConditional if else switch
syn keyword dBranch goto break continue
syn keyword dRepeat while for do foreach foreach_reverse
syn keyword dBoolean true false
syn keyword dConstant null
syn keyword dConstant __FILE__ __LINE__ __EOF__ __VERSION__
syn keyword dConstant __DATE__ __TIME__ __TIMESTAMP__ __VENDOR__
syn keyword dConstant __MODULE__ __FUNCTION__ __PRETTY_FUNCTION__
syn keyword dTypedef alias typedef
syn keyword dStructure template interface class struct union
syn keyword dEnum enum
syn keyword dOperator new delete typeof typeid cast align is
syn keyword dOperator this super
if exists("d_hl_operator_overload")
syn keyword dOpOverload opNeg opCom opPostInc opPostDec opCast opAdd
syn keyword dOpOverload opSub opSub_r opMul opDiv opDiv_r opMod
syn keyword dOpOverload opMod_r opAnd opOr opXor opShl opShl_r opShr
syn keyword dOpOverload opShr_r opUShr opUShr_r opCat
syn keyword dOpOverload opCat_r opEquals opCmp
syn keyword dOpOverload opAssign opAddAssign opSubAssign opMulAssign
syn keyword dOpOverload opDivAssign opModAssign opAndAssign
syn keyword dOpOverload opOrAssign opXorAssign opShlAssign
syn keyword dOpOverload opShrAssign opUShrAssign opCatAssign
syn keyword dOpOverload opIndex opIndexAssign opIndexOpAssign
syn keyword dOpOverload opCall opSlice opSliceAssign opSliceOpAssign
syn keyword dOpOverload opPos opAdd_r opMul_r opAnd_r opOr_r opXor_r
syn keyword dOpOverload opIn opIn_r opPow opDispatch opStar opDot
syn keyword dOpOverload opApply opApplyReverse opDollar
syn keyword dOpOverload opUnary opIndexUnary opSliceUnary
syn keyword dOpOverload opBinary opBinaryRight
endif
syn keyword dType byte ubyte short ushort int uint long ulong cent ucent
syn keyword dType void bool Object
syn keyword dType float double real
syn keyword dType ushort int uint long ulong float
syn keyword dType char wchar dchar string wstring dstring
syn keyword dType ireal ifloat idouble creal cfloat cdouble
syn keyword dType size_t ptrdiff_t sizediff_t equals_t hash_t
if exists("d_hl_object_types")
syn keyword dType Object Throwable AssociativeArray Error Exception
syn keyword dType Interface OffsetTypeInfo TypeInfo TypeInfo_Typedef
syn keyword dType TypeInfo_Enum TypeInfo_Pointer TypeInfo_Array
syn keyword dType TypeInfo_StaticArray TypeInfo_AssociativeArray
syn keyword dType TypeInfo_Function TypeInfo_Delegate TypeInfo_Class
syn keyword dType ClassInfo TypeInfo_Interface TypeInfo_Struct
syn keyword dType TypeInfo_Tuple TypeInfo_Const TypeInfo_Invariant
syn keyword dType TypeInfo_Shared TypeInfo_Inout MemberInfo
syn keyword dType MemberInfo_field MemberInfo_function ModuleInfo
endif
syn keyword dDebug deprecated unittest invariant
syn keyword dExceptions throw try catch finally
syn keyword dScopeDecl public protected private export package
syn keyword dStatement debug return with
syn keyword dStatement function delegate __ctfe mixin macro __simd
syn keyword dStatement in out body
syn keyword dStorageClass contained in out scope
syn keyword dStorageClass inout ref lazy pure nothrow
syn keyword dStorageClass auto static override final abstract volatile
syn keyword dStorageClass __gshared __vector
syn keyword dStorageClass synchronized shared immutable const lazy
syn keyword dIdentifier _arguments _argptr __vptr __monitor
syn keyword dIdentifier _ctor _dtor __argTypes __overloadset
syn keyword dScopeIdentifier contained exit success failure
syn keyword dTraitsIdentifier contained isAbstractClass isArithmetic
syn keyword dTraitsIdentifier contained isAssociativeArray isFinalClass
syn keyword dTraitsIdentifier contained isPOD isNested isFloating
syn keyword dTraitsIdentifier contained isIntegral isScalar isStaticArray
syn keyword dTraitsIdentifier contained isUnsigned isVirtualFunction
syn keyword dTraitsIdentifier contained isVirtualMethod isAbstractFunction
syn keyword dTraitsIdentifier contained isFinalFunction isStaticFunction
syn keyword dTraitsIdentifier contained isOverrideFunction isTemplate
syn keyword dTraitsIdentifier contained isRef isOut isLazy hasMember
syn keyword dTraitsIdentifier contained identifier getAliasThis
syn keyword dTraitsIdentifier contained getAttributes getFunctionAttributes getMember
syn keyword dTraitsIdentifier contained getOverloads getPointerBitmap getProtection
syn keyword dTraitsIdentifier contained getVirtualFunctions getVirtualIndex
syn keyword dTraitsIdentifier contained getVirtualMethods getUnitTests
syn keyword dTraitsIdentifier contained parent classInstanceSize allMembers
syn keyword dTraitsIdentifier contained derivedMembers isSame compiles
syn keyword dPragmaIdentifier contained inline lib mangle msg startaddress GNU_asm
syn keyword dExternIdentifier contained C C++ D Windows Pascal System Objective-C
syn keyword dAttribute contained safe trusted system
syn keyword dAttribute contained property disable nogc
syn keyword dVersionIdentifier contained DigitalMars GNU LDC SDC D_NET
syn keyword dVersionIdentifier contained X86 X86_64 ARM PPC PPC64 IA64 MIPS MIPS64 Alpha
syn keyword dVersionIdentifier contained SPARC SPARC64 S390 S390X HPPA HPPA64 SH SH64
syn keyword dVersionIdentifier contained linux Posix OSX FreeBSD Windows Win32 Win64
syn keyword dVersionIdentifier contained OpenBSD BSD Solaris AIX SkyOS SysV3 SysV4 Hurd
syn keyword dVersionIdentifier contained Cygwin MinGW
syn keyword dVersionIdentifier contained LittleEndian BigEndian
syn keyword dVersionIdentifier contained D_InlineAsm_X86 D_InlineAsm_X86_64
syn keyword dVersionIdentifier contained D_Version2 D_Coverage D_Ddoc D_LP64 D_PIC
syn keyword dVersionIdentifier contained unittest assert none all
syn cluster dComment contains=dNestedComment,dBlockComment,dLineComment
" Highlight the sharpbang
syn match dSharpBang "\%^#!.*" display
" Attributes/annotations
syn match dAnnotation "@[_$a-zA-Z][_$a-zA-Z0-9_]*\>" contains=dAttribute
" Version Identifiers
syn match dVersion "\<version\>"
syn match dVersion "\<version\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+7 contains=dVersionIdentifier
" Scope Identifiers
syn match dStatement "\<scope\>"
syn match dStatement "\<scope\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+5 contains=dScopeIdentifier
" Traits Statement
syn match dStatement "\<__traits\>"
syn match dStatement "\<__traits\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+8 contains=dTraitsIdentifier
" Pragma Statement
syn match dPragma "\<pragma\>"
syn match dPragma "\<pragma\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+6 contains=dPragmaIdentifier
" Necessary to highlight C++ in extern modifiers.
syn match dExternIdentifier "C\(++\)\?" contained
" Extern Identifiers
syn match dExternal "\<extern\>"
syn match dExtern "\<extern\s*([_a-zA-Z][_a-zA-Z0-9\+]*\>"he=s+6 contains=dExternIdentifier
" Make import a region to prevent highlighting keywords
syn region dImport start="\<import\_s" end=";" contains=dExternal,@dComment
" Make module a region to prevent highlighting keywords
syn region dImport start="\<module\_s" end=";" contains=dExternal,@dComment
" dTokens is used by the token string highlighting
syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean
syn cluster dTokens add=dConstant,dTypedef,dStructure,dOperator,dOpOverload
syn cluster dTokens add=dType,dDebug,dExceptions,dScopeDecl,dStatement
syn cluster dTokens add=dStorageClass,dPragma,dAssert,dAnnotation,dEnum
syn cluster dTokens add=dParenString,dBrackString,dAngleString,dCurlyString
syn cluster dTokens add=dTokenString,dDelimString,dHereString
" Create a match for parameter lists to identify storage class
syn region paramlist start="(" end=")" contains=@dTokens
" Labels
"
" We contain dScopeDecl so public: private: etc. are not highlighted like labels
syn match dUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=dLabel,dScopeDecl,dEnum
syn keyword dLabel case default
syn cluster dTokens add=dUserLabel,dLabel
" Comments
"
syn match dCommentError display "\*/"
syn match dNestedCommentError display "+/"
syn keyword dTodo contained TODO FIXME TEMP REFACTOR REVIEW HACK BUG XXX
syn match dCommentStar contained "^\s*\*[^/]"me=e-1
syn match dCommentStar contained "^\s*\*$"
syn match dCommentPlus contained "^\s*+[^/]"me=e-1
syn match dCommentPlus contained "^\s*+$"
if exists("d_comment_strings")
syn region dBlockCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@Spell
syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@Spell
syn region dLineCommentString contained start=+"+ end=+$\|"+ contains=dUnicode,dEscSequence,@Spell
endif
syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,dCommentStartError,@Spell fold
syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold
syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
syn cluster ddocComment contains=ddocBlockComment,ddocNestedComment,ddocLineComment
syn region ddocBlockComment start="/\*\*" end="\*/" contains=dBlockCommentString,dTodo,dCommentStartError,@Spell fold
syn region ddocNestedComment start="/++" end="+/" contains=ddocNestedComment,dNestedCommentString,dTodo,@Spell fold
syn match ddocLineComment "///.*" contains=dLineCommentString,dTodo,@Spell
hi link dLineCommentString dBlockCommentString
hi link dBlockCommentString dString
hi link dNestedCommentString dString
hi link dCommentStar dBlockComment
hi link dCommentPlus dNestedComment
syn cluster dTokens add=dBlockComment,dNestedComment,dLineComment,ddocBlockComment,ddocNestedComment,ddocLineComment
" /+ +/ style comments and strings that span multiple lines can cause
" problems. To play it safe, set minlines to a large number.
syn sync minlines=200
" Use ccomment for /* */ style comments
syn sync ccomment dBlockComment
" Characters
"
syn match dSpecialCharError contained "[^']"
" Escape sequences (oct,specal char,hex,wchar, character entities \&xxx;)
" These are not contained because they are considered string literals.
syn match dEscSequence "\\\(\o\{1,3}\|[\"\\'\\?ntbrfva]\|u\x\{4}\|U\x\{8}\|x\x\x\)"
syn match dEscSequence "\\&[^;& \t]\+;"
syn match dCharacter "'[^']*'" contains=dEscSequence,dSpecialCharError
syn match dCharacter "'\\''" contains=dEscSequence
syn match dCharacter "'[^\\]'"
syn cluster dTokens add=dEscSequence,dCharacter
" Unicode characters
"
syn match dUnicode "\\u\d\{4\}"
" String.
"
syn match dFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
syn match dFormat display "%%" contained
syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dFormat,dEscSequence,@Spell
syn region dRawString start=+`+ end=+`[cwd]\=+ contains=@Spell
syn region dRawString start=+r"+ end=+"[cwd]\=+ contains=@Spell
syn region dHexString start=+x"+ end=+"[cwd]\=+ contains=@Spell
syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ contains=@Spell
syn region dHereString start=+q"\z(\I\i*\)\n+ end=+^\z1"+ contains=@Spell
" Nesting delimited string contents
"
syn region dNestParenString start=+(+ end=+)+ contained transparent contains=dNestParenString,@Spell
syn region dNestBrackString start=+\[+ end=+\]+ contained transparent contains=dNestBrackString,@Spell
syn region dNestAngleString start=+<+ end=+>+ contained transparent contains=dNestAngleString,@Spell
syn region dNestCurlyString start=+{+ end=+}+ contained transparent contains=dNestCurlyString,@Spell
" Nesting delimited strings
"
syn region dParenString matchgroup=dParenString start=+q"(+ end=+)"+ contains=dNestParenString,@Spell
syn region dBrackString matchgroup=dBrackString start=+q"\[+ end=+\]"+ contains=dNestBrackString,@Spell
syn region dAngleString matchgroup=dAngleString start=+q"<+ end=+>"+ contains=dNestAngleString,@Spell
syn region dCurlyString matchgroup=dCurlyString start=+q"{+ end=+}"+ contains=dNestCurlyString,@Spell
hi link dParenString dNestString
hi link dBrackString dNestString
hi link dAngleString dNestString
hi link dCurlyString dNestString
syn cluster dTokens add=dString,dRawString,dHexString,dDelimString,dNestString
" Token strings
"
syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens,dFormat
syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens,dFormat
syn cluster dTokens add=dTokenString
" Numbers
"
syn case ignore
syn match dDec display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>"
" Hex number
syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>"
syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>"
" flag an octal number with wrong digits
syn match dOctalError display "\<0[0-7_]*[89][0-9_]*"
" binary numbers
syn match dBinary display "\<0b[01_]\+\(u\=l\=\|l\=u\=\)\>"
"floating point without the dot
syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>"
"floating point number, with dot, optional exponent
syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\="
"floating point number, starting with a dot, optional exponent
syn match dFloat display "\(\.[0-9_]\+\)\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=\>"
"floating point number, without dot, with exponent
"syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>"
syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>"
"floating point without the dot
syn match dHexFloat display "\<0x[0-9a-f_]\+\(fi\=\|l\=i\)\>"
"floating point number, with dot, optional exponent
syn match dHexFloat display "\<0x[0-9a-f_]\+\.[0-9a-f_]*\(p[-+]\=[0-9_]\+\)\=[fl]\=i\="
"floating point number, without dot, with exponent
syn match dHexFloat display "\<0x[0-9a-f_]\+p[-+]\=[0-9_]\+[fl]\=i\=\>"
syn cluster dTokens add=dDec,dHex,dOctal,dOctalError,dBinary,dFloat,dHexFloat
syn case match
" Pragma (preprocessor) support
" TODO: Highlight following Integer and optional Filespec.
syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$"
" Block
"
syn region dBlock start="{" end="}" transparent fold
" The default highlighting.
"
hi def link dBinary Number
hi def link dDec Number
hi def link dHex Number
hi def link dOctal Number
hi def link dFloat Float
hi def link dHexFloat Float
hi def link dDebug Debug
hi def link dBranch Conditional
hi def link dConditional Conditional
hi def link dLabel Label
hi def link dUserLabel Label
hi def link dRepeat Repeat
hi def link dExceptions Exception
hi def link dAssert Statement
hi def link dStatement Statement
hi def link dScopeDecl dStorageClass
hi def link dStorageClass StorageClass
hi def link dBoolean Boolean
hi def link dUnicode Special
hi def link dTokenStringBrack String
hi def link dHereString String
hi def link dNestString String
hi def link dDelimString String
hi def link dRawString String
hi def link dString String
hi def link dHexString String
hi def link dCharacter Character
hi def link dEscSequence SpecialChar
hi def link dFormat SpecialChar
hi def link dSpecialCharError Error
hi def link dOctalError Error
hi def link dOperator Operator
hi def link dOpOverload Identifier
hi def link dConstant Constant
hi def link dTypedef Typedef
hi def link dEnum Structure
hi def link dStructure Structure
hi def link dTodo Todo
hi def link dType Type
hi def link dLineComment Comment
hi def link dBlockComment Comment
hi def link dNestedComment Comment
hi def link ddocLineComment Comment
hi def link ddocBlockComment Comment
hi def link ddocNestedComment Comment
hi def link dCommentError Error
hi def link dNestedCommentError Error
hi def link dCommentStartError Error
hi def link dExternal Include
hi def link dAnnotation PreProc
hi def link dSharpBang PreProc
hi def link dAttribute StorageClass
hi def link dIdentifier Identifier
hi def link dVersion dStatement
hi def link dVersionIdentifier Identifier
hi def link dScopeIdentifier Identifier
hi def link dTraitsIdentifier Identifier
hi def link dPragma PreProc
hi def link dPragmaIdentifier Identifier
hi def link dExtern dExternal
hi def link dExternIdentifier Identifier
" Marks contents of the asm statement body as special
syn match dAsmStatement "\<asm\>"
syn region dAsmBody start="asm[\n]*\s*{"hs=e+1 end="}"he=e-1 contains=dAsmStatement,dAsmOpCode,@dComment,DUserLabel
hi def link dAsmBody dUnicode
hi def link dAsmStatement dStatement
hi def link dAsmOpCode Identifier
syn keyword dAsmOpCode contained aaa aad aam aas
syn keyword dAsmOpCode contained add addpd addps addsd
syn keyword dAsmOpCode contained and andnpd andnps andpd
syn keyword dAsmOpCode contained arpl bound bsf bsr
syn keyword dAsmOpCode contained bt btc btr bts
syn keyword dAsmOpCode contained call bswap andps addss
syn keyword dAsmOpCode contained cbw cdq clc cld
syn keyword dAsmOpCode contained cli clts cmc cmova
syn keyword dAsmOpCode contained cmovb cmovbe cmovc cmove
syn keyword dAsmOpCode contained cmovge cmovl cmovle cmovna
syn keyword dAsmOpCode contained cmovnae cmovg cmovae clflush
syn keyword dAsmOpCode contained cmovnb cmovnbe cmovnc cmovne
syn keyword dAsmOpCode contained cmovnge cmovnl cmovnle cmovno
syn keyword dAsmOpCode contained cmovns cmovnz cmovo cmovp
syn keyword dAsmOpCode contained cmovpo cmovs cmovz cmp
syn keyword dAsmOpCode contained cmppd cmovpe cmovnp cmovng
syn keyword dAsmOpCode contained cmpps cmps cmpsb cmpsd
syn keyword dAsmOpCode contained cmpsw cmpxch8b cmpxchg comisd
syn keyword dAsmOpCode contained cpuid cvtdq2pd cvtdq2ps cvtpd2dq
syn keyword dAsmOpCode contained cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq
syn keyword dAsmOpCode contained cvtps2pd cvtpd2pi comiss cmpss
syn keyword dAsmOpCode contained cvtps2pi cvtsd2si cvtsd2ss cvtsi2sd
syn keyword dAsmOpCode contained cvtss2sd cvtss2si cvttpd2dq cvttpd2pi
syn keyword dAsmOpCode contained cvttps2pi cvttsd2si cvttss2si cwd
syn keyword dAsmOpCode contained da daa das db
syn keyword dAsmOpCode contained dd cwde cvttps2dq cvtsi2ss
syn keyword dAsmOpCode contained de dec df di
syn keyword dAsmOpCode contained divpd divps divsd divss
syn keyword dAsmOpCode contained dq ds dt dw
syn keyword dAsmOpCode contained enter f2xm1 fabs fadd
syn keyword dAsmOpCode contained faddp emms dl div
syn keyword dAsmOpCode contained fbld fbstp fchs fclex
syn keyword dAsmOpCode contained fcmovbe fcmove fcmovnb fcmovnbe
syn keyword dAsmOpCode contained fcmovnu fcmovu fcom fcomi
syn keyword dAsmOpCode contained fcomp fcompp fcos fdecstp
syn keyword dAsmOpCode contained fdisi fcomip fcmovne fcmovb
syn keyword dAsmOpCode contained fdiv fdivp fdivr fdivrp
syn keyword dAsmOpCode contained ffree fiadd ficom ficomp
syn keyword dAsmOpCode contained fidivr fild fimul fincstp
syn keyword dAsmOpCode contained fist fistp fisub fisubr
syn keyword dAsmOpCode contained fld finit fidiv feni
syn keyword dAsmOpCode contained fld1 fldcw fldenv fldl2e
syn keyword dAsmOpCode contained fldlg2 fldln2 fldpi fldz
syn keyword dAsmOpCode contained fmulp fnclex fndisi fneni
syn keyword dAsmOpCode contained fnop fnsave fnstcw fnstenv
syn keyword dAsmOpCode contained fnstsw fninit fmul fldl2t
syn keyword dAsmOpCode contained fpatan fprem fprem1 fptan
syn keyword dAsmOpCode contained frstor fsave fscale fsetpm
syn keyword dAsmOpCode contained fsincos fsqrt fst fstcw
syn keyword dAsmOpCode contained fstp fstsw fsub fsubp
syn keyword dAsmOpCode contained fsubr fstenv fsin frndint
syn keyword dAsmOpCode contained fsubrp ftst fucom fucomi
syn keyword dAsmOpCode contained fucomp fucompp fwait fxam
syn keyword dAsmOpCode contained fxrstor fxsave fxtract fyl2x
syn keyword dAsmOpCode contained hlt idiv imul in
syn keyword dAsmOpCode contained inc fyl2xp1 fxch fucomip
syn keyword dAsmOpCode contained ins insb insd insw
syn keyword dAsmOpCode contained into invd invlpg iret
syn keyword dAsmOpCode contained ja jae jb jbe
syn keyword dAsmOpCode contained jcxz je jecxz jg
syn keyword dAsmOpCode contained jge jc iretd int
syn keyword dAsmOpCode contained jl jle jmp jna
syn keyword dAsmOpCode contained jnb jnbe jnc jne
syn keyword dAsmOpCode contained jnge jnl jnle jno
syn keyword dAsmOpCode contained jns jnz jo jp
syn keyword dAsmOpCode contained jpe jnp jng jnae
syn keyword dAsmOpCode contained jpo js jz lahf
syn keyword dAsmOpCode contained ldmxcsr lds lea leave
syn keyword dAsmOpCode contained lfence lfs lgdt lgs
syn keyword dAsmOpCode contained lldt lmsw lock lods
syn keyword dAsmOpCode contained lodsb lidt les lar
syn keyword dAsmOpCode contained lodsd lodsw loop loope
syn keyword dAsmOpCode contained loopnz loopz lsl lss
syn keyword dAsmOpCode contained maskmovdqu maskmovq maxpd maxps
syn keyword dAsmOpCode contained maxss mfence minpd minps
syn keyword dAsmOpCode contained minsd maxsd ltr loopne
syn keyword dAsmOpCode contained minss mov movapd movaps
syn keyword dAsmOpCode contained movdq2q movdqa movdqu movhlps
syn keyword dAsmOpCode contained movhps movlhps movlpd movlps
syn keyword dAsmOpCode contained movmskps movntdq movnti movntpd
syn keyword dAsmOpCode contained movntps movmskpd movhpd movd
syn keyword dAsmOpCode contained movntq movq movq2dq movs
syn keyword dAsmOpCode contained movsd movss movsw movsx
syn keyword dAsmOpCode contained movups movzx mul mulpd
syn keyword dAsmOpCode contained mulsd mulss neg nop
syn keyword dAsmOpCode contained not mulps movupd movsb
syn keyword dAsmOpCode contained or orpd orps out
syn keyword dAsmOpCode contained outsb outsd outsw packssdw
syn keyword dAsmOpCode contained packuswb paddb paddd paddq
syn keyword dAsmOpCode contained paddsw paddusb paddusw paddw
syn keyword dAsmOpCode contained pand paddsb packsswb outs
syn keyword dAsmOpCode contained pandn pavgb pavgw pcmpeqb
syn keyword dAsmOpCode contained pcmpeqw pcmpgtb pcmpgtd pcmpgtw
syn keyword dAsmOpCode contained pinsrw pmaddwd pmaxsw pmaxub
syn keyword dAsmOpCode contained pminub pmovmskb pmulhuw pmulhw
syn keyword dAsmOpCode contained pmullw pminsw pextrw pcmpeqd
syn keyword dAsmOpCode contained pmuludq pop popa popad
syn keyword dAsmOpCode contained popfd por prefetchnta prefetcht0
syn keyword dAsmOpCode contained prefetcht2 psadbw pshufd pshufhw
syn keyword dAsmOpCode contained pshufw pslld pslldq psllq
syn keyword dAsmOpCode contained psllw pshuflw prefetcht1 popf
syn keyword dAsmOpCode contained psrad psraw psrld psrldq
syn keyword dAsmOpCode contained psrlw psubb psubd psubq
syn keyword dAsmOpCode contained psubsw psubusb psubusw psubw
syn keyword dAsmOpCode contained punpckhdq punpckhqdq punpckhwd punpcklbw
syn keyword dAsmOpCode contained punpckldq punpckhbw psubsb psrlq
syn keyword dAsmOpCode contained punpcklqdq punpcklwd push pusha
syn keyword dAsmOpCode contained pushf pushfd pxor rcl
syn keyword dAsmOpCode contained rcpss rcr rdmsr rdpmc
syn keyword dAsmOpCode contained rep repe repne repnz
syn keyword dAsmOpCode contained repz rdtsc rcpps pushad
syn keyword dAsmOpCode contained ret retf rol ror
syn keyword dAsmOpCode contained rsqrtps rsqrtss sahf sal
syn keyword dAsmOpCode contained sbb scas scasb scasd
syn keyword dAsmOpCode contained seta setae setb setbe
syn keyword dAsmOpCode contained setc scasw sar rsm
syn keyword dAsmOpCode contained sete setg setge setl
syn keyword dAsmOpCode contained setna setnae setnb setnbe
syn keyword dAsmOpCode contained setne setng setnge setnl
syn keyword dAsmOpCode contained setno setnp setns setnz
syn keyword dAsmOpCode contained seto setnle setnc setle
syn keyword dAsmOpCode contained setp setpe setpo sets
syn keyword dAsmOpCode contained sfence sgdt shl shld
syn keyword dAsmOpCode contained shrd shufpd shufps sidt
syn keyword dAsmOpCode contained smsw sqrtpd sqrtps sqrtsd
syn keyword dAsmOpCode contained sqrtss sldt shr setz
syn keyword dAsmOpCode contained stc std sti stmxcsr
syn keyword dAsmOpCode contained stosb stosd stosw str
syn keyword dAsmOpCode contained subpd subps subsd subss
syn keyword dAsmOpCode contained sysexit test ucomisd ucomiss
syn keyword dAsmOpCode contained ud2 sysenter sub stos
syn keyword dAsmOpCode contained unpckhpd unpckhps unpcklpd unpcklps
syn keyword dAsmOpCode contained verw wbinvd wrmsr xadd
syn keyword dAsmOpCode contained xchg xlatb xor xorpd
syn keyword dAsmOpCode contained xorps pfrcpit1 pfmin movddup
syn keyword dAsmOpCode contained addsubpd addsubps fisttp haddps
syn keyword dAsmOpCode contained hsubpd hsubps lddqu monitor
syn keyword dAsmOpCode contained haddpd xlat wait verr
syn keyword dAsmOpCode contained movshdup movsldup mwait pfcmpeq
syn keyword dAsmOpCode contained pavgusb pf2id pfacc pfadd
syn keyword dAsmOpCode contained pfcmpge pfcmpgt pfmax pfmul
syn keyword dAsmOpCode contained pfnacc pfpnacc pfrcp pfrcpit1
syn keyword dAsmOpCode contained pfrsqit1 pfrsqrt pfsub pfsubr
syn keyword dAsmOpCode contained pmulhrw pswapd syscall sysret
syn keyword dAsmOpCode contained vpmuldq xgetbv cmpxchg8b cmpxchg16b
syn keyword dAsmOpCode contained pabsb pabsd pabsw palignr
syn keyword dAsmOpCode contained phaddd phaddsw phaddw phsubd
syn keyword dAsmOpCode contained phsubsw phsubw pmaddubsw pmulhrsw
syn keyword dAsmOpCode contained pshufb psignb psignd psignw
syn keyword dAsmOpCode contained popfq pushfq blendpd blendps
syn keyword dAsmOpCode contained blendvpd blendvps extractps insertps
syn keyword dAsmOpCode contained movntdqa mpsadbw packusdw pblendvb
syn keyword dAsmOpCode contained pblendw pcmpeqq pextrb pextrd
syn keyword dAsmOpCode contained pextrq phminposuw pinsrb pinsrd
syn keyword dAsmOpCode contained pinsrq pmaxsb pmaxsd pmaxud
syn keyword dAsmOpCode contained pmaxuw pminsb pminsd pminud
syn keyword dAsmOpCode contained pminuw pmulld ptest roundpd
syn keyword dAsmOpCode contained roundps roundsd roundss pmuldq
syn keyword dAsmOpCode contained pmovsxbd pmovsxdq pmovzxbq pmovzxdq
syn keyword dAsmOpCode contained pmovsxbq pmovsxwd pmovzxbq pmovzxwd
syn keyword dAsmOpCode contained pmovsxbw pmovsxwq pmovzxbw pmovzxwq
syn keyword dAsmOpCode contained crc32 pcmpestri pcmpestrm pcmpgtq
syn keyword dAsmOpCode contained pcmpistri pcmpistrm popcnt pi2fd
syn keyword dAsmOpCode contained adc
let &cpo = s:cpo_save
unlet s:cpo_save

55
syntax/dcov.vim Normal file
View File

@@ -0,0 +1,55 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dlang') != -1
finish
endif
" Vim syntax file for coverage information for the reference compiler (DMD) of
" the D programming language.
"
" Language: dcov (dlang coverage testing output)
" Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
" Last Change: 2015-07-10
"
" Contributors:
" - Joakim Brannstrom <joakim.brannstrom@gmx.com>
"
" Please submit bugs/comments/suggestions to the github repo:
" https://github.com/JesseKPhillips/d.vim
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" Provide highlight of D code.
runtime! syntax/d.vim
unlet b:current_syntax
" Source lines
syn match dcovCode "^\s*|"
syn match dcovExecuted "^\s*\d\+|"
syn match dcovNotExecuted "^\s*0\+|"
" Coverage statistic
" 0% is critical
" 1-39% is low
" 40-99 is partial
" 100% is complete
syn match dcovFile contained "^.\{-}\s\+\( is \)\@!"
syn match dcovPartial contained "\d\+% cov\w*"
syn match dcovFull contained "100% cov\w*"
syn match dcovLow contained "[1-3]\=\d\=% cov\w*"
syn match dcovNone contained "0% cov\w*"
syn match dcovStat "^\(.\{0,7}|\)\@!.*$" contains=dcovFull,dcovPartial,dcovNone,dcovFile,dcovLow
" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link dcovNotExecuted Constant
hi def link dcovExecuted Type
hi def link dcovCode Comment
hi def link dcovFull PreProc
hi def link dcovFile Identifier
hi def link dcovNone Error
hi def link dcovLow Operator
hi def link dcovPartial Structure
let b:current_syntax = "dcov"

View File

@@ -1,5 +1,5 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'tmux') != -1
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dlang') != -1
finish
endif
setlocal commentstring=#\ %s
runtime! /syntax/ddoc.vim

86
syntax/ddoc.vim Normal file
View File

@@ -0,0 +1,86 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dlang') != -1
finish
endif
if &filetype == "ddoc"
"ddoc file type
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" Support cpoptions
let s:cpo_save = &cpo
set cpo&vim
" Set the current syntax to be known as ddoc
let b:current_syntax = "ddoc"
syn match ddocIdentifier "\$(\zs\a\w*\ze\_W*" display conceal contained
syn match ddocIdentifierDecl "^\s*\zs\a\w*\ze\s*=" display contained
syn region ddocDecl start="^\s*\a\w*\s*=" end="\(\n\_^\s*\_$\|\n^\s*\a\w*\s*=\)" transparent fold contains=ddocIdentifierDecl,ddocIdentifier
"use html comment when fold method is marker
set commentstring=<!--%s-->
hi! def link ddocIdentifier Macro
hi! def link ddocIdentifierDecl Macro
let &cpo = s:cpo_save
unlet s:cpo_save
elseif &filetype == "dd" || &filetype == "d" && getline(1) =~ "^Ddoc"
"Ddoc source file or .d File begining with Ddoc
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" Support cpoptions
let s:cpo_save = &cpo
set cpo&vim
" Set the current syntax to be known as ddoc
let b:current_syntax = "ddoc"
syn match ddocKeyword "\%^Ddoc" display
syn keyword ddocKeyword MACROS contained
syn match ddocIdentifier "\$(\zs\a\w*\ze\_W*" display conceal
syn match ddocIdentifierDecl "^\s*\zs\a\w*\ze\s*=" display contained
"can slow down to much
"syn match ddocIdentifierDecl "\(^\s*MACROS:\s\+\)\@<=\zs\a\w*\ze\s*=" display contained
syn region ddocDecl start="^\s*MACROS:\_s\+" end="\%$" transparent fold contains=ddocKeyword,ddocIdentifierDecl,ddocIdentifier
"use html comment when fold method is marker
set commentstring=<!--%s-->
" highlight only ddoc Identifiers
hi! def link ddocIdentifier Macro
hi! def link ddocIdentifierDecl Macro
hi! def link ddocKeyword Macro
let &cpo = s:cpo_save
unlet s:cpo_save
finish
elseif &filetype == "d"
"Ddoc inside comments
syn keyword ddocKeyword MACROS contained
syn match ddocIdentifier "\$(\zs\a\w*\ze\_W*" display contained conceal containedin=@ddocComment
syn match ddocIdentifierBlockDecl "^\*\=\s*\a\w*\ze\s*=" display contained
"can slow down to much
"syn match ddocIdentifierBlockDecl "\(^*\=\s*MACROS:\s\+\)\@<=\zs\a\w*\ze\s*=" display contained
syn region ddocBlockDecl start="^\*\=\s*\zsMACROS:\_s\+" end="\ze\*/" transparent fold contained containedin=ddocBlockComment contains=ddocKeyword,ddocIdentifierBlockDecl,ddocIdentifier
syn match ddocIdentifierNestedDecl "^+\=\s*\a\w*\ze\s*=" display contained
"can slow down to much
"syn match ddocIdentifierNestedDecl "\(^+\=\s*MACROS:\s\+\)\@<=\zs\a\w*\ze\s*=" display contained
syn region ddocNestedDecl start="^+\=\s*\zsMACROS:\_s\+" end="\ze+/" transparent fold contained containedin=ddocNestedComment contains=ddocKeyword,ddocIdentifierNestedDecl,ddocIdentifier
"reset to default commentstring
set commentstring=/*%s*/
hi! def link ddocIdentifier Macro
hi! def link ddocIdentifierBlockDecl Macro
hi! def link ddocIdentifierNestedDecl Macro
hi! def link ddocKeyword Macro
endif

94
syntax/dsdl.vim Normal file
View File

@@ -0,0 +1,94 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dlang') != -1
finish
endif
" Vim syntax file for DUB configurations."
"
" Language: SDLang (dub config)
" Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
" Last Change: 2015-07-11
"
" Contributors:
" - Joakim Brannstrom <joakim.brannstrom@gmx.com>
"
" Please submit bugs/comments/suggestions to the github repo:
" https://github.com/JesseKPhillips/d.vim
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" General matchers
syn match dsdlAssign contained "="
syn match dsdlAttribute "\w*\s*=" contains=dsdlAssign
syn match dsdlStatement "^\s*[a-zA-Z:]*"
" Keyword grouping
syn keyword dsdlInfo name description copyright authors license
syn keyword dsdlStructure buildRequirements buildType configuration
syn keyword dsdlBoolean true false on off
syn keyword dsdlTodo contained TODO FIXME XXX
" dsdlCommentGroup allows adding matches for special things in comments
syn cluster dsdlCommentGroup contains=dsdlTodo
" Highlight % items in strings.
syn match dsdlFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
" dsdlCppString: same as dsdlString, but ends at end of line
syn region dsdlString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,dsdlFormat,@Spell extend
syn region dsdlCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,dsdlFormat,@Spell
syn cluster dsdlStringGroup contains=dsdlCppString
" Comments
syn region dsdlCommentL start="//" skip="\\$" end="$" keepend contains=@dsdlCommentGroup,cSpaceError,@Spell
syn region dsdlComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@dsdlCommentGroup,dsdlCommentStartError,cSpaceError,@Spell fold extend
" keep a // comment separately, it terminates a preproc. conditional
syn match dsdlCommentError display "\*/"
syn match dsdlCommentStartError display "/\*"me=e-1 contained
"integer number, or floating point number without a dot and with "f".
syn case ignore
syn match dsdlNumbers display transparent "\<\d\|\.\d" contains=dsdlNumber,dsdlFloat,cOctalError,dsdlOctal
" Same, but without octal error (for comments)
syn match dsdlNumbersCom display contained transparent "\<\d\|\.\d" contains=dsdlNumber,dsdlFloat,dsdlOctal
syn match dsdlNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
"hex number
syn match dsdlNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
" Flag the first zero of an octal number as something special
syn match dsdlOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=dsdlOctalZero
syn match dsdlOctalZero display contained "\<0"
syn match dsdlFloat display contained "\d\+f"
"floating point number, with dot, optional exponent
syn match dsdlFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
"floating point number, starting with a dot, optional exponent
syn match dsdlFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
"floating point number, without dot, with exponent
syn match dsdlFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
syn case match
" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link dsdlInfo Constant
hi def link dsdlAssign Special
hi def link dsdlBoolean Boolean
hi def link dsdlFormat SpecialChar
hi def link dsdlCppString dsdlString
hi def link dsdlCommentL dsdlComment
hi def link dsdlNumber Number
hi def link dsdlOctal Number
hi def link dsdlOctalZero PreProc " link this to Error if you want
hi def link dsdlFloat Float
hi def link dsdlCommentError Error
hi def link dsdlCommentStartError Error
hi def link dsdlStructure Structure
hi def link dsdlString String
hi def link dsdlComment Comment
hi def link dsdlTodo Todo
hi def link dsdlStatement Statement
hi def link dsdlAttribute Tag
let b:current_syntax = "dsdl"

View File

@@ -43,12 +43,12 @@ syn match elixirOperator '\.\.\|\.'
syn match elixirOperator "\^\^\^\|\^"
syn match elixirOperator '\\\\\|::\|\*\|/\|\~\~\~\|@'
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*\%(\.[A-Z]\w*\)*'
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*'
syn keyword elixirBoolean true false nil
syn match elixirVariable '@[a-z]\w*'

48
syntax/hcl.vim Normal file
View File

@@ -0,0 +1,48 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hcl') != -1
finish
endif
if exists("b:current_syntax")
finish
endif
syn match hclEqual '='
syn match hclSimpleString '"[^\"]*"'
syn region hclComment display oneline start='\%\(^\|\s\)#' end='$'
syn region hclComment display oneline start='\%\(^\|\s\)//' end='$'
syn region hclInterpolation display oneline start='(' end=')' contains=hclInterpolation,hclSimpleString
syn region hclSmartString display oneline start='"' end='"\s*$' contains=hclInterpolation
syn keyword hclRootKeywords variable provider resource nextgroup=hclString,hclString skipwhite
syn keyword hclRootKeywords default nextgroup=hclEquals skipwhite
syn keyword hclAwsResourcesKeywords availability_zones desired_capacity force_delete health_check_grace_period health_check_type launch_configuration load_balancers max_size min_size name vpc_zone_identifier nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords allocated_storage availability_zone backup_retention_period backup_window db_subnet_group_name engine engine_version final_snapshot_identifier identifier instance_class iops maintenance_window multi_az name password port publicly_accessible security_group_names skip_final_snapshot username vpc_security_group_ids nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords cidr description ingress name security_group_id security_group_name security_group_owner_id source_security_group_id nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords description name subnet_ids nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords instance vpc nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords availability_zones health_check healthy_threshold instance_port instance_protocol instances internal interval lb_port lb_protocol listener name security_groups ssl_certificate_id subnets target timeout unhealthy_threshold nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords ami associate_public_ip_address availability_zone ebs_optimized iam_instance_profile instance_type key_name private_ip security_groups source_dest_check subnet_id tags user_data nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords vpc_id nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords iam_instance_profile image_id instance_type key_name name name_prefix security_groups user_data nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords name records ttl type zone_id nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords name nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords route_table_id subnet_id nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords cidr_block gateway_id instance_id route vpc_id nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords acl bucket nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords cidr_blocks description from_port ingress name owner_id protocol security_groups self tags to_port vpc_id nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords availability_zone- cidr_block map_public_ip_on_launch vpc_id nextgroup=hclEquals,hclString skipwhite
syn keyword hclAwsResourcesKeywords cidr_block enable_dns_hostnames enable_dns_support tags nextgroup=hclEquals,hclString skipwhite
hi def link hclComment Comment
hi def link hclEqual Operator
hi def link hclRootKeywords Statement
hi def link hclAwsResourcesKeywords Type
hi def link hclSmartString String
hi def link hclInterpolation String
hi def link hclSimpleString PreProc
let b:current_syntax = "hcl"

139
syntax/hive.vim Normal file
View File

@@ -0,0 +1,139 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hive') != -1
finish
endif
" Vim syntax file
" Language: HIVE Query Language
" Maintainer: German Lashevich <german.lashevich@gmail.com>
" Last Change: 2019-04-30
if exists("b:current_syntax")
finish
endif
syn case ignore
syn keyword sqlSpecial false null true
syn keyword sqlKeyword access add as asc begin check cluster column
syn keyword sqlKeyword compress connect current cursor decimal default desc
syn keyword sqlKeyword if else elsif end exception exclusive file for from
syn keyword sqlKeyword function having identified immediate increment
syn keyword sqlKeyword index initial into level loop maxextents mode modify
syn keyword sqlKeyword nocompress nowait of offline on online start
syn keyword sqlKeyword successful synonym table partition then to trigger uid
syn keyword sqlKeyword unique user validate values view whenever hivevar
syn keyword sqlKeyword where with option pctfree privileges procedure limit
syn keyword sqlKeyword public resource return row rowlabel rownum rows
syn keyword sqlKeyword session share size smallint type using cross full outer left join right inner
syn keyword sqlKeyword format delimited fields terminated collection items external window msck repair
syn keyword sqlKeyword stored sequencefile partitioned data local inpath overwrite clustered buckets sorted
syn keyword sqlKeyword keys extended textfile location distribute directory tablesample using reduce lateral
syn keyword sqlKeyword case when database serde serdeproperties inputformat outputformat over
syn keyword sqlKeyword unbounded preceding parquet tblproperties
syn keyword sqlKeyword dmin after archive before bucket cascade change
syn keyword sqlKeyword lusterstatus columns compact compactions compute
syn keyword sqlKeyword oncatenate continue databases datetime dbproperties
syn keyword sqlKeyword eferred defined dependency directories disable elem_type
syn keyword sqlKeyword nable escaped export fileformat first formatted
syn keyword sqlKeyword unctions hold_ddltime idxproperties ignore indexes
syn keyword sqlKeyword nputdriver jar key_type lines locks logical long mapjoin
syn keyword sqlKeyword aterialized metadata noscan no_drop outputdriver owner
syn keyword sqlKeyword artitions plus pretty principals protection purge read
syn keyword sqlKeyword eadonly rebuild recordreader recordwriter reload replace
syn keyword sqlKeyword eplication restrict rewrite role roles schema schemas
syn keyword sqlKeyword emi server sets shared show show_database skewed sort
syn keyword sqlKeyword sl statistics streamtable tables temporary touch
syn keyword sqlKeyword ransactions unarchive undo uniontype unlock unset
syn keyword sqlKeyword nsigned uri utc utctimestamp value_type while
syn keyword sqlKeyword uthorization both by conf cube current_timestamp
syn keyword sqlKeyword xchange fetch following group grouping import interval
syn keyword sqlKeyword ess macro more none order partialscan percent preserve
syn keyword sqlKeyword ange reads rollup uniquejoin utc_tmestamp autocommit
syn keyword sqlKeyword solation offset snapshot transaction work write only
syn keyword sqlKeyword bort key last norely novalidate nulls rely cache
syn keyword sqlKeyword onstraint foreign primary references detail dow
syn keyword sqlKeyword xpression operator quarter summary vectorization week
syn keyword sqlKeyword ears months weeks days hours minutes seconds dayofweek
syn keyword sqlKeyword xtract integer precision views timestamptz zone time
syn keyword sqlKeyword umeric sync
syn match sqlKeyword 'group\s\+by'
syn match sqlKeyword 'order\s\+by'
syn keyword sqlOperator not and or < <= == >= > <> != is
syn keyword sqlOperator in any some all between exists
syn keyword sqlOperator like escape rlike regexp
syn keyword sqlOperator union intersect minus
syn keyword sqlOperator prior distinct isnull count
syn keyword sqlOperator sysdate out
syn keyword sqlOperator round floor ceil rand concat substr upper ucase
syn keyword sqlOperator lower lcase trim ltrim rtrim regexp_replace size
syn keyword sqlOperator coalesce cast from_unixtime to_date year month day get_json_object
syn keyword sqlOperator current_date add_months row_number date_format first_value
syn keyword sqlOperator sum avg min max transform
syn keyword sqlOperator variance var_samp stddev_pop stddev_samp
syn keyword sqlOperator covar_pop covar_samp corr percentile percentil_approx
syn keyword sqlOperator histogram_numeric collect_set inline explode
syn keyword sqlOperator exp ln log10 log2 log pow sqrt bin hex unhex conv
syn keyword sqlOperator abs pmod sin asin cos acos tan atan degrees radians
syn keyword sqlOperator positive negative sign e pi binary
syn keyword sqlOperator map_keys map_values array_contains sort_array
syn keyword sqlOperator unix_timestamp dayofmonth hour minute second weekofyear
syn keyword sqlOperator datediff date_add date_sub from_utc_timestamp to_utc_timestamp
syn keyword sqlOperator ascii context_ngrams concate_ws find_in_set format_number
syn keyword sqlOperator in_file instr length locate lpad ltrim ngrams parse_url
syn keyword sqlOperator printf regexp_extract repeat reverse rpad trim sentences
syn keyword sqlOperator space split str_to_map translate trim java_method reflect
syn keyword sqlOperator xpath xpath_string xpath_boolean xpath_short xpath_int xpath_long xpath_float xpath_double xpath_number
syn keyword sqlStatement alter analyze audit comment commit create
syn keyword sqlStatement delete drop execute explain grant insert lock noaudit
syn keyword sqlStatement rename revoke rollback savepoint select set
syn keyword sqlStatement truncate update describe load use
syn keyword sqlType tinyint smallint int bigint float double boolean string
syn keyword sqlType array map struct named_struct create_union timestamp date varchar char
syn match hiveVar "hive\.[a-zA-Z.]\+"
syn match hiveVar "mapred\.[a-zA-Z.]\+"
" Strings and characters:
syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+
syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+
" Numbers:
syn match sqlNumber "[-+]\=\d\+[ISL]\="
" Floating point number with decimal no E or e
syn match sqlNumber '[-+]\=\d\+\.\d\+'
" Floating point like number with E and no decimal point (+,-)
syn match sqlNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+'
syn match sqlNumber '\d[[:digit:]]*[eE][\-+]\=\d\+'
" Floating point like number with E and decimal point (+,-)
syn match sqlNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
syn match sqlNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
" Comments:
syn region sqlComment start="/\*" end="\*/" contains=sqlTodo
syn match sqlComment "--.*$" contains=sqlTodo
syn sync ccomment sqlComment
" Todo
syn keyword sqlTodo contained TODO FIXME XXX DEBUG NOTE
hi link sqlComment Comment
hi link sqlKeyword Identifier
hi link sqlNumber Number
hi link sqlOperator Constant
hi link sqlSpecial Special
hi link sqlStatement Statement
hi link sqlString String
hi link sqlType Type
hi link sqlTodo Todo
hi link hiveVar Special
let b:current_syntax = "hive"
" vim: ts=4

87
syntax/ion.vim Normal file
View File

@@ -0,0 +1,87 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ion') != -1
finish
endif
if v:version < 600
syntax clear
elseif exists('b:current_syntax')
finish
endif
syn region ionDoubleQuote start='"' skip='\'' end='"' contains=ionArrayVar,ionVariable,ionProcess
syn region ionSingleQuote start='\'' skip='"' end='\''
syn region ionArrayVar start="@{" end="}"
syn match ionArrayVar "@[a-zA-Z0-9_]\+"
syn region ionVariable start="${" end="}"
syn match ionVariable "$[a-zA-Z0-9_]\+"
syn region ionProcess start="$(" end=")" transparent
syn region ionProcess start="@(" end=")" transparent
syn match ionNumber '[+-]\?\([0-9]*[.]\)\?[0-9]\+'
syn match ionComment '[#].*$'
syn match ionOperator '&'
syn match ionOperator '&&'
syn match ionOperator '||'
syn match ionOperator '[|<>&]'
syn match ionFlag '[ ]\([-]\)\w\+'
syntax keyword ionKeyword .
syntax keyword ionKeyword ..
syntax keyword ionKeyword alias
syntax keyword ionKeyword and
syntax keyword ionKeyword bg
syntax keyword ionKeyword break
syntax keyword ionKeyword calc
syntax keyword ionKeyword case
syntax keyword ionKeyword cd
syntax keyword ionKeyword complete
syntax keyword ionKeyword continue
syntax keyword ionKeyword count
syntax keyword ionKeyword dirs
syntax keyword ionKeyword disown
syntax keyword ionKeyword drop
syntax keyword ionKeyword echo
syntax keyword ionKeyword else
syntax keyword ionKeyword end
syntax keyword ionKeyword eval
syntax keyword ionKeyword exec
syntax keyword ionKeyword exit
syntax keyword ionKeyword false
syntax keyword ionKeyword fg
syntax keyword ionKeyword fn
syntax keyword ionKeyword for
syntax keyword ionKeyword help
syntax keyword ionKeyword history
syntax keyword ionKeyword if
syntax keyword ionKeyword in
syntax keyword ionKeyword jobs
syntax keyword ionKeyword let
syntax keyword ionKeyword match
syntax keyword ionKeyword matches
syntax keyword ionKeyword mkdir
syntax keyword ionKeyword not
syntax keyword ionKeyword or
syntax keyword ionKeyword popd
syntax keyword ionKeyword pushd
syntax keyword ionKeyword pwd
syntax keyword ionKeyword read
syntax keyword ionKeyword set
syntax keyword ionKeyword source
syntax keyword ionKeyword status
syntax keyword ionKeyword suspend
syntax keyword ionKeyword test
syntax keyword ionKeyword time
syntax keyword ionKeyword true
syntax keyword ionKeyword unalias
syntax keyword ionKeyword wait
syntax keyword ionKeyword while
hi def link ionKeyword Keyword
hi def link ionArrayVar Constant
hi def link ionVariable Identifier
hi def link ionNumber Number
hi def link ionDoubleQuote String
hi def link ionSingleQuote String
hi def link ionProcess PreProc
hi def link ionComment Comment
hi def link ionOperator Operator
hi def link ionFlag Boolean

View File

@@ -5,18 +5,16 @@ endif
" Vim syntax file
" Language: Kotlin
" Maintainer: Alexander Udalov
" Latest Revision: 14 January 2019
" Latest Revision: 26 May 2019
if exists("b:current_syntax")
if exists('b:current_syntax')
finish
endif
let b:current_syntax = "kotlin"
syn keyword ktStatement break continue return
syn keyword ktConditional if else when
syn keyword ktRepeat do for while
syn keyword ktOperator as in is by
syn keyword ktOperator in is by
syn keyword ktKeyword get set out super this where
syn keyword ktException try catch finally throw
@@ -33,6 +31,8 @@ syn keyword ktConstant null
syn keyword ktModifier data tailrec lateinit reified external inline noinline crossinline const operator infix suspend
syn match ktOperator "\v\?:|::|\<\=? | \>\=?|[!=]\=\=?|<as>\??|[-!%&*+/|]"
syn keyword ktTodo TODO FIXME XXX contained
syn match ktShebang "\v^#!.*$"
syn match ktLineComment "\v//.*$" contains=ktTodo,@Spell
@@ -69,48 +69,48 @@ syn match ktEscapedName "\v`.*`"
syn match ktExclExcl "!!"
syn match ktArrow "->"
hi def link ktStatement Statement
hi def link ktConditional Conditional
hi def link ktRepeat Repeat
hi def link ktOperator Operator
hi def link ktKeyword Keyword
hi def link ktException Exception
hi def link ktReservedKeyword Error
hi def link ktInclude Include
hi link ktStatement Statement
hi link ktConditional Conditional
hi link ktRepeat Repeat
hi link ktOperator Operator
hi link ktKeyword Keyword
hi link ktException Exception
hi link ktReservedKeyword Error
hi def link ktType Type
hi def link ktModifier StorageClass
hi def link ktStructure Structure
hi def link ktTypedef Typedef
hi link ktInclude Include
hi def link ktBoolean Boolean
hi def link ktConstant Constant
hi link ktType Type
hi link ktModifier StorageClass
hi link ktStructure Structure
hi link ktTypedef Typedef
hi def link ktTodo Todo
hi def link ktShebang Comment
hi def link ktLineComment Comment
hi def link ktComment Comment
hi def link ktCommentMatchGroup Comment
hi def link ktDocComment Comment
hi def link ktDocTag Special
hi def link ktDocTagParam Identifier
hi link ktBoolean Boolean
hi link ktConstant Constant
hi def link ktSpecialChar SpecialChar
hi def link ktSpecialCharError Error
hi def link ktString String
hi def link ktCharacter Character
hi link ktTodo Todo
hi link ktShebang Comment
hi link ktLineComment Comment
hi link ktComment Comment
hi link ktCommentMatchGroup Comment
hi link ktDocComment Comment
hi link ktDocTag Special
hi link ktDocTagParam Identifier
hi def link ktAnnotation Identifier
hi def link ktLabel Identifier
hi link ktSpecialChar SpecialChar
hi link ktSpecialCharError Error
hi link ktString String
hi link ktCharacter Character
hi def link ktSimpleInterpolation Identifier
hi def link ktComplexInterpolationBrace Identifier
hi link ktAnnotation Identifier
hi link ktLabel Identifier
hi def link ktNumber Number
hi def link ktFloat Float
hi link ktSimpleInterpolation Identifier
hi link ktComplexInterpolationBrace Identifier
hi def link ktExclExcl Special
hi def link ktArrow Structure
hi link ktNumber Number
hi link ktFloat Float
hi link ktExclExcl Special
hi link ktArrow Structure
let b:current_syntax = 'kotlin'

163
syntax/log.vim Normal file
View File

@@ -0,0 +1,163 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'log') != -1
finish
endif
" Vim syntax file
" Language: Generic log file
" Maintainer: MTDL9 <https://github.com/MTDL9>
" Latest Revision: 2019-04-16
if exists('b:current_syntax')
finish
endif
let s:cpo_save = &cpoptions
set cpoptions&vim
" Operators
"---------------------------------------------------------------------------
syn match logOperator display '[;,\?\:\.\<=\>\~\/\@\&\!$\%\&\+\-\|\^(){}\*#]'
syn match logBrackets display '[\[\]]'
syn match logEmptyLines display '-\{3,}'
syn match logEmptyLines display '\*\{3,}'
syn match logEmptyLines display '=\{3,}'
syn match logEmptyLines display '- - '
" Constants
"---------------------------------------------------------------------------
syn match logNumber '\<-\?\d\+\>'
syn match logHexNumber '\<0[xX]\x\+\>'
syn match logHexNumber '\<\d\x\+\>'
syn match logBinaryNumber '\<0[bB][01]\+\>'
syn match logFloatNumber '\<\d.\d\+[eE]\?\>'
syn keyword logBoolean TRUE FALSE True False true false
syn keyword logNull NULL Null null
syn region logString start=/"/ end=/"/ end=/$/ skip=/\\./
" Quoted strings, but no match on quotes like "don't", "plurals' elements"
syn region logString start=/'\(s \|t \| \w\)\@!/ end=/'/ end=/$/ end=/s / skip=/\\./
" Dates and Times
"---------------------------------------------------------------------------
" Matches 2018-03-12T or 12/03/2018 or 12/Mar/2018
syn match logDate '\d\{2,4}[-\/]\(\d\{2}\|Jan\|Feb\|Mar\|Apr\|May\|Jun\|Jul\|Aug\|Sep\|Oct\|Nov\|Dec\)[-\/]\d\{2,4}T\?'
" Matches 8 digit numbers at start of line starting with 20
syn match logDate '^20\d\{6}'
" Matches Fri Jan 09 or Feb 11 or Apr 3
syn match logDate '\(\(Mon\|Tue\|Wed\|Thu\|Fri\|Sat\|Sun\) \)\?\(Jan\|Feb\|Mar\|Apr\|May\|Jun\|Jul\|Aug\|Sep\|Oct\|Nov\|Dec\) [0-9 ]\d'
" Matches 12:09:38 or 00:03:38.129Z or 01:32:12.102938 +0700
syn match logTime '\d\{2}:\d\{2}:\d\{2}\(\.\d\{2,6}\)\?\(\s\?[-+]\d\{2,4}\|Z\)\?\>' nextgroup=logTimeZone,logSysColumns skipwhite
" Follows logTime, matches UTC or PDT 2019 or 2019 EDT
syn match logTimeZone '\(UTC\|PDT\|EDT\|GMT\|EST\|KST\)\( \d\{4}\)\?' contained
syn match logTimeZone '\d\{4} \(UTC\|PDT\|EDT\|GMT\|EST\|KST\)' contained
" Entities
"---------------------------------------------------------------------------
syn match logUrl 'http[s]\?:\/\/[^\n|,; '"]\+'
syn match logDomain /\v(^|\s)(\w|-)+(\.(\w|-)+)+\s/
syn match logUUID '\w\{8}-\w\{4}-\w\{4}-\w\{4}-\w\{12}'
syn match logMD5 '\<[a-z0-9]\{32}\>'
syn match logIPV4 '\<\d\{1,3}\(\.\d\{1,3}\)\{3}\>'
syn match logIPV6 '\<\x\{1,4}\(:\x\{1,4}\)\{7}\>'
syn match logMacAddress '\<\x\{2}\(:\x\{2}\)\{5}'
syn match logFilePath '\<\w:\\[^\n|,; ()'"\]{}]\+'
syn match logFilePath '\/\w[^\n|,; ()'"\]{}]\+'
" Syslog Columns
"---------------------------------------------------------------------------
" Syslog hostname, program and process number columns
syn match logSysColumns '\w\(\w\|\.\|-\)\+ \(\w\|\.\|-\)\+\(\[\d\+\]\)\?:' contains=logOperator,logSysProcess contained
syn match logSysProcess '\(\w\|\.\|-\)\+\(\[\d\+\]\)\?:' contains=logOperator,logNumber,logBrackets contained
" XML Tags
"---------------------------------------------------------------------------
" Simplified matches, not accurate with the spec to avoid false positives
syn match logXmlHeader /<?\(\w\|-\)\+\(\s\+\w\+\(="[^"]*"\|='[^']*'\)\?\)*?>/ contains=logString,logXmlAttribute,logXmlNamespace
syn match logXmlDoctype /<!DOCTYPE[^>]*>/ contains=logString,logXmlAttribute,logXmlNamespace
syn match logXmlTag /<\/\?\(\(\w\|-\)\+:\)\?\(\w\|-\)\+\(\(\n\|\s\)\+\(\(\w\|-\)\+:\)\?\(\w\|-\)\+\(="[^"]*"\|='[^']*'\)\?\)*\s*\/\?>/ contains=logString,logXmlAttribute,logXmlNamespace
syn match logXmlAttribute contained "\w\+=" contains=logOperator
syn match logXmlAttribute contained "\(\n\|\s\)\(\(\w\|-\)\+:\)\?\(\w\|-\)\+\(=\)\?" contains=logXmlNamespace,logOperator
syn match logXmlNamespace contained "\(\w\|-\)\+:" contains=logOperator
syn region logXmlComment start=/<!--/ end=/-->/
syn match logXmlCData /<!\[CDATA\[.*\]\]>/
syn match logXmlEntity /\&\w\+;/
" Levels
"---------------------------------------------------------------------------
syn keyword logLevelEmergency EMERGENCY EMERG
syn keyword logLevelAlert ALERT
syn keyword logLevelCritical CRITICAL CRIT FATAL
syn keyword logLevelError ERROR ERR FAILURE SEVERE
syn keyword logLevelWarning WARNING WARN
syn keyword logLevelNotice NOTICE
syn keyword logLevelInfo INFO
syn keyword logLevelDebug DEBUG FINE
syn keyword logLevelTrace TRACE FINER FINEST
" Highlight links
"---------------------------------------------------------------------------
hi def link logNumber Number
hi def link logHexNumber Number
hi def link logBinaryNumber Number
hi def link logFloatNumber Float
hi def link logBoolean Boolean
hi def link logNull Constant
hi def link logString String
hi def link logDate Identifier
hi def link logTime Function
hi def link logTimeZone Identifier
hi def link logUrl Underlined
hi def link logDomain Label
hi def link logUUID Label
hi def link logMD5 Label
hi def link logIPV4 Label
hi def link logIPV6 ErrorMsg
hi def link logMacAddress Label
hi def link logFilePath Conditional
hi def link logSysColumns Conditional
hi def link logSysProcess Include
hi def link logXmlHeader Function
hi def link logXmlDoctype Function
hi def link logXmlTag Identifier
hi def link logXmlAttribute Type
hi def link logXmlNamespace Include
hi def link logXmlComment Comment
hi def link logXmlCData String
hi def link logXmlEntity Special
hi def link logOperator Operator
hi def link logBrackets Comment
hi def link logEmptyLines Comment
hi def link logLevelEmergency ErrorMsg
hi def link logLevelAlert ErrorMsg
hi def link logLevelCritical ErrorMsg
hi def link logLevelError ErrorMsg
hi def link logLevelWarning WarningMsg
hi def link logLevelNotice Character
hi def link logLevelInfo Repeat
hi def link logLevelDebug Debug
hi def link logLevelTrace Comment
let b:current_syntax = 'log'
let &cpoptions = s:cpo_save
unlet s:cpo_save

View File

@@ -40,6 +40,7 @@ syn region nixInterpolation matchgroup=nixInterpolationDelimiter start="\${" end
syn match nixSimpleStringSpecial /\\\%([nrt"\\$]\|$\)/ contained
syn match nixStringSpecial /''['$]/ contained
syn match nixStringSpecial /\$\$/ contained
syn match nixStringSpecial /''\\[nrt]/ contained
syn match nixInvalidSimpleStringEscape /\\[^nrt"\\$]/ contained

View File

@@ -2,27 +2,27 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'plantuml') != -1
finish
endif
scriptencoding utf-8
" Vim syntax file
" Language: PlantUML
" Maintainer: Anders Thøgersen <first name at bladre dot dk>
" License: VIM LICENSE
if exists('b:current_syntax')
finish
endif
scriptencoding utf-8
if v:version < 600
syntax clear
endif
let s:cpo_orig=&cpo
set cpo&vim
let s:cpo_orig=&cpoptions
set cpoptions&vim
let b:current_syntax = 'plantuml'
syntax sync minlines=100
syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(define|definelong|else|enddefinelong|endif|if|ifdef|ifndef|include|pragma|undef\)\s*.*/ contains=plantumlDir
syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(define\|definelong\|else\|enddefinelong\|endif\|exit\|if\|ifdef\|ifndef\|include\|pragma\|undef\)\s*.*/ contains=plantumlDir
syntax region plantumlDir start=/\s\+/ms=s+1 end=/$/ contained
syntax keyword plantumlTypeKeyword abstract actor agent archimate artifact boundary card cloud component control
@@ -32,10 +32,10 @@ syntax keyword plantumlTypeKeyword queue rectangle stack state storage usecase
syntax keyword plantumlClassKeyword class interface
syntax keyword plantumlKeyword activate again also alt as autonumber bottom box break caption center create
syntax keyword plantumlKeyword critical deactivate destroy down else elseif end endif endwhile footbox footer
syntax keyword plantumlKeyword fork group header hide hnote if is kill left legend link loop namespace newpage
syntax keyword plantumlKeyword note of on opt over package page par partition ref repeat return right rnote
syntax keyword plantumlKeyword rotate show skin skinparam start stop title top up while
syntax keyword plantumlKeyword critical deactivate destroy down else elseif end endif endsplit endwhile footbox
syntax keyword plantumlKeyword footer fork group header hide hnote if is kill left legend link loop namespace
syntax keyword plantumlKeyword newpage note of on opt over package page par partition ref repeat return right
syntax keyword plantumlKeyword rnote rotate show skin skinparam split start stop title top up while
" Not in 'java - jar plantuml.jar - language' output
syntax keyword plantumlKeyword then detach sprite
@@ -63,12 +63,18 @@ syntax keyword plantumlColor Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey
syntax keyword plantumlColor TECHNOLOGY Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke
syntax keyword plantumlColor Yellow YellowGreen
" Arrows - Differentiate between horizontal and vertical arrows
syntax match plantumlHorizontalArrow /\%([-\.]\%(|>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\|\%(<|\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[\.-]\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
syntax match plantumlDirectedOrVerticalArrowLR /[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(|>\|>>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
syntax match plantumlDirectedOrVerticalArrowRL /\%(<|\|<<\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=plantumlText
syntax match plantumlText /\%([0-9A-Za-z\0xc0-\0xff]\|\s\|[\.,;_-]\)\+/ contained
" Arrows
syntax match plantumlArrow /.\@=\([.-]\)\1\+\ze\s*\%(\w\|(\)/
syntax match plantumlClassRelationLR /\([-.]\)\1*\%(\w\{,5\}\1\+\)\?\%(|>\|>\|*\|o\|x\|#\|{\|+\|\^\)/ contains=plantumlArrowDirectedLine
syntax match plantumlClassRelationRL /\%(<|\|<\|*\|o\|x\|#\|}\|+\|\^\)\([-.]\)\1*\%(\w\{,5\}\1\+\)\?/ contains=plantumlArrowDirectedLine
syntax match plantumlArrowLR /\[\?\([-.]\)\1*\%(\w\{,5}\1\+\)\?\(>\|\\\|\/\)\2\?[ox]\?\]\?\%(\[[^\]]*\]\)\?/ contains=plantumlText,plantumlArrowDirectedLine
syntax match plantumlArrowRL /\[\?[ox]\?\(<\|\\\|\/\)\1\?\([-.]\)\2*\%(\w\{,5}\2\+\)\?\]\?\%(\[[^\]]*\]\)\?/ contains=plantumlText,plantumlArrowDirectedLine
syntax match plantumlArrowBoth /[ox]\?\(<\|\\\|\/\)\1\?\([-.]\)\2*\%(\w\{,5}\2\+\)\?\(>\|\\\|\/\)\3\?[ox]\?/ contains=plantumlArrowDirectedLine
syntax region plantumlText oneline start=/\[/ms=s+1 end=/\]/me=s-1 contained
syntax match plantumlArrowDirectedLine /\([-.]\)\%(l\%[eft]\|r\%[ight]\|up\?\|d\%[own]\)\1/ contained
" Note
syntax region plantumlNoteMultiLine start=/\%(^\s*[rh]\?note\)\@<=\s\%([^:"]\+$\)\@=/ end=/^\%(\s*end \?[rh]\?note$\)\@=/ contains=plantumlSpecialString,plantumlNoteMultiLineStart
@@ -103,7 +109,7 @@ syntax region plantumlMultilineComment start=/\/'/ end=/'\// contains=plantumlCo
syntax match plantumlColonLine /\S\@<=\s*\zs:.\+$/ contains=plantumlSpecialString
" Stereotypes
syntax match plantumlStereotype /<<.\{-1,}>>/ contains=plantumlSpecialString
syntax match plantumlStereotype /<<[^-.]\+>>/ contains=plantumlSpecialString
" Activity diagram
syntax match plantumlActivityThing /([^)]*)/
@@ -114,6 +120,8 @@ syntax match plantumlActivityLabel /\%(^\%(#\S\+\)\?\)\@<=:\_[^;|<>/\]}]\+[;|<>/
syntax match plantumlSequenceDivider /^\s*==[^=]\+==\s*$/
syntax match plantumlSequenceSpace /^\s*|||\+\s*$/
syntax match plantumlSequenceSpace /^\s*||\d\+||\+\s*$/
syntax match plantumlSequenceDelay /^\.\{3}$/
syntax region plantumlText oneline matchgroup=plantumlSequenceDelay start=/^\.\{3}/ end=/\.\{3}$/
" Usecase diagram
syntax match plantumlUsecaseActor /:.\{-1,}:/ contains=plantumlSpecialString
@@ -288,10 +296,13 @@ highlight default link plantumlTypeKeyword Type
highlight default link plantumlPreProc PreProc
highlight default link plantumlDir Constant
highlight default link plantumlColor Constant
highlight default link plantumlHorizontalArrow Identifier
highlight default link plantumlDirectedOrVerticalArrowLR Identifier
highlight default link plantumlDirectedOrVerticalArrowRL Identifier
highlight default link plantumlLabel Special
highlight default link plantumlArrow Identifier
highlight default link plantumlArrowBoth Identifier
highlight default link plantumlArrowLR Identifier
highlight default link plantumlArrowRL Identifier
highlight default link plantumlArrowDirectedLine Identifier
highlight default link plantumlClassRelationLR Identifier
highlight default link plantumlClassRelationRL Identifier
highlight default link plantumlText Label
highlight default link plantumlClass Type
highlight default link plantumlClassPublic Structure
@@ -301,6 +312,7 @@ highlight default link plantumlClassPackPrivate Function
highlight default link plantumlClassSeparator Comment
highlight default link plantumlSequenceDivider Comment
highlight default link plantumlSequenceSpace Comment
highlight default link plantumlSequenceDelay Identifier
highlight default link plantumlSpecialString Special
highlight default link plantumlString String
highlight default link plantumlComment Comment
@@ -314,5 +326,5 @@ highlight default link plantumlNoteMultiLine String
highlight default link plantumlUsecaseActor String
highlight default link plantumlStereotype Type
let &cpo=s:cpo_orig
let &cpoptions=s:cpo_orig
unlet s:cpo_orig

61
syntax/rego.vim Normal file
View File

@@ -0,0 +1,61 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'rego') != -1
finish
endif
" Vim syntax file
" Language: Rego (http://github.com/open-policy-agent/opa)
" Maintainers: Torin Sandall <torinsandall@gmail.com>
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case match
" language keywords
syn keyword regoKeyword package import as not with default else some
" comments
syn match regoComment "#.*$" contains=regoTodo,@Spell
syn keyword regoTodo FIXME XXX TODO contained
" data types
syn keyword regoNull null
syn keyword regoBoolean true false
syn match regoNumber "\<\(0[0-7]*\|0[xx]\x\+\|\d\+\)[ll]\=\>"
syn match regoNumber "\(\<\d\+\.\d*\|\.\d\+\)\([ee][-+]\=\d\+\)\=[ffdd]\="
syn match regoNumber "\<\d\+[ee][-+]\=\d\+[ffdd]\=\>"
syn match regoNumber "\<\d\+\([ee][-+]\=\d\+\)\=[ffdd]\>"
syn region regoString start="\"[^"]" skip="\\\"" end="\"" contains=regoStringEscape
syn match regoStringEscape "\\u[0-9a-fA-F]\{4}" contained
syn match regoStringEscape "\\[nrfvb\\\"]" contained
" rules
syn match regoRuleName "^\(\w\+\)"
syn region regoBody start="{" end="}" transparent
" operators
syn match regoEquality "="
syn match regoInequality "[<>!]"
syn match regoArith "[+-/*&|]"
syn match regoBuiltin "\w\+(" nextgroup=regoBuiltinArgs contains=regoBuiltinArgs
syn region regoBuiltinArgs start="(" end=")" contained contains=regoNull,regoBoolean,regoNumber,regoString
" highlighting
hi link regoKeyword Keyword
hi link regoNull Function
hi link regoBoolean Boolean
hi link regoNumber Number
hi link regoString String
hi link regoRuleName Function
hi link regoEquality Keyword
hi link regoInequality Keyword
hi link regoArith Keyword
hi link regoBuiltin Type
hi link regoComment Comment
hi link regoTodo Todo

View File

@@ -94,16 +94,21 @@ execute 'syn match rstSubstitutionDefinition contained' .
\ ' /|.*|\_s\+/ nextgroup=@rstDirectives'
function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_right)
execute 'syn match rstEscape'.a:name.' +\\\\\|\\'.a:start.'+'.' contained'
execute 'syn region rst' . a:name .
\ ' start=+' . a:char_left . '\zs' . a:start .
\ '\ze[^[:space:]' . a:char_right . a:start[strlen(a:start) - 1] . ']+' .
\ a:middle .
\ ' end=+\S' . a:end . '\ze\%($\|\s\|[''")\]}>/:.,;!?\\-]\)+'
\ ' end=+' . a:end . '\ze\%($\|\s\|[''")\]}>/:.,;!?\\-]\)+' .
\ ' contains=rstEscape' . a:name
execute 'hi def link rstEscape'.a:name.' Special'
endfunction
function! s:DefineInlineMarkup(name, start, middle, end)
let middle = a:middle != "" ?
\ (' skip=+\\\\\|\\' . a:middle . '+') :
\ (' skip=+\\\\\|\\' . a:middle . '\|\s' . a:middle . '+') :
\ ""
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, "'", "'")

View File

@@ -76,7 +76,7 @@ syn match rustMacroRepeatCount ".\?[*+]" contained
syn match rustMacroVariable "$\w\+"
" Reserved (but not yet used) keywords {{{2
syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized abstract virtual final override
syn keyword rustReservedKeyword become do priv typeof unsized abstract virtual final override
" Built-in types {{{2
syn keyword rustType isize usize char bool u8 u16 u32 u64 u128 f32

View File

@@ -5,14 +5,10 @@ endif
" Forked from Larry Gilbert's syntax file
" github.com/L2G/vim-syntax-terraform
if exists("b:current_syntax")
if exists('b:current_syntax')
finish
endif
" Include hyphens as keyword characters so that a keyword appearing as part of
" a longer name doesn't get partially highlighted.
setlocal iskeyword+=-
syn case match
syn keyword terraSection connection output provider variable data terraform locals
@@ -37,6 +33,7 @@ syn keyword terraDataTypeBI
\ alicloud_cs_kubernetes_clusters
\ alicloud_cs_managed_kubernetes_clusters
\ alicloud_db_instances
\ alicloud_ddoscoo_instances
\ alicloud_disks
\ alicloud_dns_domain_groups
\ alicloud_dns_domain_records
@@ -46,6 +43,9 @@ syn keyword terraDataTypeBI
\ alicloud_drds_instances
\ alicloud_eips
\ alicloud_elasticsearch_instances
\ alicloud_ess_scaling_configurations
\ alicloud_ess_scaling_groups
\ alicloud_ess_scaling_rules
\ alicloud_fc_functions
\ alicloud_fc_services
\ alicloud_fc_triggers
@@ -60,14 +60,19 @@ syn keyword terraDataTypeBI
\ alicloud_mns_topic_subscriptions
\ alicloud_mns_topics
\ alicloud_mongo_instances
\ alicloud_mongodb_instances
\ alicloud_nas_access_groups
\ alicloud_nas_access_rules
\ alicloud_nas_file_systems
\ alicloud_nas_mount_targets
\ alicloud_nas_protocols
\ alicloud_nat_gateways
\ alicloud_network_interfaces
\ alicloud_oss_bucket_objects
\ alicloud_oss_buckets
\ alicloud_ots_instance_attachments
\ alicloud_ots_instances
\ alicloud_ots_tables
\ alicloud_pvtz_zone_records
\ alicloud_pvtz_zones
\ alicloud_ram_account_alias
@@ -90,7 +95,10 @@ syn keyword terraDataTypeBI
\ alicloud_slb_server_certificates
\ alicloud_slb_server_groups
\ alicloud_slbs
\ alicloud_snapshots
\ alicloud_snat_entries
\ alicloud_ssl_vpn_client_certs
\ alicloud_ssl_vpn_servers
\ alicloud_vpcs
\ alicloud_vpn_connections
\ alicloud_vpn_customer_gateways
@@ -142,6 +150,7 @@ syn keyword terraDataTypeBI
\ aws_ec2_transit_gateway_route_table
\ aws_ec2_transit_gateway_vpc_attachment
\ aws_ec2_transit_gateway_vpn_attachment
\ aws_ecr_image
\ aws_ecr_repository
\ aws_ecs_cluster
\ aws_ecs_container_definition
@@ -183,6 +192,7 @@ syn keyword terraDataTypeBI
\ aws_kms_secrets
\ aws_lambda_function
\ aws_lambda_invocation
\ aws_lambda_layer_version
\ aws_launch_configuration
\ aws_launch_template
\ aws_lb
@@ -196,6 +206,7 @@ syn keyword terraDataTypeBI
\ aws_partition
\ aws_prefix_list
\ aws_pricing_product
\ aws_ram_resource_share
\ aws_rds_cluster
\ aws_redshift_cluster
\ aws_redshift_service_account
@@ -237,10 +248,15 @@ syn keyword terraDataTypeBI
\ azurerm_app_service_plan
\ azurerm_application_insights
\ azurerm_application_security_group
\ azurerm_automation_variable_bool
\ azurerm_automation_variable_datetime
\ azurerm_automation_variable_int
\ azurerm_automation_variable_string
\ azurerm_availability_set
\ azurerm_azuread_application
\ azurerm_azuread_service_principal
\ azurerm_batch_account
\ azurerm_batch_certificate
\ azurerm_batch_pool
\ azurerm_builtin_role_definition
\ azurerm_cdn_profile
@@ -251,12 +267,16 @@ syn keyword terraDataTypeBI
\ azurerm_dev_test_lab
\ azurerm_dns_zone
\ azurerm_eventhub_namespace
\ azurerm_express_route_circuit
\ azurerm_firewall
\ azurerm_hdinsight_cluster
\ azurerm_image
\ azurerm_key_vault
\ azurerm_key_vault_access_policy
\ azurerm_key_vault_key
\ azurerm_key_vault_secret
\ azurerm_kubernetes_cluster
\ azurerm_kubernetes_service_versions
\ azurerm_lb
\ azurerm_lb_backend_address_pool
\ azurerm_log_analytics_workspace
@@ -288,10 +308,12 @@ syn keyword terraDataTypeBI
\ azurerm_snapshot
\ azurerm_storage_account
\ azurerm_storage_account_sas
\ azurerm_stream_analytics_job
\ azurerm_subnet
\ azurerm_subscription
\ azurerm_subscriptions
\ azurerm_traffic_manager_geographical_location
\ azurerm_user_assigned_identity
\ azurerm_virtual_machine
\ azurerm_virtual_network
\ azurerm_virtual_network_gateway
@@ -361,6 +383,8 @@ syn keyword terraDataTypeBI
\ flexibleengine_dcs_maintainwindow_v1
\ flexibleengine_dcs_product_v1
\ flexibleengine_images_image_v2
\ flexibleengine_kms_data_key_v1
\ flexibleengine_kms_key_v1
\ flexibleengine_networking_network_v2
\ flexibleengine_networking_secgroup_v2
\ flexibleengine_rds_flavors_v1
@@ -400,6 +424,7 @@ syn keyword terraDataTypeBI
\ google_compute_instance_group
\ google_compute_lb_ip_ranges
\ google_compute_network
\ google_compute_node_types
\ google_compute_region_instance_group
\ google_compute_regions
\ google_compute_ssl_policy
@@ -425,6 +450,7 @@ syn keyword terraDataTypeBI
\ google_project_services
\ google_projects
\ google_service_account
\ google_service_account_access_token
\ google_service_account_key
\ google_storage_bucket_object
\ google_storage_object_signed_url
@@ -432,6 +458,12 @@ syn keyword terraDataTypeBI
\ google_storage_transfer_project_service_account
\ google_tpu_tensorflow_versions
\ grafana_data_source
\ gridscale_ipv4
\ gridscale_ipv6
\ gridscale_network
\ gridscale_sshkey
\ gridscale_storage
\ gridscale_template
\ hcloud_datacenter
\ hcloud_datacenters
\ hcloud_floating_ip
@@ -481,6 +513,17 @@ syn keyword terraDataTypeBI
\ huaweicloud_vpc_subnet_ids_v1
\ huaweicloud_vpc_subnet_v1
\ huaweicloud_vpc_v1
\ ignition_config
\ ignition_directory
\ ignition_disk
\ ignition_file
\ ignition_filesystem
\ ignition_group
\ ignition_link
\ ignition_networkd_unit
\ ignition_raid
\ ignition_systemd_unit
\ ignition_user
\ kubernetes_secret
\ kubernetes_service
\ kubernetes_storage_class
@@ -488,6 +531,7 @@ syn keyword terraDataTypeBI
\ linode_domain
\ linode_image
\ linode_instance_type
\ linode_networking_ip
\ linode_profile
\ linode_region
\ linode_sshkey
@@ -535,6 +579,7 @@ syn keyword terraDataTypeBI
\ nsxt_switching_profile
\ nsxt_transport_zone
\ null_data_source
\ nutanix_category_key
\ nutanix_cluster
\ nutanix_clusters
\ nutanix_image
@@ -584,6 +629,7 @@ syn keyword terraDataTypeBI
\ oci_core_drg_attachments
\ oci_core_drgs
\ oci_core_fast_connect_provider_service
\ oci_core_fast_connect_provider_service_key
\ oci_core_fast_connect_provider_services
\ oci_core_images
\ oci_core_instance
@@ -607,6 +653,7 @@ syn keyword terraDataTypeBI
\ oci_core_nat_gateway
\ oci_core_nat_gateways
\ oci_core_peer_region_for_remote_peerings
\ oci_core_private_ip
\ oci_core_private_ips
\ oci_core_public_ip
\ oci_core_public_ips
@@ -619,6 +666,7 @@ syn keyword terraDataTypeBI
\ oci_core_shapes
\ oci_core_subnet
\ oci_core_subnets
\ oci_core_vcn
\ oci_core_vcns
\ oci_core_virtual_circuit
\ oci_core_virtual_circuit_bandwidth_shapes
@@ -675,6 +723,7 @@ syn keyword terraDataTypeBI
\ oci_file_storage_exports
\ oci_file_storage_file_systems
\ oci_file_storage_mount_targets
\ oci_file_storage_snapshot
\ oci_file_storage_snapshots
\ oci_health_checks_http_monitor
\ oci_health_checks_http_monitors
@@ -690,9 +739,11 @@ syn keyword terraDataTypeBI
\ oci_identity_availability_domains
\ oci_identity_compartment
\ oci_identity_compartments
\ oci_identity_cost_tracking_tags
\ oci_identity_customer_secret_keys
\ oci_identity_dynamic_groups
\ oci_identity_fault_domains
\ oci_identity_group
\ oci_identity_groups
\ oci_identity_identity_provider_groups
\ oci_identity_identity_providers
@@ -707,6 +758,7 @@ syn keyword terraDataTypeBI
\ oci_identity_tag_namespaces
\ oci_identity_tags
\ oci_identity_tenancy
\ oci_identity_user
\ oci_identity_user_group_memberships
\ oci_identity_users
\ oci_kms_decrypted_data
@@ -786,6 +838,7 @@ syn keyword terraDataTypeBI
\ openstack_identity_role_v3
\ openstack_identity_user_v3
\ openstack_images_image_v2
\ openstack_networking_addressscope_v2
\ openstack_networking_floatingip_v2
\ openstack_networking_network_v2
\ openstack_networking_port_ids_v2
@@ -822,8 +875,10 @@ syn keyword terraDataTypeBI
\ opentelekomcloud_kms_data_key_v1
\ opentelekomcloud_kms_key_v1
\ opentelekomcloud_networking_network_v2
\ opentelekomcloud_networking_port_v2
\ opentelekomcloud_networking_secgroup_v2
\ opentelekomcloud_rds_flavors_v1
\ opentelekomcloud_rds_flavors_v3
\ opentelekomcloud_rts_software_config_v1
\ opentelekomcloud_rts_software_deployment_v1
\ opentelekomcloud_rts_stack_resource_v1
@@ -864,6 +919,7 @@ syn keyword terraDataTypeBI
\ profitbricks_location
\ profitbricks_resource
\ profitbricks_snapshot
\ rancher2_setting
\ rancher_certificate
\ rancher_environment
\ rancher_setting
@@ -922,9 +978,15 @@ syn keyword terraDataTypeBI
\ tencentcloud_availability_zones
\ tencentcloud_container_cluster_instances
\ tencentcloud_container_clusters
\ tencentcloud_cos_bucket_object
\ tencentcloud_cos_buckets
\ tencentcloud_eip
\ tencentcloud_image
\ tencentcloud_instance_types
\ tencentcloud_mysql_backup_list
\ tencentcloud_mysql_instance
\ tencentcloud_mysql_parameter_list
\ tencentcloud_mysql_zone_config
\ tencentcloud_nats
\ tencentcloud_route_table
\ tencentcloud_security_group
@@ -944,6 +1006,7 @@ syn keyword terraDataTypeBI
\ triton_image
\ triton_network
\ triton_package
\ ucloud_db_instances
\ ucloud_disks
\ ucloud_eips
\ ucloud_images
@@ -951,8 +1014,12 @@ syn keyword terraDataTypeBI
\ ucloud_lb_attachments
\ ucloud_lb_listeners
\ ucloud_lb_rules
\ ucloud_lb_ssls
\ ucloud_lbs
\ ucloud_projects
\ ucloud_security_groups
\ ucloud_subnets
\ ucloud_vpcs
\ ucloud_zones
\ vault_approle_auth_backend_role_id
\ vault_aws_access_credentials
@@ -986,6 +1053,7 @@ syn keyword terraDataTypeBI
\ yandex_resourcemanager_cloud
\ yandex_resourcemanager_folder
\ yandex_vpc_network
\ yandex_vpc_route_table
\ yandex_vpc_subnet
""" end data sources
@@ -1060,6 +1128,7 @@ syn keyword terraResourceTypeBI
\ alicloud_kms_key
\ alicloud_kvstore_backup_policy
\ alicloud_kvstore_instance
\ alicloud_launch_template
\ alicloud_log_machine_group
\ alicloud_log_project
\ alicloud_log_store
@@ -1070,11 +1139,13 @@ syn keyword terraResourceTypeBI
\ alicloud_mns_topic
\ alicloud_mns_topic_subscription
\ alicloud_mongodb_instance
\ alicloud_mongodb_sharding_instance
\ alicloud_nas_access_group
\ alicloud_nas_access_rule
\ alicloud_nas_file_system
\ alicloud_nas_mount_target
\ alicloud_nat_gateway
\ alicloud_network_acl
\ alicloud_network_interface
\ alicloud_network_interface_attachment
\ alicloud_oss_bucket
@@ -1113,6 +1184,8 @@ syn keyword terraResourceTypeBI
\ alicloud_slb_rule
\ alicloud_slb_server_certificate
\ alicloud_slb_server_group
\ alicloud_snapshot
\ alicloud_snapshot_policy
\ alicloud_snat_entry
\ alicloud_ssl_vpn_client_cert
\ alicloud_ssl_vpn_server
@@ -1182,6 +1255,7 @@ syn keyword terraResourceTypeBI
\ aws_autoscaling_policy
\ aws_autoscaling_schedule
\ aws_backup_plan
\ aws_backup_selection
\ aws_backup_vault
\ aws_batch_compute_environment
\ aws_batch_job_definition
@@ -1245,6 +1319,7 @@ syn keyword terraResourceTypeBI
\ aws_db_cluster_snapshot
\ aws_db_event_subscription
\ aws_db_instance
\ aws_db_instance_role_association
\ aws_db_option_group
\ aws_db_parameter_group
\ aws_db_security_group
@@ -1275,6 +1350,7 @@ syn keyword terraResourceTypeBI
\ aws_dx_connection_association
\ aws_dx_gateway
\ aws_dx_gateway_association
\ aws_dx_gateway_association_proposal
\ aws_dx_hosted_private_virtual_interface
\ aws_dx_hosted_private_virtual_interface_accepter
\ aws_dx_hosted_public_virtual_interface
@@ -1459,6 +1535,7 @@ syn keyword terraResourceTypeBI
\ aws_opsworks_user_profile
\ aws_organizations_account
\ aws_organizations_organization
\ aws_organizations_organizational_unit
\ aws_organizations_policy
\ aws_organizations_policy_attachment
\ aws_pinpoint_adm_channel
@@ -1509,9 +1586,11 @@ syn keyword terraResourceTypeBI
\ aws_s3_bucket_object
\ aws_s3_bucket_policy
\ aws_s3_bucket_public_access_block
\ aws_sagemaker_endpoint
\ aws_sagemaker_endpoint_configuration
\ aws_sagemaker_model
\ aws_sagemaker_notebook_instance
\ aws_sagemaker_notebook_instance_lifecycle_configuration
\ aws_secretsmanager_secret
\ aws_secretsmanager_secret_version
\ aws_security_group
@@ -1530,6 +1609,7 @@ syn keyword terraResourceTypeBI
\ aws_ses_domain_identity
\ aws_ses_domain_identity_verification
\ aws_ses_domain_mail_from
\ aws_ses_email_identity
\ aws_ses_event_destination
\ aws_ses_identity_notification_topic
\ aws_ses_receipt_filter
@@ -1538,6 +1618,7 @@ syn keyword terraResourceTypeBI
\ aws_ses_template
\ aws_sfn_activity
\ aws_sfn_state_machine
\ aws_shield_protection
\ aws_simpledb_domain
\ aws_snapshot_create_volume_permission
\ aws_sns_platform_application
@@ -1617,6 +1698,8 @@ syn keyword terraResourceTypeBI
\ aws_wafregional_web_acl_association
\ aws_wafregional_xss_match_set
\ aws_worklink_fleet
\ aws_worklink_website_certificate_authority_association
\ aws_xray_sampling_rule
\ azure_affinity_group
\ azure_data_disk
\ azure_dns_server
@@ -1641,6 +1724,10 @@ syn keyword terraResourceTypeBI
\ azurerm_api_management
\ azurerm_api_management_api
\ azurerm_api_management_api_operation
\ azurerm_api_management_api_operation_policy
\ azurerm_api_management_api_policy
\ azurerm_api_management_api_schema
\ azurerm_api_management_api_version_set
\ azurerm_api_management_authorization_server
\ azurerm_api_management_certificate
\ azurerm_api_management_group
@@ -1650,6 +1737,7 @@ syn keyword terraResourceTypeBI
\ azurerm_api_management_product
\ azurerm_api_management_product_api
\ azurerm_api_management_product_group
\ azurerm_api_management_product_policy
\ azurerm_api_management_property
\ azurerm_api_management_subscription
\ azurerm_api_management_user
@@ -1661,6 +1749,7 @@ syn keyword terraResourceTypeBI
\ azurerm_application_gateway
\ azurerm_application_insights
\ azurerm_application_insights_api_key
\ azurerm_application_insights_web_test
\ azurerm_application_security_group
\ azurerm_automation_account
\ azurerm_automation_credential
@@ -1669,12 +1758,17 @@ syn keyword terraResourceTypeBI
\ azurerm_automation_module
\ azurerm_automation_runbook
\ azurerm_automation_schedule
\ azurerm_automation_variable_bool
\ azurerm_automation_variable_datetime
\ azurerm_automation_variable_int
\ azurerm_automation_variable_string
\ azurerm_autoscale_setting
\ azurerm_availability_set
\ azurerm_azuread_application
\ azurerm_azuread_service_principal
\ azurerm_azuread_service_principal_password
\ azurerm_batch_account
\ azurerm_batch_certificate
\ azurerm_batch_pool
\ azurerm_cdn_endpoint
\ azurerm_cdn_profile
@@ -1684,6 +1778,20 @@ syn keyword terraResourceTypeBI
\ azurerm_container_registry
\ azurerm_container_service
\ azurerm_cosmosdb_account
\ azurerm_cosmosdb_cassandra_keyspace
\ azurerm_cosmosdb_mongo_collection
\ azurerm_cosmosdb_mongo_database
\ azurerm_cosmosdb_sql_database
\ azurerm_cosmosdb_table
\ azurerm_data_factory
\ azurerm_data_factory_dataset_mysql
\ azurerm_data_factory_dataset_postgresql
\ azurerm_data_factory_dataset_sql_server_table
\ azurerm_data_factory_linked_service_data_lake_storage_gen2
\ azurerm_data_factory_linked_service_mysql
\ azurerm_data_factory_linked_service_postgresql
\ azurerm_data_factory_linked_service_sql_server
\ azurerm_data_factory_pipeline
\ azurerm_data_lake_analytics_account
\ azurerm_data_lake_analytics_firewall_rule
\ azurerm_data_lake_store
@@ -1720,11 +1828,21 @@ syn keyword terraResourceTypeBI
\ azurerm_express_route_circuit_peering
\ azurerm_firewall
\ azurerm_firewall_application_rule_collection
\ azurerm_firewall_nat_rule_collection
\ azurerm_firewall_network_rule_collection
\ azurerm_function_app
\ azurerm_hdinsight_hadoop_cluster
\ azurerm_hdinsight_hbase_cluster
\ azurerm_hdinsight_interactive_query_cluster
\ azurerm_hdinsight_kafka_cluster
\ azurerm_hdinsight_ml_services_cluster
\ azurerm_hdinsight_rserver_cluster
\ azurerm_hdinsight_spark_cluster
\ azurerm_hdinsight_storm_cluster
\ azurerm_image
\ azurerm_iothub
\ azurerm_iothub_consumer_group
\ azurerm_iothub_shared_access_policy
\ azurerm_key_vault
\ azurerm_key_vault_access_policy
\ azurerm_key_vault_certificate
@@ -1769,11 +1887,15 @@ syn keyword terraResourceTypeBI
\ azurerm_mysql_firewall_rule
\ azurerm_mysql_server
\ azurerm_mysql_virtual_network_rule
\ azurerm_network_connection_monitor
\ azurerm_network_ddos_protection_plan
\ azurerm_network_interface
\ azurerm_network_interface_application_gateway_backend_address_pool_association
\ azurerm_network_interface_application_security_group_association
\ azurerm_network_interface_backend_address_pool_association
\ azurerm_network_interface_nat_rule_association
\ azurerm_network_packet_capture
\ azurerm_network_profile
\ azurerm_network_security_group
\ azurerm_network_security_rule
\ azurerm_network_watcher
@@ -1790,6 +1912,7 @@ syn keyword terraResourceTypeBI
\ azurerm_postgresql_server
\ azurerm_postgresql_virtual_network_rule
\ azurerm_public_ip
\ azurerm_public_ip_prefix
\ azurerm_recovery_services_protected_vm
\ azurerm_recovery_services_protection_policy_vm
\ azurerm_recovery_services_vault
@@ -1833,6 +1956,14 @@ syn keyword terraResourceTypeBI
\ azurerm_storage_queue
\ azurerm_storage_share
\ azurerm_storage_table
\ azurerm_stream_analytics_function_javascript_udf
\ azurerm_stream_analytics_job
\ azurerm_stream_analytics_output_blob
\ azurerm_stream_analytics_output_eventhub
\ azurerm_stream_analytics_output_servicebus_queue
\ azurerm_stream_analytics_stream_input_blob
\ azurerm_stream_analytics_stream_input_eventhub
\ azurerm_stream_analytics_stream_input_iothub
\ azurerm_subnet
\ azurerm_subnet_network_security_group_association
\ azurerm_subnet_route_table_association
@@ -1953,12 +2084,14 @@ syn keyword terraResourceTypeBI
\ cloudflare_access_policy
\ cloudflare_access_rule
\ cloudflare_account_member
\ cloudflare_argo
\ cloudflare_custom_pages
\ cloudflare_filter
\ cloudflare_firewall_rule
\ cloudflare_load_balancer
\ cloudflare_load_balancer_monitor
\ cloudflare_load_balancer_pool
\ cloudflare_logpush_job
\ cloudflare_page_rule
\ cloudflare_rate_limit
\ cloudflare_record
@@ -1971,6 +2104,7 @@ syn keyword terraResourceTypeBI
\ cloudflare_zone_settings_override
\ cloudscale_floating_ip
\ cloudscale_server
\ cloudscale_volume
\ cloudstack_affinity_group
\ cloudstack_disk
\ cloudstack_egress_firewall
@@ -2001,6 +2135,8 @@ syn keyword terraResourceTypeBI
\ cobbler_repo
\ cobbler_snippet
\ cobbler_system
\ consul_acl_policy
\ consul_acl_token
\ consul_agent_service
\ consul_autopilot_config
\ consul_catalog_entry
@@ -2017,8 +2153,10 @@ syn keyword terraResourceTypeBI
\ datadog_metric_metadata
\ datadog_monitor
\ datadog_screenboard
\ datadog_synthetics_test
\ datadog_timeboard
\ datadog_user
\ digitalocean_cdn
\ digitalocean_certificate
\ digitalocean_database_cluster
\ digitalocean_domain
@@ -2030,6 +2168,7 @@ syn keyword terraResourceTypeBI
\ digitalocean_kubernetes_cluster
\ digitalocean_kubernetes_node_pool
\ digitalocean_loadbalancer
\ digitalocean_project
\ digitalocean_record
\ digitalocean_spaces_bucket
\ digitalocean_ssh_key
@@ -2067,6 +2206,7 @@ syn keyword terraResourceTypeBI
\ flexibleengine_compute_floatingip_associate_v2
\ flexibleengine_compute_floatingip_v2
\ flexibleengine_compute_instance_v2
\ flexibleengine_compute_interface_attach_v2
\ flexibleengine_compute_keypair_v2
\ flexibleengine_compute_servergroup_v2
\ flexibleengine_compute_volume_attach_v2
@@ -2087,6 +2227,7 @@ syn keyword terraResourceTypeBI
\ flexibleengine_fw_policy_v2
\ flexibleengine_fw_rule_v2
\ flexibleengine_images_image_v2
\ flexibleengine_kms_key_v1
\ flexibleengine_lb_certificate_v2
\ flexibleengine_lb_l7policy_v2
\ flexibleengine_lb_l7rule_v2
@@ -2098,6 +2239,7 @@ syn keyword terraResourceTypeBI
\ flexibleengine_mls_instance_v1
\ flexibleengine_mrs_cluster_v1
\ flexibleengine_mrs_job_v1
\ flexibleengine_nat_dnat_rule_v2
\ flexibleengine_nat_gateway_v2
\ flexibleengine_nat_snat_rule_v2
\ flexibleengine_networking_floatingip_associate_v2
@@ -2130,9 +2272,34 @@ syn keyword terraResourceTypeBI
\ flexibleengine_vpc_route_v2
\ flexibleengine_vpc_subnet_v1
\ flexibleengine_vpc_v1
\ fortios_firewall_object_address
\ fortios_firewall_object_addressgroup
\ fortios_firewall_object_ippool
\ fortios_firewall_object_service
\ fortios_firewall_object_servicegroup
\ fortios_firewall_object_vip
\ fortios_firewall_object_vipgroup
\ fortios_firewall_security_policy
\ fortios_log_fortianalyzer_setting
\ fortios_log_syslog_setting
\ fortios_networking_interface_port
\ fortios_networking_route_static
\ fortios_system_admin_administrator
\ fortios_system_admin_profiles
\ fortios_system_apiuser_setting
\ fortios_system_license_forticare
\ fortios_system_license_vdom
\ fortios_system_license_vm
\ fortios_system_setting_dns
\ fortios_system_setting_global
\ fortios_system_setting_ntp
\ fortios_system_vdom_setting
\ fortios_vpn_ipsec_phase1interface
\ fortios_vpn_ipsec_phase2interface
\ github_branch_protection
\ github_issue_label
\ github_membership
\ github_organization_block
\ github_organization_project
\ github_organization_webhook
\ github_project_column
@@ -2147,6 +2314,7 @@ syn keyword terraResourceTypeBI
\ github_user_gpg_key
\ github_user_invitation_accepter
\ github_user_ssh_key
\ gitlab_branch_protection
\ gitlab_deploy_key
\ gitlab_group
\ gitlab_group_membership
@@ -2158,6 +2326,8 @@ syn keyword terraResourceTypeBI
\ gitlab_project_hook
\ gitlab_project_membership
\ gitlab_project_variable
\ gitlab_service_slack
\ gitlab_tag_protection
\ gitlab_user
\ google_access_context_manager_access_level
\ google_access_context_manager_access_policy
@@ -2182,7 +2352,9 @@ syn keyword terraResourceTypeBI
\ google_compute_attached_disk
\ google_compute_autoscaler
\ google_compute_backend_bucket
\ google_compute_backend_bucket_signed_url_key
\ google_compute_backend_service
\ google_compute_backend_service_signed_url_key
\ google_compute_disk
\ google_compute_firewall
\ google_compute_forwarding_rule
@@ -2196,11 +2368,17 @@ syn keyword terraResourceTypeBI
\ google_compute_instance_from_template
\ google_compute_instance_group
\ google_compute_instance_group_manager
\ google_compute_instance_iam_binding
\ google_compute_instance_iam_member
\ google_compute_instance_iam_policy
\ google_compute_instance_template
\ google_compute_interconnect_attachment
\ google_compute_managed_ssl_certificate
\ google_compute_network
\ google_compute_network_endpoint_group
\ google_compute_network_peering
\ google_compute_node_group
\ google_compute_node_template
\ google_compute_project_metadata
\ google_compute_project_metadata_item
\ google_compute_region_autoscaler
@@ -2224,6 +2402,7 @@ syn keyword terraResourceTypeBI
\ google_compute_subnetwork_iam_policy
\ google_compute_target_http_proxy
\ google_compute_target_https_proxy
\ google_compute_target_instance
\ google_compute_target_pool
\ google_compute_target_ssl_proxy
\ google_compute_target_tcp_proxy
@@ -2235,17 +2414,27 @@ syn keyword terraResourceTypeBI
\ google_container_node_pool
\ google_dataflow_job
\ google_dataproc_cluster
\ google_dataproc_cluster_iam_binding
\ google_dataproc_cluster_iam_member
\ google_dataproc_cluster_iam_policy
\ google_dataproc_job
\ google_dataproc_job_iam_binding
\ google_dataproc_job_iam_member
\ google_dataproc_job_iam_policy
\ google_dns_managed_zone
\ google_dns_policy
\ google_dns_record_set
\ google_endpoints_service
\ google_filestore_instance
\ google_firestore_index
\ google_folder
\ google_folder_iam_binding
\ google_folder_iam_member
\ google_folder_iam_policy
\ google_folder_organization_policy
\ google_iap_tunnel_instance_iam_binding
\ google_iap_tunnel_instance_iam_member
\ google_iap_tunnel_instance_iam_policy
\ google_kms_crypto_key
\ google_kms_crypto_key_iam_binding
\ google_kms_crypto_key_iam_member
@@ -2257,6 +2446,7 @@ syn keyword terraResourceTypeBI
\ google_logging_billing_account_sink
\ google_logging_folder_exclusion
\ google_logging_folder_sink
\ google_logging_metric
\ google_logging_organization_exclusion
\ google_logging_organization_sink
\ google_logging_project_exclusion
@@ -2292,6 +2482,7 @@ syn keyword terraResourceTypeBI
\ google_resource_manager_lien
\ google_runtimeconfig_config
\ google_runtimeconfig_variable
\ google_security_scanner_scan_config
\ google_service_account
\ google_service_account_iam_binding
\ google_service_account_iam_member
@@ -2329,6 +2520,12 @@ syn keyword terraResourceTypeBI
\ grafana_data_source
\ grafana_folder
\ grafana_organization
\ gridscale_ipv4
\ gridscale_ipv6
\ gridscale_network
\ gridscale_server
\ gridscale_sshkey
\ gridscale_storage
\ hcloud_floating_ip
\ hcloud_floating_ip_assignment
\ hcloud_rdns
@@ -2451,17 +2648,6 @@ syn keyword terraResourceTypeBI
\ icinga2_notification
\ icinga2_service
\ icinga2_user
\ ignition_config
\ ignition_directory
\ ignition_disk
\ ignition_file
\ ignition_filesystem
\ ignition_group
\ ignition_link
\ ignition_networkd_unit
\ ignition_raid
\ ignition_systemd_unit
\ ignition_user
\ influxdb_continuous_query
\ influxdb_database
\ influxdb_user
@@ -2494,8 +2680,9 @@ syn keyword terraResourceTypeBI
\ kubernetes_config_map
\ kubernetes_daemonset
\ kubernetes_deployment
\ kubernetes_endpoint
\ kubernetes_endpoints
\ kubernetes_horizontal_pod_autoscaler
\ kubernetes_ingress
\ kubernetes_limit_range
\ kubernetes_namespace
\ kubernetes_network_policy
@@ -2523,6 +2710,7 @@ syn keyword terraResourceTypeBI
\ linode_nodebalancer
\ linode_nodebalancer_config
\ linode_nodebalancer_node
\ linode_rdns
\ linode_sshkey
\ linode_stackscript
\ linode_token
@@ -2899,6 +3087,7 @@ syn keyword terraResourceTypeBI
\ opentelekomcloud_compute_volume_attach_v2
\ opentelekomcloud_csbs_backup_policy_v1
\ opentelekomcloud_csbs_backup_v1
\ opentelekomcloud_css_cluster_v1
\ opentelekomcloud_cts_tracker_v1
\ opentelekomcloud_dcs_instance_v1
\ opentelekomcloud_deh_host_v1
@@ -2945,6 +3134,7 @@ syn keyword terraResourceTypeBI
\ opentelekomcloud_networking_vip_associate_v2
\ opentelekomcloud_networking_vip_v2
\ opentelekomcloud_rds_instance_v1
\ opentelekomcloud_rds_instance_v3
\ opentelekomcloud_rts_software_config_v1
\ opentelekomcloud_rts_software_deployment_v1
\ opentelekomcloud_rts_stack_resource_v1
@@ -3116,7 +3306,9 @@ syn keyword terraResourceTypeBI
\ panos_zone
\ panos_zone_entry
\ postgresql_database
\ postgresql_default_privileges
\ postgresql_extension
\ postgresql_grant
\ postgresql_role
\ postgresql_schema
\ powerdns_record
@@ -3141,6 +3333,29 @@ syn keyword terraResourceTypeBI
\ rabbitmq_queue
\ rabbitmq_user
\ rabbitmq_vhost
\ rancher2_auth_config_activedirectory
\ rancher2_auth_config_adfs
\ rancher2_auth_config_azuread
\ rancher2_auth_config_freeipa
\ rancher2_auth_config_github
\ rancher2_auth_config_openldap
\ rancher2_auth_config_ping
\ rancher2_bootstrap
\ rancher2_catalog
\ rancher2_cloud_credential
\ rancher2_cluster
\ rancher2_cluster_driver
\ rancher2_cluster_logging
\ rancher2_cluster_role_template_binding
\ rancher2_etcd_backup
\ rancher2_namespace
\ rancher2_node_driver
\ rancher2_node_pool
\ rancher2_node_template
\ rancher2_project
\ rancher2_project_logging
\ rancher2_project_role_template_binding
\ rancher2_setting
\ rancher_certificate
\ rancher_environment
\ rancher_host
@@ -3171,6 +3386,7 @@ syn keyword terraResourceTypeBI
\ rightscale_server_array
\ rightscale_ssh_key
\ rightscale_subnet
\ rundeck_acl_policy
\ rundeck_job
\ rundeck_private_key
\ rundeck_project
@@ -3273,12 +3489,19 @@ syn keyword terraResourceTypeBI
\ tencentcloud_cbs_storage_attachment
\ tencentcloud_container_cluster
\ tencentcloud_container_cluster_instance
\ tencentcloud_cos_bucket
\ tencentcloud_cos_bucket_object
\ tencentcloud_dnat
\ tencentcloud_eip
\ tencentcloud_eip_association
\ tencentcloud_instance
\ tencentcloud_key_pair
\ tencentcloud_lb
\ tencentcloud_mysql_account
\ tencentcloud_mysql_account_privilege
\ tencentcloud_mysql_backup_policy
\ tencentcloud_mysql_instance
\ tencentcloud_mysql_readonly_instance
\ tencentcloud_nat_gateway
\ tencentcloud_route_entry
\ tencentcloud_route_table
@@ -3385,6 +3608,7 @@ syn keyword terraResourceTypeBI
\ vault_pki_secret_backend
\ vault_pki_secret_backend_cert
\ vault_pki_secret_backend_config_ca
\ vault_pki_secret_backend_config_urls
\ vault_pki_secret_backend_intermediate_cert_request
\ vault_pki_secret_backend_intermediate_set_signed
\ vault_pki_secret_backend_role
@@ -3404,6 +3628,7 @@ syn keyword terraResourceTypeBI
\ vcd_catalog_media
\ vcd_dnat
\ vcd_edgegateway_vpn
\ vcd_external_network
\ vcd_firewall_rules
\ vcd_independent_disk
\ vcd_inserted_media
@@ -3411,10 +3636,12 @@ syn keyword terraResourceTypeBI
\ vcd_network_isolated
\ vcd_network_routed
\ vcd_org
\ vcd_org_vdc
\ vcd_snat
\ vcd_vapp
\ vcd_vapp_network
\ vcd_vapp_vm
\ vra7_deployment
\ vsphere_compute_cluster
\ vsphere_compute_cluster_host_group
\ vsphere_compute_cluster_vm_affinity_rule
@@ -3464,6 +3691,7 @@ syn keyword terraResourceTypeBI
\ yandex_resourcemanager_folder_iam_member
\ yandex_resourcemanager_folder_iam_policy
\ yandex_vpc_network
\ yandex_vpc_route_table
\ yandex_vpc_subnet
""" end resources
@@ -3497,6 +3725,10 @@ syn region terraProvisionerName start=/"/ end=/"/ nextgroup=terraProvisionerBloc
syn match terraModule /\<module\>/ nextgroup=terraModuleName skipwhite
syn region terraModuleName start=/"/ end=/"/ nextgroup=terraModuleBlock skipwhite
""" dynamic (HCL2)
syn match terraDynamic /\<dynamic\>/ nextgroup=terraDynamicName skipwhite
syn region terraDynamicName start=/"/ end=/"/ nextgroup=terraDynamicBlock skipwhite
""" misc.
syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>"
syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>"
@@ -3513,6 +3745,18 @@ syn region terraValueFunction matchgroup=terraBrackets start=/[a-z]\+(/ end=/)/
" var.map["foo"]
syn region terraValueVarSubscript start=/\(\<var\|\<module\)\.[a-z0-9_-]\+\[/ end=/\]/ contains=terraValueString,terraValueFunction,terraValueVarSubscript contained
""" HCL2
syn keyword terraContent content
syn keyword terraRepeat for in
syn keyword terraConditional if
syn keyword terraPrimitiveType string bool number
syn keyword terraStructuralType object tuple
syn keyword terraCollectionType list map set
syn keyword terraValueNull null
""" Terraform v0.12
syn keyword terraTodo contained TF-UPGRADE-TODO
hi def link terraComment Comment
hi def link terraTodo Todo
hi def link terraBrackets Operator
@@ -3540,5 +3784,14 @@ hi def link terraModule Structure
hi def link terraModuleName String
hi def link terraValueFunction Identifier
hi def link terraValueVarSubscript Identifier
hi def link terraDynamic Structure
hi def link terraDynamicName String
hi def link terraContent Structure
hi def link terraRepeat Repeat
hi def link terraConditional Conditional
hi def link terraPrimitiveType Type
hi def link terraStructuralType Type
hi def link terraCollectionType Type
hi def link terraValueNull Constant
let b:current_syntax = "terraform"
let b:current_syntax = 'terraform'

View File

@@ -1,333 +0,0 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'tmux') != -1
finish
endif
" Vim syntax file
" Language: tmux(1) configuration file
" Maintainer: Tiago Cunha <tcunha@users.sourceforge.net>
" License: This file is placed in the public domain.
"
" To install this file:
"
" - Drop the file in the syntax directory into runtimepath (such as
" ~/.vim/syntax/tmux.vim).
" - Make the filetype recognisable by adding the following to filetype.vim
" (~/.vim/filetype.vim):
"
" augroup filetypedetect
" au BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux
" augroup END
"
" - Switch on syntax highlighting by adding "syntax enable" to .vimrc.
"
if v:version < 600
syntax clear
elseif exists('b:current_syntax')
finish
endif
setlocal iskeyword+=-
syntax case match
syn keyword tmuxAction any current default none
syn keyword tmuxBoolean off on
syn keyword tmuxCmds
\ attach
\ attach-session
\ bind
\ bind-key
\ break-pane
\ breakp
\ capture-pane
\ capturep
\ choose-buffer
\ choose-client
\ choose-session
\ choose-tree
\ choose-window
\ clear-history
\ clearhist
\ clock-mode
\ command-prompt
\ confirm
\ confirm-before
\ copy-mode
\ copy-mode-vi
\ delete-buffer
\ deleteb
\ detach
\ detach-client
\ display
\ display-message
\ display-panes
\ displayp
\ find-window
\ findw
\ has
\ has-session
\ if
\ if-shell
\ info
\ join-pane
\ joinp
\ kill-pane
\ kill-server
\ kill-session
\ kill-window
\ killp
\ killw
\ last
\ last-pane
\ last-window
\ lastp
\ link-window
\ linkw
\ list-buffers
\ list-clients
\ list-commands
\ list-keys
\ list-panes
\ list-sessions
\ list-windows
\ load-buffer
\ loadb
\ lock
\ lock-client
\ lock-server
\ lock-session
\ lockc
\ locks
\ ls
\ lsb
\ lsc
\ lscm
\ lsk
\ lsp
\ lsw
\ move-pane
\ move-window
\ movep
\ movew
\ new
\ new-session
\ new-window
\ neww
\ next
\ next-layout
\ next-window
\ nextl
\ paste-buffer
\ pasteb
\ path
\ pipe-pane
\ pipep
\ prev
\ previous-layout
\ previous-window
\ prevl
\ refresh
\ refresh-client
\ rename
\ rename-session
\ rename-window
\ renamew
\ resize-pane
\ resizep
\ respawn-pane
\ respawn-window
\ respawnp
\ respawnw
\ rotate-window
\ rotatew
\ run
\ run-shell
\ save-buffer
\ saveb
\ select-layout
\ select-pane
\ select-window
\ selectl
\ selectp
\ selectw
\ send
\ send-keys
\ send-prefix
\ server-info
\ set
\ set-buffer
\ set-environment
\ set-hook
\ set-option
\ set-window-option
\ setb
\ setenv
\ setw
\ show
\ show-buffer
\ show-environment
\ show-hooks
\ show-messages
\ show-options
\ show-window-options
\ showb
\ showenv
\ showmsgs
\ showw
\ source
\ source-file
\ split-window
\ splitw
\ start
\ start-server
\ suspend-client
\ suspendc
\ swap-pane
\ swap-window
\ swapp
\ swapw
\ switch-client
\ switchc
\ unbind
\ unbind-key
\ unlink-window
\ unlinkw
\ wait
\ wait-for
syn keyword tmuxOptsSet
\ assume-paste-time
\ base-index
\ bell-action
\ bell-on-alert
\ buffer-limit
\ default-command
\ default-shell
\ default-terminal
\ destroy-unattached
\ detach-on-destroy
\ display-panes-active-colour
\ display-panes-colour
\ display-panes-time
\ display-time
\ escape-time
\ exit-unattached
\ focus-events
\ history-file
\ history-limit
\ lock-after-time
\ lock-command
\ message-command-style
\ message-limit
\ message-style
\ mouse
\ prefix
\ prefix2
\ quiet
\ renumber-windows
\ repeat-time
\ set-clipboard
\ set-remain-on-exit
\ set-titles
\ set-titles-string
\ status
\ status-bg
\ status-fg
\ status-interval
\ status-justify
\ status-keys
\ status-left
\ status-left-length
\ status-left-style
\ status-position
\ status-right
\ status-right-length
\ status-right-style
\ status-style
\ terminal-overrides
\ update-environment
\ visual-activity
\ visual-bell
\ visual-silence
\ word-separators
syn keyword tmuxOptsSetw
\ aggressive-resize
\ allow-rename
\ alternate-screen
\ automatic-rename
\ automatic-rename-format
\ clock-mode-colour
\ clock-mode-style
\ force-height
\ force-width
\ main-pane-height
\ main-pane-width
\ message-attr
\ message-bg
\ message-fg
\ mode-keys
\ mode-style
\ monitor-activity
\ monitor-silence
\ other-pane-height
\ other-pane-width
\ pane-active-border-bg
\ pane-active-border-fg
\ pane-active-border-style
\ pane-base-index
\ pane-border-fg
\ pane-border-style
\ remain-on-exit
\ synchronize-panes
\ window-active-style
\ window-status-activity-attr
\ window-status-activity-bg
\ window-status-activity-fg
\ window-status-activity-style
\ window-status-bell-style
\ window-status-bg
\ window-status-current-attr
\ window-status-current-bg
\ window-status-current-fg
\ window-status-current-format
\ window-status-current-style
\ window-status-fg
\ window-status-format
\ window-status-last-style
\ window-status-separator
\ window-status-style
\ window-style
\ wrap-search
\ xterm-keys
syn keyword tmuxTodo FIXME NOTE TODO XXX contained
syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display
syn match tmuxNumber /\<\d\+\>/ display
syn match tmuxOptions /\s-\a\+/ display
syn match tmuxVariable /\w\+=/ display
syn match tmuxVariableExpansion /\${\=\w\+}\=/ display
" Comments can span multiple lines, when the newline is escaped
" (with a single) backslash at the end.
syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo
syn region tmuxString start=/"/ end=/"/ display oneline
syn region tmuxString start=/'/ end=/'/ display oneline
hi def link tmuxAction Boolean
hi def link tmuxBoolean Boolean
hi def link tmuxCmds Keyword
hi def link tmuxComment Comment
hi def link tmuxKey Special
hi def link tmuxNumber Number
hi def link tmuxOptions Identifier
hi def link tmuxOptsSet Function
hi def link tmuxOptsSetw Function
hi def link tmuxString String
hi def link tmuxTodo Todo
hi def link tmuxVariable Constant
hi def link tmuxVariableExpansion Constant
let b:current_syntax = 'tmux'

152
syntax/tptp.vim Normal file
View File

@@ -0,0 +1,152 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'tptp') != -1
finish
endif
" Vim syntax file
" Language: TPTP
" Filename extensions: *.p (collides with Pascal/Progress),
" Maintainer: Simon Cruanes (heavily inspired from progress.vim file)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
"elseif exists("b:current_syntax")
" finish
endif
if version >= 600
setlocal iskeyword=@,48-57,_,-,!,#,$,%
else
set iskeyword=@,48-57,_,-,!,#,$,%
endif
" tabs = evil
set expandtab
syn case match
syn keyword tptpRole axiom hypothesis definition assumption lemma theorem corollary conjecture negated_conjecture plain fi_domain fi_functors fi_predicates type unknown
syn keyword tptpLogic fof tff thf cnf include
syn match tptpBuiltin "$o\>"
syn match tptpBuiltin "$i\>"
syn match tptpBuiltin "$true\>"
syn match tptpBuiltin "$false\>"
syn match tptpBuiltin "$int\>"
syn match tptpBuiltin "$rat\>"
syn match tptpBuiltin "$real\>"
syn match tptpBuiltin "$tType\>"
syn match tptpBuiltin "$_\>"
syn match tptpBuiltin "$floor"
syn match tptpBuiltin "$ceiling"
syn match tptpBuiltin "$truncate"
syn match tptpBuiltin "$round"
syn match tptpBuiltin "$prec"
syn match tptpBuiltin "$succ"
syn match tptpBuiltin "$sum"
syn match tptpBuiltin "$difference"
syn match tptpBuiltin "$uminus"
syn match tptpBuiltin "$product"
syn match tptpBuiltin "$quotient"
syn match tptpBuiltin "$quotient_e"
syn match tptpBuiltin "$quotient_t"
syn match tptpBuiltin "$quotient_f"
syn match tptpBuiltin "$remainder_e"
syn match tptpBuiltin "$remainder_t"
syn match tptpBuiltin "$remainder_f"
syn match tptpBuiltin "$is_int"
syn match tptpBuiltin "$is_rat"
syn match tptpBuiltin "$to_int"
syn match tptpBuiltin "$to_rat"
syn match tptpBuiltin "$less"
syn match tptpBuiltin "$lesseq"
syn match tptpBuiltin "$greater"
syn match tptpBuiltin "$greatereq"
" generic dollar
syn match tptpDollar "\<\$\w+\>"
syn match tptpDollarDollar "\<\$\$\w+\>"
syn match tptpQuote "'[^']*'"
syn match tptpDoubleQuote "\"[^"]*\""
syn match tptpConnective ":"
syn match tptpConnective "|"
syn match tptpConnective "&"
syn match tptpConnective "="
syn match tptpConnective "=>"
syn match tptpConnective "<="
syn match tptpConnective "<=>"
syn match tptpConnective "<\~>"
syn match tptpConnective "!"
syn match tptpConnective "?"
syn match tptpConnective "!>"
syn match tptpConnective "!="
syn match tptpConnective "\~"
syn match tptpConnective "\."
syn match tptpConnective "\*"
syn match tptpConnective ">"
syn match tptpVar "\<\u\w*\>"
syn match tptpNum "\<-\?[0-9]\+\>"
syn match tptpNum "\<-\?[0-9]\+/[0-9]\+\>"
" errors
"syn match tptpBraceError "\]"
"syn match tptpParenError ")"
" delimiters
syn region tptpParen matchgroup=tptpDelim start="(" end=")" contains=ALLBUT,tptpParenError keepend contained
syn region tptpParen matchgroup=tptpDelim start="\[" end="\]" contains=ALLBUT,tptpBraceError keepend contained
syn keyword tptpTodo contained TODO BUG FIX FIXME NOTE
syn region tptpComment start=+/\*+ end=+\*/+ contains=tptpTodo
syn match tptpComment +%.*+ contains=tptpTodo
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_tptp_syntax_inits")
if version < 508
let did_tptp_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink tptpTodo Todo
HiLink tptpComment Comment
HiLink tptpComment Comment
HiLink tptpRole Keyword
HiLink tptpLogic Keyword
HiLink tptpConnective Keyword
HiLink tptpDelim Delimiter
HiLink tptpBuiltin Special
HiLink tptpDollar String
HiLink tptpDollarDollar String
HiLink tptpQuote String
HiLink tptpDoubleQuote String
HiLink tptpVar Constant
HiLink tptpNum Number
HiLink tptpBraceError Error
HiLink tptpParenError Error
delcommand HiLink
end
let b:current_syntax = "tptp"
" vim: ts=8 sw=8

View File

@@ -128,7 +128,7 @@ syntax keyword typescriptBranch break continue yield await
syntax keyword typescriptLabel case default async readonly
syntax keyword typescriptStatement return with
syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity Math Number NaN Object Packages RegExp String Symbol netscape
syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity JSON Math Number NaN Object Packages RegExp String Symbol netscape
syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
@@ -210,7 +210,7 @@ syn match typescriptBraces "[{}\[\]]"
syn match typescriptParens "[()]"
syn match typescriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-="
syn match typescriptEndColons "[;,]"
syn match typescriptLogicSymbols "\(&&\)\|\(||\)"
syn match typescriptLogicSymbols "\(&&\)\|\(||\)\|\(!\)"
" typescriptFold Function {{{

View File

@@ -4,7 +4,7 @@ endif
" vifm syntax file
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: January 31, 2019
" Last Change: June 3, 2019
" Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr.
if exists('b:current_syntax')
@@ -78,7 +78,7 @@ syntax case ignore
syntax keyword vifmHiGroups contained WildMenu Border Win CmdLine CurrLine
\ OtherLine Directory Link Socket Device Executable Selected BrokenLink
\ TopLine TopLineSel StatusLine JobLine SuggestBox Fifo ErrorMsg CmpMismatch
\ AuxWin TabLine TabLineSel
\ AuxWin OtherWin TabLine TabLineSel
\ User1 User2 User3 User4 User5 User6 User7 User8 User9
syntax keyword vifmHiStyles contained
\ bold underline reverse inverse standout italic none

106
syntax/zig.vim Normal file
View File

@@ -0,0 +1,106 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
finish
endif
" Vim syntax file
" Language: Zig
" Maintainer: Andrew Kelley
" Latest Revision: 03 August 2016
if exists("b:current_syntax")
finish
endif
let b:current_syntax = "zig"
syn keyword zigStorage const var extern packed export pub noalias inline comptime nakedcc stdcallcc volatile allowzero align linksection threadlocal
syn keyword zigStructure struct enum union error
syn keyword zigStatement break return continue asm defer errdefer unreachable try catch async await suspend resume cancel
syn keyword zigConditional if else switch and or orelse
syn keyword zigRepeat while for
syn keyword zigConstant null undefined
syn keyword zigKeyword fn usingnamespace test
syn keyword zigType bool f16 f32 f64 f128 void noreturn type anyerror promise
syn keyword zigType i0 u0 isize usize comptime_int comptime_float
syn keyword zigType c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong c_longdouble c_void
syn keyword zigBoolean true false
syn match zigType "\v<[iu][1-9]\d*>"
syn match zigOperator display "\%(+%\?\|-%\?\|/\|*%\?\|=\|\^\|&\|?\||\|!\|>\|<\|%\|<<%\?\|>>\)=\?"
syn match zigArrowCharacter display "->"
syn match zigBuiltinFn "\v\@(addWithOverflow|ArgType|atomicLoad|bitCast|breakpoint)>"
syn match zigBuiltinFn "\v\@(alignCast|alignOf|cDefine|cImport|cInclude)>"
syn match zigBuiltinFn "\v\@(cUndef|canImplicitCast|clz|cmpxchgWeak|cmpxchgStrong|compileError)>"
syn match zigBuiltinFn "\v\@(compileLog|ctz|popCount|divExact|divFloor|divTrunc)>"
syn match zigBuiltinFn "\v\@(embedFile|export|tagName|TagType|errorName)>"
syn match zigBuiltinFn "\v\@(errorReturnTrace|fence|fieldParentPtr|field)>"
syn match zigBuiltinFn "\v\@(frameAddress|import|inlineCall|newStackCall|intToPtr|IntType)>"
syn match zigBuiltinFn "\v\@(maxValue|memberCount|memberName|memberType)>"
syn match zigBuiltinFn "\v\@(memcpy|memset|minValue|mod|mulWithOverflow)>"
syn match zigBuiltinFn "\v\@(noInlineCall|bitOffsetOf|byteOffsetOf|OpaqueType|panic|ptrCast)>"
syn match zigBuiltinFn "\v\@(ptrToInt|rem|returnAddress|setCold)>"
syn match zigBuiltinFn "\v\@(setRuntimeSafety|setEvalBranchQuota|setFloatMode)>"
syn match zigBuiltinFn "\v\@(setGlobalLinkage|setGlobalSection|shlExact|This|hasDecl)>"
syn match zigBuiltinFn "\v\@(shlWithOverflow|shrExact|sizeOf|sqrt|bswap|subWithOverflow|intCast|floatCast|intToFloat|floatToInt|boolToInt|errSetCast)>"
syn match zigBuiltinFn "\v\@(truncate|typeId|typeInfo|typeName|typeOf|atomicRmw|bytesToSlice|sliceToBytes)>"
syn match zigBuiltinFn "\v\@(intToError|errorToInt|intToEnum|enumToInt|setAlignStack|handle|bitreverse|Vector)>"
syn match zigDecNumber display "\<[0-9]\+\%(.[0-9]\+\)\=\%([eE][+-]\?[0-9]\+\)\="
syn match zigHexNumber display "\<0x[a-fA-F0-9]\+\%([a-fA-F0-9]\+\%([pP][+-]\?[0-9]\+\)\?\)\="
syn match zigOctNumber display "\<0o[0-7]\+"
syn match zigBinNumber display "\<0b[01]\+\%(.[01]\+\%([eE][+-]\?[0-9]\+\)\?\)\="
syn match zigCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/
syn match zigCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/
syn match zigCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=zigEscape,zigEscapeError,zigCharacterInvalid,zigCharacterInvalidUnicode
syn match zigCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{6}\)\)'/ contains=zigEscape,zigEscapeUnicode,zigEscapeError,zigCharacterInvalid
syn region zigCommentLine start="//" end="$" contains=zigTodo,@Spell
syn region zigCommentLineDoc start="////\@!" end="$" contains=zigTodo,@Spell
" TODO: match only the first '\\' within the zigMultilineString as zigMultilineStringPrefix
syn match zigMultilineStringPrefix display contained /c\?\\\\/
syn region zigMultilineString start="c\?\\\\" end="$" contains=zigMultilineStringPrefix
syn keyword zigTodo contained TODO
syn match zigEscapeError display contained /\\./
syn match zigEscape display contained /\\\([nrt\\'"]\|x\x\{2}\)/
syn match zigEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{6}\)/
syn region zigString start=+c\?"+ skip=+\\\\\|\\"+ end=+"+ oneline contains=zigEscape,zigEscapeUnicode,zigEscapeError,@Spell
hi def link zigDecNumber zigNumber
hi def link zigHexNumber zigNumber
hi def link zigOctNumber zigNumber
hi def link zigBinNumber zigNumber
hi def link zigBuiltinFn Function
hi def link zigKeyword Keyword
hi def link zigType Type
hi def link zigCommentLine Comment
hi def link zigCommentLineDoc SpecialComment
hi def link zigTodo Todo
hi def link zigString String
hi def link zigMultilineString String
hi def link zigMultilineStringContent String
hi def link zigMultilineStringPrefix Comment
hi def link zigCharacterInvalid Error
hi def link zigCharacterInvalidUnicode zigCharacterInvalid
hi def link zigCharacter Character
hi def link zigEscape Special
hi def link zigEscapeUnicode zigEscape
hi def link zigEscapeError Error
hi def link zigBoolean Boolean
hi def link zigConstant Constant
hi def link zigNumber Number
hi def link zigArrowCharacter zigOperator
hi def link zigOperator Operator
hi def link zigStorage StorageClass
hi def link zigStructure Structure
hi def link zigStatement Statement
hi def link zigConditional Conditional
hi def link zigRepeat Repeat