Update all bundles

This commit is contained in:
Adam Stankiewicz 2015-12-06 11:31:38 +01:00
parent bf84973173
commit 303b3f1b43
30 changed files with 1122 additions and 324 deletions

View File

@ -26,9 +26,9 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
## Language packs ## Language packs
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect) - [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect)
- [blade](https://github.com/xsbeats/vim-blade) (syntax, indent, ftdetect) - [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftdetect)
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax) - [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
- [c/c++](https://github.com/vim-jp/cpp-vim) (syntax) - [c/c++](https://github.com/vim-jp/vim-cpp) (syntax)
- [cjsx](https://github.com/mtscout6/vim-cjsx) (ftdetect, syntax, ftplugin) - [cjsx](https://github.com/mtscout6/vim-cjsx) (ftdetect, syntax, ftplugin)
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin, ftdetect) - [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin, ftdetect)
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin, ftdetect) - [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
@ -44,7 +44,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [go](https://github.com/fatih/vim-go) (syntax, indent, ftdetect) - [go](https://github.com/fatih/vim-go) (syntax, indent, ftdetect)
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax) - [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
- [haml](https://github.com/tpope/vim-haml) (syntax, indent, compiler, ftplugin, ftdetect) - [haml](https://github.com/tpope/vim-haml) (syntax, indent, compiler, ftplugin, ftdetect)
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, ftplugin, ftdetect) - [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin, ftdetect)
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin, ftdetect) - [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin, ftdetect)
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax, ftdetect) - [haxe](https://github.com/yaymukund/vim-haxe) (syntax, ftdetect)
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin) - [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
@ -53,7 +53,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [javascript](https://github.com/sheerun/yajs.vim) (syntax, indent) - [javascript](https://github.com/sheerun/yajs.vim) (syntax, indent)
- [json](https://github.com/sheerun/vim-json) (syntax, indent, ftdetect) - [json](https://github.com/sheerun/vim-json) (syntax, indent, ftdetect)
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect) - [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect)
- [jsx](https://github.com/mxw/vim-jsx) (after) - [jsx](https://github.com/mxw/vim-jsx) (ftdetect, after)
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect) - [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent, ftdetect) - [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent, ftdetect)
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin) - [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
@ -86,7 +86,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect) - [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect) - [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
- [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect) - [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect)
- [tomdoc](https://github.com/duwanis/tomdoc.vim) (syntax) - [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect) - [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
- [twig](https://github.com/beyondwords/vim-twig) (syntax, ftplugin, ftdetect) - [twig](https://github.com/beyondwords/vim-twig) (syntax, ftplugin, ftdetect)
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect) - [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect)

View File

@ -1,24 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim ftdetect file
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
exec 'source '.fnameescape(expand('<sfile>:p:h:h').'/jsx-config.vim')
fu! <SID>EnableJSX()
if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif
if g:jsx_ext_required && !exists('b:jsx_ext_found') | 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
endif

View File

@ -9,13 +9,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Do nothing if we don't find the @jsx pragma (and we care).
exec 'source '.fnameescape(expand('<sfile>:p:h:h').'/jsx-config.vim')
if g:jsx_pragma_required && !b:jsx_pragma_found | finish | endif
" Do nothing if we don't have the .jsx extension (and we care).
if g:jsx_ext_required && !exists('b:jsx_ext_found') | finish | endif
" Prologue; load in XML indentation. " Prologue; load in XML indentation.
if exists('b:did_indent') if exists('b:did_indent')
let s:did_indent=b:did_indent let s:did_indent=b:did_indent

View File

@ -1,37 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vimscript file
"
" Set up a bunch of configuration variables.
"
" Also check (if desired) whether or not the @jsx pragma is correctly included
" in '%'. Set the result in b:jsx_pragma_found.
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Only check once.
if exists('b:jsx_pragma_found')
finish
endif
" Whether the .jsx extension is required to enable JSX syntax/indent.
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 1
endif
" Whether the @jsx pragma is required to enable JSX syntax/indent.
if !exists('g:jsx_pragma_required')
let g:jsx_pragma_required = 0
endif
if !g:jsx_pragma_required | finish | endif
" Look for the @jsx pragma. It must be included in a docblock comment before
" anything else in the file (except whitespace).
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
endif

View File

@ -11,13 +11,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Do nothing if we don't find the @jsx pragma (and we care).
exec 'source '.fnameescape(expand('<sfile>:p:h:h').'/jsx-config.vim')
if g:jsx_pragma_required && !b:jsx_pragma_found | finish | endif
" Do nothing if we don't have the .jsx extension (and we care).
if g:jsx_ext_required && !exists('b:jsx_ext_found') | finish | endif
" Prologue; load in XML syntax. " Prologue; load in XML syntax.
if exists('b:current_syntax') if exists('b:current_syntax')
let s:current_syntax=b:current_syntax let s:current_syntax=b:current_syntax
@ -28,9 +21,24 @@ if exists('s:current_syntax')
let b:current_syntax=s:current_syntax let b:current_syntax=s:current_syntax
endif 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
" Highlight JSX regions as XML; recursively match. " 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=@XMLSyntax,jsxRegion,jsBlock,javascriptBlock syn region jsxRegion contains=@XMLSyntax,jsxRegion,jsBlock,javascriptBlock
\ start=+<\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+ \ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
\ skip=+<!--\_.\{-}-->+ \ skip=+<!--\_.\{-}-->+
\ end=+</\z1\_\s\{-}>+ \ end=+</\z1\_\s\{-}>+
\ end=+/>+ \ end=+/>+
@ -45,7 +53,6 @@ syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
syn cluster jsExpression add=jsxRegion syn cluster jsExpression add=jsxRegion
" Allow jsxRegion to contain reserved words. " Allow jsxRegion to contain reserved words.
" See: https://github.com/othree/yajs.vim
syn cluster javascriptNoReserved add=jsxRegion syn cluster javascriptNoReserved add=jsxRegion
endif endif

View File

@ -1,11 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
if !exists('g:rust_conceal') || !has('conceal') || &enc != 'utf-8' if !exists('g:rust_conceal') || g:rust_conceal == 0 || !has('conceal') || &enc != 'utf-8'
finish finish
endif endif
" For those who don't want to see `::`... " For those who don't want to see `::`...
if exists('g:rust_conceal_mod_path') if exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
syn match rustNiceOperator "::" conceal cchar= syn match rustNiceOperator "::" conceal cchar=
endif endif
@ -20,7 +20,7 @@ syn match rustNiceOperator "=>" contains=rustFatRightArrowHead,rustFatRightArrow
syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar= syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar=
" For those who don't want to see `pub`... " For those who don't want to see `pub`...
if exists('g:rust_conceal_pub') if exists('g:rust_conceal_pub') && g:rust_conceal_pub != 0
syn match rustPublicSigil contained "pu" conceal cchar= syn match rustPublicSigil contained "pu" conceal cchar=
syn match rustPublicRest contained "b" conceal cchar=  syn match rustPublicRest contained "b" conceal cchar= 
syn match rustNiceOperator "pub " contains=rustPublicSigil,rustPublicRest syn match rustNiceOperator "pub " contains=rustPublicSigil,rustPublicRest
@ -28,7 +28,7 @@ endif
hi link rustNiceOperator Operator hi link rustNiceOperator Operator
if !exists('g:rust_conceal_mod_path') if !exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
hi! link Conceal Operator hi! link Conceal Operator
endif endif

View File

@ -36,72 +36,74 @@ endfunction
" Run {{{1 " Run {{{1
function! rust#Run(bang, args) function! rust#Run(bang, args)
let args = s:ShellTokenize(a:args)
if a:bang if a:bang
let idx = index(a:args, '--') let idx = index(l:args, '--')
if idx != -1 if idx != -1
let rustc_args = idx == 0 ? [] : a:args[:idx-1] let rustc_args = idx == 0 ? [] : l:args[:idx-1]
let args = a:args[idx+1:] let args = l:args[idx+1:]
else else
let rustc_args = a:args let rustc_args = l:args
let args = [] let args = []
endif endif
else else
let rustc_args = [] let rustc_args = []
let args = a:args
endif endif
let b:rust_last_rustc_args = rustc_args let b:rust_last_rustc_args = l:rustc_args
let b:rust_last_args = args let b:rust_last_args = l:args
call s:WithPath(function("s:Run"), rustc_args, args) call s:WithPath(function("s:Run"), rustc_args, args)
endfunction endfunction
function! s:Run(path, rustc_args, args) function! s:Run(dict, rustc_args, args)
try let exepath = a:dict.tmpdir.'/'.fnamemodify(a:dict.path, ':t:r')
let exepath = tempname() if has('win32')
if has('win32') let exepath .= '.exe'
let exepath .= '.exe' endif
endif
let rustc_args = [a:path, '-o', exepath] + a:rustc_args let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
let rustc_args = [relpath, '-o', exepath] + a:rustc_args
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
let output = system(shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)'))) let pwd = a:dict.istemp ? a:dict.tmpdir : ''
if output != '' let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)')))
echohl WarningMsg if output != ''
echo output echohl WarningMsg
echohl None echo output
endif echohl None
if !v:shell_error endif
exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)')) if !v:shell_error
endif exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)'))
finally endif
if exists("exepath")
silent! call delete(exepath)
endif
endtry
endfunction endfunction
" Expand {{{1 " Expand {{{1
function! rust#Expand(bang, args) function! rust#Expand(bang, args)
if a:bang && !empty(a:args) let args = s:ShellTokenize(a:args)
let pretty = a:args[0] if a:bang && !empty(l:args)
let args = a:args[1:] let pretty = remove(l:args, 0)
else else
let pretty = "expanded" let pretty = "expanded"
let args = a:args
endif endif
call s:WithPath(function("s:Expand"), pretty, args) call s:WithPath(function("s:Expand"), pretty, args)
endfunction endfunction
function! s:Expand(path, pretty, args) function! s:Expand(dict, pretty, args)
try try
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
let args = [a:path, '--pretty', a:pretty] + a:args if a:pretty =~? '^\%(everybody_loops$\|flowgraph=\)'
let output = system(shellescape(rustc) . " " . join(map(args, "shellescape(v:val)"))) let flag = '--xpretty'
else
let flag = '--pretty'
endif
let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
let args = [relpath, '-Z', 'unstable-options', l:flag, a:pretty] + a:args
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)')))
if v:shell_error if v:shell_error
echohl WarningMsg echohl WarningMsg
echo output echo output
@ -115,6 +117,20 @@ function! s:Expand(path, pretty, args)
setl buftype=nofile setl buftype=nofile
setl bufhidden=hide setl bufhidden=hide
setl noswapfile setl noswapfile
" give the buffer a nice name
let suffix = 1
let basename = fnamemodify(a:dict.path, ':t:r')
while 1
let bufname = basename
if suffix > 1 | let bufname .= ' ('.suffix.')' | endif
let bufname .= '.pretty.rs'
if bufexists(bufname)
let suffix += 1
continue
endif
exe 'silent noautocmd keepalt file' fnameescape(bufname)
break
endwhile
endif endif
endtry endtry
endfunction endfunction
@ -122,7 +138,7 @@ endfunction
function! rust#CompleteExpand(lead, line, pos) function! rust#CompleteExpand(lead, line, pos)
if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$' if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$'
" first argument and it has a ! " first argument and it has a !
let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph="] let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"]
if !empty(a:lead) if !empty(a:lead)
call filter(list, "v:val[:len(a:lead)-1] == a:lead") call filter(list, "v:val[:len(a:lead)-1] == a:lead")
endif endif
@ -135,72 +151,120 @@ endfunction
" Emit {{{1 " Emit {{{1
function! rust#Emit(type, args) function! rust#Emit(type, args)
call s:WithPath(function("s:Emit"), a:type, a:args) let args = s:ShellTokenize(a:args)
call s:WithPath(function("s:Emit"), a:type, args)
endfunction endfunction
function! s:Emit(path, type, args) function! s:Emit(dict, type, args)
try try
let output_path = a:dict.tmpdir.'/output'
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
let args = [a:path, '--emit', a:type, '-o', '-'] + a:args let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
let output = system(shellescape(rustc) . " " . join(map(args, "shellescape(v:val)"))) let args = [relpath, '--emit', a:type, '-o', output_path] + a:args
if v:shell_error let pwd = a:dict.istemp ? a:dict.tmpdir : ''
let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)')))
if output != ''
echohl WarningMsg echohl WarningMsg
echo output echo output
echohl None echohl None
else endif
if !v:shell_error
new new
silent put =output exe 'silent keepalt read' fnameescape(output_path)
1 1
d d
if a:type == "ir" if a:type == "llvm-ir"
setl filetype=llvm setl filetype=llvm
let extension = 'll'
elseif a:type == "asm" elseif a:type == "asm"
setl filetype=asm setl filetype=asm
let extension = 's'
endif endif
setl buftype=nofile setl buftype=nofile
setl bufhidden=hide setl bufhidden=hide
setl noswapfile setl noswapfile
if exists('l:extension')
" give the buffer a nice name
let suffix = 1
let basename = fnamemodify(a:dict.path, ':t:r')
while 1
let bufname = basename
if suffix > 1 | let bufname .= ' ('.suffix.')' | endif
let bufname .= '.'.extension
if bufexists(bufname)
let suffix += 1
continue
endif
exe 'silent noautocmd keepalt file' fnameescape(bufname)
break
endwhile
endif
endif endif
endtry endtry
endfunction endfunction
" Utility functions {{{1 " Utility functions {{{1
" Invokes func(dict, ...)
" Where {dict} is a dictionary with the following keys:
" 'path' - The path to the file
" 'tmpdir' - The path to a temporary directory that will be deleted when the
" function returns.
" 'istemp' - 1 if the path is a file inside of {dict.tmpdir} or 0 otherwise.
" If {istemp} is 1 then an additional key is provided:
" 'tmpdir_relpath' - The {path} relative to the {tmpdir}.
"
" {dict.path} may be a path to a file inside of {dict.tmpdir} or it may be the
" existing path of the current buffer. If the path is inside of {dict.tmpdir}
" then it is guaranteed to have a '.rs' extension.
function! s:WithPath(func, ...) function! s:WithPath(func, ...)
let buf = bufnr('')
let saved = {}
let dict = {}
try try
let save_write = &write let saved.write = &write
set write set write
let path = expand('%') let dict.path = expand('%')
let pathisempty = empty(path) let pathisempty = empty(dict.path)
if pathisempty || !save_write
" use a temporary file named 'unnamed.rs' inside a temporary
" directory. This produces better error messages
let tmpdir = tempname()
call mkdir(tmpdir)
let save_cwd = getcwd() " Always create a tmpdir in case the wrapped command wants it
silent exe 'lcd' fnameescape(tmpdir) let dict.tmpdir = tempname()
call mkdir(dict.tmpdir)
let path = 'unnamed.rs' if pathisempty || !saved.write
let dict.istemp = 1
" if we're doing this because of nowrite, preserve the filename
if !pathisempty
let filename = expand('%:t:r').".rs"
else
let filename = 'unnamed.rs'
endif
let dict.tmpdir_relpath = filename
let dict.path = dict.tmpdir.'/'.filename
let save_mod = &mod let saved.mod = &mod
set nomod set nomod
silent exe 'keepalt write! ' . fnameescape(path) silent exe 'keepalt write! ' . fnameescape(dict.path)
if pathisempty if pathisempty
silent keepalt 0file silent keepalt 0file
endif endif
else else
let dict.istemp = 0
update update
endif endif
call call(a:func, [path] + a:000) call call(a:func, [dict] + a:000)
finally finally
if exists("save_mod") | let &mod = save_mod | endif if bufexists(buf)
if exists("save_write") | let &write = save_write | endif for [opt, value] in items(saved)
if exists("save_cwd") | silent exe 'lcd' fnameescape(save_cwd) | endif silent call setbufvar(buf, '&'.opt, value)
if exists("tmpdir") | silent call s:RmDir(tmpdir) | endif unlet value " avoid variable type mismatches
endfor
endif
if has_key(dict, 'tmpdir') | silent call s:RmDir(dict.tmpdir) | endif
endtry endtry
endfunction endfunction
@ -210,6 +274,71 @@ function! rust#AppendCmdLine(text)
return cmd return cmd
endfunction endfunction
" Tokenize the string according to sh parsing rules
function! s:ShellTokenize(text)
" states:
" 0: start of word
" 1: unquoted
" 2: unquoted backslash
" 3: double-quote
" 4: double-quoted backslash
" 5: single-quote
let l:state = 0
let l:current = ''
let l:args = []
for c in split(a:text, '\zs')
if l:state == 0 || l:state == 1 " unquoted
if l:c ==# ' '
if l:state == 0 | continue | endif
call add(l:args, l:current)
let l:current = ''
let l:state = 0
elseif l:c ==# '\'
let l:state = 2
elseif l:c ==# '"'
let l:state = 3
elseif l:c ==# "'"
let l:state = 5
else
let l:current .= l:c
let l:state = 1
endif
elseif l:state == 2 " unquoted backslash
if l:c !=# "\n" " can it even be \n?
let l:current .= l:c
endif
let l:state = 1
elseif l:state == 3 " double-quote
if l:c ==# '\'
let l:state = 4
elseif l:c ==# '"'
let l:state = 1
else
let l:current .= l:c
endif
elseif l:state == 4 " double-quoted backslash
if stridx('$`"\', l:c) >= 0
let l:current .= l:c
elseif l:c ==# "\n" " is this even possible?
" skip it
else
let l:current .= '\'.l:c
endif
let l:state = 3
elseif l:state == 5 " single-quoted
if l:c == "'"
let l:state = 1
else
let l:current .= l:c
endif
endif
endfor
if l:state != 0
call add(l:args, l:current)
endif
return l:args
endfunction
function! s:RmDir(path) function! s:RmDir(path)
" sanity check; make sure it's not empty, /, or $HOME " sanity check; make sure it's not empty, /, or $HOME
if empty(a:path) if empty(a:path)
@ -222,6 +351,66 @@ function! s:RmDir(path)
silent exe "!rm -rf " . shellescape(a:path) silent exe "!rm -rf " . shellescape(a:path)
endfunction endfunction
" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd.
" If {pwd} is the empty string then it doesn't change the cwd.
function! s:system(pwd, cmd)
let cmd = a:cmd
if !empty(a:pwd)
let cmd = 'cd ' . shellescape(a:pwd) . ' && ' . cmd
endif
return system(cmd)
endfunction
" Playpen Support {{{1
" Parts of gist.vim by Yasuhiro Matsumoto <mattn.jp@gmail.com> reused
" gist.vim available under the BSD license, available at
" http://github.com/mattn/gist-vim
function! s:has_webapi()
if !exists("*webapi#http#post")
try
call webapi#http#post()
catch
endtry
endif
return exists("*webapi#http#post")
endfunction
function! rust#Play(count, line1, line2, ...) abort
redraw
let l:rust_playpen_url = get(g:, 'rust_playpen_url', 'https://play.rust-lang.org/')
let l:rust_shortener_url = get(g:, 'rust_shortener_url', 'https://is.gd/')
if !s:has_webapi()
echohl ErrorMsg | echomsg ':RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None
return
endif
let bufname = bufname('%')
if a:count < 1
let content = join(getline(a:line1, a:line2), "\n")
else
let save_regcont = @"
let save_regtype = getregtype('"')
silent! normal! gvy
let content = @"
call setreg('"', save_regcont, save_regtype)
endif
let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content)
if strlen(body) > 5000
echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None
return
endif
let payload = "format=simple&url=".webapi#http#encodeURI(body)
let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {})
let url = res.content
redraw | echomsg 'Done: '.url
endfunction
" }}}1 " }}}1
" vim: set noet sw=4 ts=4: " vim: set noet sw=4 ts=4:

83
autoload/rustfmt.vim Normal file
View File

@ -0,0 +1,83 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Author: Stephen Sugden <stephen@stephensugden.com>
"
" Adapted from https://github.com/fatih/vim-go
if !exists("g:rustfmt_autosave")
let g:rustfmt_autosave = 0
endif
if !exists("g:rustfmt_command")
let g:rustfmt_command = "rustfmt"
endif
if !exists("g:rustfmt_options")
let g:rustfmt_options = ""
endif
if !exists("g:rustfmt_fail_silently")
let g:rustfmt_fail_silently = 0
endif
let s:got_fmt_error = 0
function! rustfmt#Format()
let l:curw = winsaveview()
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt"
call writefile(getline(1, '$'), l:tmpname)
let command = g:rustfmt_command . " --write-mode=overwrite "
let out = systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname))
if v:shell_error == 0
" remove undo point caused via BufWritePre
try | silent undojoin | catch | endtry
" Replace current file with temp file, then reload buffer
call rename(l:tmpname, expand('%'))
silent edit!
let &syntax = &syntax
" only clear location list if it was previously filled to prevent
" clobbering other additions
if s:got_fmt_error
let s:got_fmt_error = 0
call setloclist(0, [])
lwindow
endif
elseif g:rustfmt_fail_silently == 0
" otherwise get the errors and put them in the location list
let errors = []
for line in out
" src/lib.rs:13:5: 13:10 error: expected `,`, or `}`, found `value`
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\):\s*\(\d\+:\d\+\s*\)\?\s*error: \(.*\)')
if !empty(tokens)
call add(errors, {"filename": @%,
\"lnum": tokens[2],
\"col": tokens[3],
\"text": tokens[5]})
endif
endfor
if empty(errors)
% | " Couldn't detect rustfmt error format, output errors
endif
if !empty(errors)
call setloclist(0, errors, 'r')
echohl Error | echomsg "rustfmt returned error" | echohl None
endif
let s:got_fmt_error = 1
lwindow
" We didn't use the temp file, so clean up
call delete(l:tmpname)
endif
call winrestview(l:curw)
endfunction
endif

View File

@ -24,7 +24,7 @@ CompilerSet errorformat=
\%f:%l:\ %tarning:\ %m, \%f:%l:\ %tarning:\ %m,
\%E%.%#:in\ `load':\ %f:%l:%m, \%E%.%#:in\ `load':\ %f:%l:%m,
\%E%f:%l:in\ `%*[^']':\ %m, \%E%f:%l:in\ `%*[^']':\ %m,
\%-Z\ \ \ \ \ \#\ %f:%l:%.%#, \%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#,
\%E\ \ %\\d%\\+)%.%#, \%E\ \ %\\d%\\+)%.%#,
\%C\ \ \ \ \ %m, \%C\ \ \ \ \ %m,
\%-G%.%# \%-G%.%#

View File

@ -17,7 +17,7 @@ if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args> command -nargs=* CompilerSet setlocal <args>
endif endif
if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent == 1 if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0
CompilerSet makeprg=rustc CompilerSet makeprg=rustc
else else
CompilerSet makeprg=rustc\ \% CompilerSet makeprg=rustc\ \%

View File

@ -134,6 +134,30 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1
autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 1
endif
if !exists('g:jsx_pragma_required')
let g:jsx_pragma_required = 0
endif
if g:jsx_pragma_required
" Look for the @jsx pragma. It must be included in a docblock comment before
" anything else in the file (except whitespace).
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
endif
fu! <SID>EnableJSX()
if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif
if g:jsx_ext_required && !exists('b:jsx_ext_found') | 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
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
autocmd BufNewFile,BufRead *.json set filetype=json autocmd BufNewFile,BufRead *.json set filetype=json
@ -205,7 +229,7 @@ au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/*,*/nginx/vhosts.d/*,nginx.c
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'opencl') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'opencl') == -1
au BufRead,BufNewFile *.cl set filetype=opencl au! BufRead,BufNewFile *.cl set filetype=opencl
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
@ -327,7 +351,17 @@ autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
autocmd BufNewFile,BufRead *.swift set filetype=swift autocmd BufNewFile,BufRead *.swift setfiletype swift
autocmd BufRead * call s:Swift()
function! s:Swift()
if !empty(&filetype)
return
endif
let line = getline(1)
if line =~ "^#!.*swift"
setfiletype swift
endif
endfunction
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'systemd') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'systemd') == -1

View File

@ -46,7 +46,7 @@ endif
setlocal formatoptions-=t formatoptions+=croql setlocal formatoptions-=t formatoptions+=croql
setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\) setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\)
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\%(\.rb\)\=$','.rb','')
setlocal suffixesadd=.rb setlocal suffixesadd=.rb
if exists("&ofu") && has("ruby") if exists("&ofu") && has("ruby")
@ -361,7 +361,7 @@ function! RubyCursorFile() abort
endtry endtry
let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!') let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!')
let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*') let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*')
let ext = getline('.') =~# '^\s*\%(require\|autoload\)\>' ? '.rb' : '' let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : ''
if s:synname() ==# 'rubyConstant' if s:synname() ==# 'rubyConstant'
let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','') let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
let cfile = substitute(cfile,'::','/','g') let cfile = substitute(cfile,'::','/','g')
@ -369,7 +369,7 @@ function! RubyCursorFile() abort
let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g') let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g')
return tolower(cfile) . '.rb' return tolower(cfile) . '.rb'
elseif getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$' elseif getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$'
let cfile = expand('%:p:h') . '/' . matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') . '.rb' let cfile = expand('%:p:h') . '/' . matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') . ext
elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\%(::\)\=File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$' elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\%(::\)\=File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$'
let target = matchstr(getline('.'),'\(["'']\)\.\.\zs/.\{-\}\ze\1') let target = matchstr(getline('.'),'\(["'']\)\.\.\zs/.\{-\}\ze\1')
let cfile = expand('%:p:h') . target . ext let cfile = expand('%:p:h') . target . ext

View File

@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Description: Vim syntax file for Rust " Description: Vim syntax file for Rust
" Maintainer: Chris Morgan <me@chrismorgan.info> " Maintainer: Chris Morgan <me@chrismorgan.info>
" Maintainer: Kevin Ballard <kevin@sb.org> " Maintainer: Kevin Ballard <kevin@sb.org>
" Last Change: Jul 07, 2014 " Last Change: January 29, 2015
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
finish finish
@ -20,7 +20,7 @@ set cpo&vim
" comments, so we'll use that as our default, but make it easy to switch. " comments, so we'll use that as our default, but make it easy to switch.
" This does not affect indentation at all (I tested it with and without " This does not affect indentation at all (I tested it with and without
" leader), merely whether a leader is inserted by default or not. " leader), merely whether a leader is inserted by default or not.
if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader == 1 if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0
" Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why,
" but without it, */ gets indented one space even if there were no " but without it, */ gets indented one space even if there were no
" leaders. I'm fairly sure that's a Vim bug. " leaders. I'm fairly sure that's a Vim bug.
@ -37,7 +37,7 @@ silent! setlocal formatoptions+=j
" otherwise it's better than nothing. " otherwise it's better than nothing.
setlocal smartindent nocindent setlocal smartindent nocindent
if !exists("g:rust_recommended_style") || g:rust_recommended_style == 1 if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0
setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
setlocal textwidth=99 setlocal textwidth=99
endif endif
@ -69,7 +69,7 @@ if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
endif endif
endif endif
if has('conceal') && exists('g:rust_conceal') if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0
let b:rust_set_conceallevel=1 let b:rust_set_conceallevel=1
setlocal conceallevel=2 setlocal conceallevel=2
endif endif
@ -84,19 +84,35 @@ xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR>
onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR> onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR>
onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR> onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR>
" %-matching. <:> is handy for generics.
set matchpairs+=<:>
" There are two minor issues with it; (a) comparison operators in expressions,
" where a less-than may match a greater-than later on—this is deemed a trivial
" issue—and (b) `Fn() -> X` syntax. This latter issue is irremediable from the
" highlighting perspective (built into Vim), but the actual % functionality
" can be fixed by this use of matchit.vim.
let b:match_skip = 's:comment\|string\|rustArrow'
source $VIMRUNTIME/macros/matchit.vim
" Commands {{{1 " Commands {{{1
" See |:RustRun| for docs " See |:RustRun| for docs
command! -nargs=* -complete=file -bang -bar -buffer RustRun call rust#Run(<bang>0, [<f-args>]) command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(<bang>0, <q-args>)
" See |:RustExpand| for docs " See |:RustExpand| for docs
command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -bar -buffer RustExpand call rust#Expand(<bang>0, [<f-args>]) command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(<bang>0, <q-args>)
" See |:RustEmitIr| for docs " See |:RustEmitIr| for docs
command! -nargs=* -bar -buffer RustEmitIr call rust#Emit("ir", [<f-args>]) command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", <q-args>)
" See |:RustEmitAsm| for docs " See |:RustEmitAsm| for docs
command! -nargs=* -bar -buffer RustEmitAsm call rust#Emit("asm", [<f-args>]) command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>)
" See |:RustPlay| for docs
command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>)
" See |:RustFmt| for docs
command! -buffer RustFmt call rustfmt#Format()
" Mappings {{{1 " Mappings {{{1
@ -134,6 +150,7 @@ let b:undo_ftplugin = "
\|delcommand RustExpand \|delcommand RustExpand
\|delcommand RustEmitIr \|delcommand RustEmitIr
\|delcommand RustEmitAsm \|delcommand RustEmitAsm
\|delcommand RustPlay
\|nunmap <buffer> <D-r> \|nunmap <buffer> <D-r>
\|nunmap <buffer> <D-R> \|nunmap <buffer> <D-R>
\|nunmap <buffer> [[ \|nunmap <buffer> [[
@ -142,6 +159,8 @@ let b:undo_ftplugin = "
\|xunmap <buffer> ]] \|xunmap <buffer> ]]
\|ounmap <buffer> [[ \|ounmap <buffer> [[
\|ounmap <buffer> ]] \|ounmap <buffer> ]]
\|set matchpairs-=<:>
\|unlet b:match_skip
\" \"
" }}}1 " }}}1

8
ftplugin/swift.vim Normal file
View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
setlocal commentstring=//\ %s
" @-@ adds the literal @ to iskeyword for @IBAction and similar
setlocal iskeyword+=@-@,#
setlocal completefunc=syntaxcomplete#Complete
endif

104
indent/handlebars.vim Normal file
View File

@ -0,0 +1,104 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1
" Mustache & Handlebars syntax
" Language: Mustache, Handlebars
" Maintainer: Juvenn Woo <machese@gmail.com>
" Screenshot: http://imgur.com/6F408
" Version: 2
" Last Change: Oct 10th 2015
" Remarks: based on eruby indent plugin by tpope
" References:
" [Mustache](http://github.com/defunkt/mustache)
" [Handlebars](https://github.com/wycats/handlebars.js)
" [ctemplate](http://code.google.com/p/google-ctemplate/)
" [ctemplate doc](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html)
" [et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html)
if exists("b:did_indent_hbs")
finish
endif
unlet! b:did_indent
setlocal indentexpr=
runtime! indent/html.vim
unlet! b:did_indent
" Force HTML indent to not keep state.
let b:html_indent_usestate = 0
if &l:indentexpr == ''
if &l:cindent
let &l:indentexpr = 'cindent(v:lnum)'
else
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
endif
endif
let b:handlebars_subtype_indentexpr = &l:indentexpr
let b:did_indent = 1
let b:did_indent_hbs = 1
setlocal indentexpr=GetHandlebarsIndent()
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when
" Only define the function once.
if exists("*GetHandlebarsIndent")
finish
endif
function! GetHandlebarsIndent(...)
" The value of a single shift-width
if exists('*shiftwidth')
let sw = shiftwidth()
else
let sw = &sw
endif
if a:0 && a:1 == '.'
let v:lnum = line('.')
elseif a:0 && a:1 =~ '^\d'
let v:lnum = a:1
endif
let vcol = col('.')
call cursor(v:lnum,1)
call cursor(v:lnum,vcol)
exe "let ind = ".b:handlebars_subtype_indentexpr
" Workaround for Andy Wokula's HTML indent. This should be removed after
" some time, since the newest version is fixed in a different way.
if b:handlebars_subtype_indentexpr =~# '^HtmlIndent('
\ && exists('b:indent')
\ && type(b:indent) == type({})
\ && has_key(b:indent, 'lnum')
" Force HTML indent to not keep state
let b:indent.lnum = -1
endif
let lnum = prevnonblank(v:lnum-1)
let line = getline(lnum)
let cline = getline(v:lnum)
" all indent rules only apply if the block opening/closing
" tag is on a separate line
" indent after block {{#block
if line =~# '\v\s*\{\{\#.*\s*'
let ind = ind + sw
endif
" unindent after block close {{/block}}
if cline =~# '\v^\s*\{\{\/\S*\}\}\s*'
let ind = ind - sw
endif
" unindent {{else}}
if cline =~# '\v^\s*\{\{else.*\}\}\s*$'
let ind = ind - sw
endif
" indent again after {{else}}
if line =~# '\v^\s*\{\{else.*\}\}\s*$'
let ind = ind + sw
endif
return ind
endfunction
endif

View File

@ -123,6 +123,13 @@ function GetRustIndent(lnum)
let prevlinenum = prevnonblank(prevlinenum - 1) let prevlinenum = prevnonblank(prevlinenum - 1)
let prevline = s:get_line_trimmed(prevlinenum) let prevline = s:get_line_trimmed(prevlinenum)
endwhile endwhile
" Handle where clauses nicely: subsequent values should line up nicely.
if prevline[len(prevline) - 1] == ","
\ && prevline =~# '^\s*where\s'
return indent(prevlinenum) + 6
endif
if prevline[len(prevline) - 1] == "," if prevline[len(prevline) - 1] == ","
\ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]'
\ && prevline !~ '^\s*fn\s' \ && prevline !~ '^\s*fn\s'

View File

@ -1,19 +1,230 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
" Language: Swift<https://developer.apple.com/swift/> " File: swift.vim
" Maintainer: toyama satoshi <toyamarinyon@gmail.com> " Author: Keith Smiley
" URL: http://github.com/toyamarinyon/vim-swift " Description: The indent file for Swift
" License: GPL " Last Modified: December 05, 2014
" Only load this indent file when no other was loaded.
if exists("b:did_indent") if exists("b:did_indent")
finish finish
endif endif
let b:did_indent = 1 let b:did_indent = 1
" C indenting is built-in, thus this is very simple let s:cpo_save = &cpo
setlocal cindent set cpo&vim
let b:undo_indent = "setl cin<" setlocal nosmartindent
setlocal indentkeys-=:
setlocal indentkeys-=e
setlocal indentkeys+=0]
setlocal indentexpr=SwiftIndent()
function! s:NumberOfMatches(char, string, index)
let instances = 0
let i = 0
while i < strlen(a:string)
if a:string[i] == a:char && !s:IsExcludedFromIndentAtPosition(a:index, i + 1)
let instances += 1
endif
let i += 1
endwhile
return instances
endfunction
function! s:SyntaxNameAtPosition(line, column)
return synIDattr(synID(a:line, a:column, 0), "name")
endfunction
function! s:SyntaxName()
return s:SyntaxNameAtPosition(line("."), col("."))
endfunction
function! s:IsExcludedFromIndentAtPosition(line, column)
let name = s:SyntaxNameAtPosition(a:line, a:column)
return name ==# "swiftComment" || name ==# "swiftString"
endfunction
function! s:IsExcludedFromIndent()
return s:SyntaxName() ==# "swiftComment" || s:SyntaxName() ==# "swiftString"
endfunction
function! s:IsCommentLine(lnum)
return synIDattr(synID(a:lnum,
\ match(getline(a:lnum), "\S") + 1, 0), "name")
\ ==# "swiftComment"
endfunction
function! SwiftIndent(...)
let clnum = a:0 ? a:1 : v:lnum
let line = getline(clnum)
let previousNum = prevnonblank(clnum - 1)
while s:IsCommentLine(previousNum) != 0
let previousNum = prevnonblank(previousNum - 1)
endwhile
let previous = getline(previousNum)
let cindent = cindent(clnum)
let previousIndent = indent(previousNum)
let numOpenParens = s:NumberOfMatches("(", previous, previousNum)
let numCloseParens = s:NumberOfMatches(")", previous, previousNum)
let numOpenBrackets = s:NumberOfMatches("{", previous, previousNum)
let numCloseBrackets = s:NumberOfMatches("}", previous, previousNum)
let currentOpenBrackets = s:NumberOfMatches("{", line, clnum)
let currentCloseBrackets = s:NumberOfMatches("}", line, clnum)
let numOpenSquare = s:NumberOfMatches("[", previous, previousNum)
let numCloseSquare = s:NumberOfMatches("]", previous, previousNum)
let currentCloseSquare = s:NumberOfMatches("]", line, clnum)
if numOpenSquare > numCloseSquare && currentCloseSquare < 1
return previousIndent + shiftwidth()
endif
if currentCloseSquare > 0 && line !~ '\v\[.*\]'
let column = col(".")
call cursor(line("."), 1)
let openingSquare = searchpair("\\[", "", "\\]", "bWn", "s:IsExcludedFromIndent()")
call cursor(line("."), column)
if openingSquare == 0
return -1
endif
return indent(openingSquare)
endif
if s:IsExcludedFromIndent()
return previousIndent
endif
if line =~ ":$"
let switch = search("switch", "bWn")
return indent(switch)
elseif previous =~ ":$"
return previousIndent + shiftwidth()
endif
if numOpenParens == numCloseParens
if numOpenBrackets > numCloseBrackets
if currentCloseBrackets > currentOpenBrackets || line =~ "\\v^\\s*}"
let column = col(".")
call cursor(line("."), 1)
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
call cursor(line("."), column)
if openingBracket == 0
return -1
else
return indent(openingBracket)
endif
endif
return previousIndent + shiftwidth()
elseif previous =~ "}.*{"
if line =~ "\\v^\\s*}"
return previousIndent
endif
return previousIndent + shiftwidth()
elseif line =~ "}.*{"
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
return indent(openingBracket)
elseif currentCloseBrackets > currentOpenBrackets
let column = col(".")
call cursor(line("."), 1)
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
call cursor(line("."), column)
let bracketLine = getline(openingBracket)
let numOpenParensBracketLine = s:NumberOfMatches("(", bracketLine, openingBracket)
let numCloseParensBracketLine = s:NumberOfMatches(")", bracketLine, openingBracket)
if numCloseParensBracketLine > numOpenParensBracketLine
let line = line(".")
let column = col(".")
call cursor(openingParen, column)
let openingParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
call cursor(line, column)
return indent(openingParen)
endif
return indent(openingBracket)
else
return -1
endif
endif
if numCloseParens > 0
if currentOpenBrackets > 0 || currentCloseBrackets > 0
if currentOpenBrackets > 0
if numOpenBrackets > numCloseBrackets
return previousIndent + shiftwidth()
endif
if line =~ "}.*{"
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
return indent(openingBracket)
endif
if numCloseParens > numOpenParens
let line = line(".")
let column = col(".")
call cursor(line - 1, column)
let openingParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
call cursor(line, column)
return indent(openingParen)
endif
return previousIndent
endif
if currentCloseBrackets > 0
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
return indent(openingBracket)
endif
return cindent
endif
if numCloseParens < numOpenParens
if numOpenBrackets > numCloseBrackets
return previousIndent + shiftwidth()
endif
let previousParen = match(previous, "(")
return previousParen + 1
endif
if numOpenBrackets > numCloseBrackets
let line = line(".")
let column = col(".")
call cursor(previousNum, column)
let openingParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
call cursor(line, column)
return indent(openingParen) + shiftwidth()
endif
let line = line(".")
let column = col(".")
call cursor(previousNum, column)
let openingParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
call cursor(line, column)
return indent(openingParen)
endif
if numOpenParens > 0
let previousParen = match(previous, "(")
return previousParen + 1
endif
return cindent
endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
endif endif

View File

@ -25,7 +25,8 @@ endif
" C++ extensions " C++ extensions
syn keyword cppStatement new delete this friend using syn keyword cppStatement new delete this friend using
syn keyword cppAccess public protected private syn keyword cppAccess public protected private
syn keyword cppType inline virtual explicit export bool wchar_t syn keyword cppModifier inline virtual explicit export
syn keyword cppType bool wchar_t
syn keyword cppExceptions throw try catch syn keyword cppExceptions throw try catch
syn keyword cppOperator operator typeid syn keyword cppOperator operator typeid
syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
@ -38,7 +39,8 @@ syn keyword cppConstant __cplusplus
" C++ 11 extensions " C++ 11 extensions
if !exists("cpp_no_cpp11") if !exists("cpp_no_cpp11")
syn keyword cppType override final syn keyword cppModifier override final
syn keyword cppType nullptr_t
syn keyword cppExceptions noexcept syn keyword cppExceptions noexcept
syn keyword cppStorageClass constexpr decltype thread_local syn keyword cppStorageClass constexpr decltype thread_local
syn keyword cppConstant nullptr syn keyword cppConstant nullptr
@ -72,6 +74,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
HiLink cppExceptions Exception HiLink cppExceptions Exception
HiLink cppOperator Operator HiLink cppOperator Operator
HiLink cppStatement Statement HiLink cppStatement Statement
HiLink cppModifier Type
HiLink cppType Type HiLink cppType Type
HiLink cppStorageClass StorageClass HiLink cppStorageClass StorageClass
HiLink cppStructure Structure HiLink cppStructure Structure

View File

@ -17,7 +17,7 @@ syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@el
syn match elixirComment '#.*' contains=elixirTodo syn match elixirComment '#.*' contains=elixirTodo
syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
syn keyword elixirKeyword case when cond for if unless try receive send syn keyword elixirKeyword case when cond for if unless try receive spawn send
syn keyword elixirKeyword exit raise throw after rescue catch else do end syn keyword elixirKeyword exit raise throw after rescue catch else do end
syn keyword elixirKeyword quote unquote super syn keyword elixirKeyword quote unquote super

View File

@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
" Language: git rebase --interactive " Language: git rebase --interactive
" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: git-rebase-todo " Filenames: git-rebase-todo
" Last Change: 2012 April 7 " Last Change: 2015 November 21
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
@ -20,6 +20,7 @@ syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseFixup "\v^f%(ixup)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseFixup "\v^f%(ixup)=>" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseExec "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite syn match gitrebaseExec "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite
syn match gitrebaseDrop "\v^d%(rop)=>" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseSummary ".*" contains=gitrebaseHash contained syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
syn match gitrebaseCommand ".*" contained syn match gitrebaseCommand ".*" contained
syn match gitrebaseComment "^#.*" contains=gitrebaseHash syn match gitrebaseComment "^#.*" contains=gitrebaseHash

View File

@ -56,23 +56,23 @@ if !exists("g:go_highlight_trailing_whitespace_error")
endif endif
if !exists("g:go_highlight_operators") if !exists("g:go_highlight_operators")
let g:go_highlight_operators = 0 let g:go_highlight_operators = 0
endif endif
if !exists("g:go_highlight_functions") if !exists("g:go_highlight_functions")
let g:go_highlight_functions = 0 let g:go_highlight_functions = 0
endif endif
if !exists("g:go_highlight_methods") if !exists("g:go_highlight_methods")
let g:go_highlight_methods = 0 let g:go_highlight_methods = 0
endif endif
if !exists("g:go_highlight_structs") if !exists("g:go_highlight_structs")
let g:go_highlight_structs = 0 let g:go_highlight_structs = 0
endif endif
if !exists("g:go_highlight_build_constraints") if !exists("g:go_highlight_build_constraints")
let g:go_highlight_build_constraints = 0 let g:go_highlight_build_constraints = 0
endif endif
if !exists("g:go_highlight_string_spellcheck") if !exists("g:go_highlight_string_spellcheck")
@ -119,8 +119,8 @@ syn match goDeclaration /\<func\>/
" Predefined functions and values " Predefined functions and values
syn keyword goBuiltins append cap close complex copy delete imag len syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/
syn keyword goBuiltins make new panic print println real recover syn match goBuiltins /\<\v(make|new|panic|print|println|real|recover)\ze\(/
syn keyword goBoolean iota true false nil syn keyword goBoolean iota true false nil
hi def link goBuiltins Keyword hi def link goBuiltins Keyword
@ -164,7 +164,7 @@ syn match goFormatSpecifier /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\
hi def link goString String hi def link goString String
hi def link goRawString String hi def link goRawString String
hi def link goFormatSpecifier goSpecialString hi def link goFormatSpecifier goSpecialString
" Characters; their contents " Characters; their contents
syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
@ -249,55 +249,74 @@ hi def link goTodo Todo
" Operators; " Operators;
if g:go_highlight_operators != 0 if g:go_highlight_operators != 0
" match single-char operators: - + % < > ! & | ^ * = " match single-char operators: - + % < > ! & | ^ * =
" and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= == " and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= ==
syn match goOperator /[-+%<>!&|^*=]=\?/ syn match goOperator /[-+%<>!&|^*=]=\?/
" match / and /= " match / and /=
syn match goOperator /\/\%(=\|\ze[^/*]\)/ syn match goOperator /\/\%(=\|\ze[^/*]\)/
" match two-char operators: << >> &^ " match two-char operators: << >> &^
" and corresponding three-char operators: <<= >>= &^= " and corresponding three-char operators: <<= >>= &^=
syn match goOperator /\%(<<\|>>\|&^\)=\?/ syn match goOperator /\%(<<\|>>\|&^\)=\?/
" match remaining two-char operators: := && || <- ++ -- " match remaining two-char operators: := && || <- ++ --
syn match goOperator /:=\|||\|<-\|++\|--/ syn match goOperator /:=\|||\|<-\|++\|--/
" match ... " match ...
syn match goOperator /\.\.\./ syn match goOperator /\.\.\./
endif endif
hi def link goOperator Operator hi def link goOperator Operator
" Functions; " Functions;
if g:go_highlight_functions != 0 if g:go_highlight_functions != 0
syn match goFunction /\(func\s\+\)\@<=\w\+\((\)\@=/ syn match goFunction /\(func\s\+\)\@<=\w\+\((\)\@=/
syn match goFunction /\()\s\+\)\@<=\w\+\((\)\@=/ syn match goFunction /\()\s\+\)\@<=\w\+\((\)\@=/
endif endif
hi def link goFunction Function hi def link goFunction Function
" Methods; " Methods;
if g:go_highlight_methods != 0 if g:go_highlight_methods != 0
syn match goMethod /\(\.\)\@<=\w\+\((\)\@=/ syn match goMethod /\(\.\)\@<=\w\+\((\)\@=/
endif endif
hi def link goMethod Type hi def link goMethod Type
" Structs; " Structs;
if g:go_highlight_structs != 0 if g:go_highlight_structs != 0
syn match goStruct /\(.\)\@<=\w\+\({\)\@=/ syn match goStruct /\(.\)\@<=\w\+\({\)\@=/
syn match goStructDef /\(type\s\+\)\@<=\w\+\(\s\+struct\s\+{\)\@=/ syn match goStructDef /\(type\s\+\)\@<=\w\+\(\s\+struct\s\+{\)\@=/
endif endif
hi def link goStruct Function hi def link goStruct Function
hi def link goStructDef Function hi def link goStructDef Function
" Build Constraints " Build Constraints
if g:go_highlight_build_constraints != 0 if g:go_highlight_build_constraints != 0
syn keyword goBuildOs contained ignore cgo android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows syn match goBuildKeyword display contained "+build"
syn keyword goBuildArch contained 386 amd64 amd64p32 arm " Highlight the known values of GOOS, GOARCH, and other +build options.
syn match goBuildDirective display contained "+build" syn keyword goBuildDirectives contained
syn region goBuildComment start="//\s*+build" end="$" contains=goBuildDirective,goBuildOs,goBuildArch \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9
syn region goBuildComment start="/\*\s*+build" end="\*/" contains=goBuildDirective,goBuildOs,goBuildArch \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64
endif \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc
\ s390 s390x sparc sparc64 cgo ignore race
hi def link goBuildComment Comment " Other words in the build directive are build tags not listed above, so
hi def link goBuildOs Type " avoid highlighting them as comments by using a matchgroup just for the
hi def link goBuildArch Type " start of the comment.
hi def link goBuildDirective PreProc " The rs=s+2 option lets the \s*+build portion be part of the inner region
" instead of the matchgroup so it will be highlighted as a goBuildKeyword.
syn region goBuildComment matchgroup=goBuildCommentStart
\ start="//\s*+build\s"rs=s+2 end="$"
\ contains=goBuildKeyword,goBuildDirectives
hi def link goBuildCommentStart Comment
hi def link goBuildDirectives Type
hi def link goBuildKeyword PreProc
" One or more line comments that are followed immediately by a "package"
" declaration are treated like package documentation, so these must be
" matched as comments to avoid looking like working build constraints.
" The he, me, and re options let the "package" itself be highlighted by
" the usual rules.
syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/
\ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7
\ contains=@goCommentGroup,@Spell
hi def link goPackageComment Comment
endif
" Search backwards for a global declaration to start processing the syntax. " Search backwards for a global declaration to start processing the syntax.

View File

@ -39,7 +39,7 @@ hi def link goRawString String
" Characters; their contents " Characters; their contents
syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup syn region goCharacter contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup
hi def link goCharacter Character hi def link goCharacter Character
@ -67,7 +67,7 @@ hi def link goImaginary Number
syn cluster gotplLiteral contains=goString,goRawString,goCharacter,@goInt,goFloat,goImaginary syn cluster gotplLiteral contains=goString,goRawString,goCharacter,@goInt,goFloat,goImaginary
syn keyword gotplControl contained if else end range with template syn keyword gotplControl contained if else end range with template
syn keyword gotplFunctions contained and html index js len not or print printf println urlquery eq ne lt le gt ge syn keyword gotplFunctions contained and html index js len not or print printf println urlquery eq ne lt le gt ge
syn match gotplVariable contained /\$[^ ]*\>/ syn match gotplVariable contained /\$[a-zA-Z0-9_]*\>/
syn match goTplIdentifier contained /\.[^\s}]*\>/ syn match goTplIdentifier contained /\.[^\s}]*\>/
hi def link gotplControl Keyword hi def link gotplControl Keyword

View File

@ -18,6 +18,8 @@ silent! syntax include @htmlCoffeescript syntax/coffee.vim
unlet! b:current_syntax unlet! b:current_syntax
silent! syntax include @htmlStylus syntax/stylus.vim silent! syntax include @htmlStylus syntax/stylus.vim
unlet! b:current_syntax unlet! b:current_syntax
silent! syntax include @htmlCss syntax/css.vim
unlet! b:current_syntax
silent! syntax include @htmlMarkdown syntax/markdown.vim silent! syntax include @htmlMarkdown syntax/markdown.vim
unlet! b:current_syntax unlet! b:current_syntax
@ -37,7 +39,7 @@ syn region jadeCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!"
syn region jadeHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" syn region jadeHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->"
syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent
syn match jadeClassChar "\." contained nextgroup=jadeClass syn match jadeClassChar "\." contained nextgroup=jadeClass
syn match jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag syn match jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag,jadeClassChar,jadeIdChar
syn match jadeIdChar "#[[{]\@!" contained nextgroup=jadeId syn match jadeIdChar "#[[{]\@!" contained nextgroup=jadeId
syn match jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent syn match jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent
syn match jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent syn match jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent
@ -69,7 +71,7 @@ syn keyword jadeScriptLoopKeywords for in contained
syn region jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag,jadeCoffeescriptFilter keepend syn region jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag,jadeCoffeescriptFilter keepend
syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffeescript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained
syn region jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag syn region jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag
syn region jadeCssBlock start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend syn region jadeCssBlock start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend

View File

@ -424,7 +424,7 @@ if exists("perl_fold")
endif endif
if exists("perl_fold_blocks") if exists("perl_fold_blocks")
syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)foreach\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)for\%(each\)\=\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
endif endif

View File

@ -521,7 +521,7 @@ syn keyword phpStatement __construct __destruct __call __callStatic __get __set
syn keyword phpKeyword die exit eval empty isset unset list instanceof insteadof contained syn keyword phpKeyword die exit eval empty isset unset list instanceof insteadof contained
" Include & friends " Include & friends
syn keyword phpInclude include include_once require require_once namespace use contained syn keyword phpInclude include include_once require require_once namespace contained
" Types " Types
syn keyword phpType bool[ean] int[eger] real double float string array object null self parent global this stdClass callable contained syn keyword phpType bool[ean] int[eger] real double float string array object null self parent global this stdClass callable contained
@ -681,6 +681,16 @@ syntax match phpClassImplements contained
syntax match phpClassDelimiter contained syntax match phpClassDelimiter contained
\ nextgroup=phpClassImplements skipwhite skipempty /,/ \ nextgroup=phpClassImplements skipwhite skipempty /,/
" use statement
syn keyword phpInclude use contained
\ nextgroup=phpUseFunction,phpUseClass skipwhite skipempty
syn match phpUseFunction /function\_s\+\(\\\|\h\w*\)*\h\w*/ contained contains=phpUseKeyword
\ nextgroup=phpUseAlias skipwhite skipempty
syn match phpUseClass /\(function\_s\+\)\@!\(\\\|\h\w*\)*\h\w*/ contained
\ nextgroup=phpUseAlias skipwhite skipempty
syn match phpUseAlias /as\_s\+\h\w*/ contained contains=phpUseKeyword
syn match phpUseKeyword /\(function\|as\)\_s\+/ contained contains=phpKeyword
" Function name " Function name
syn keyword phpKeyword function contained syn keyword phpKeyword function contained
\ nextgroup=phpFunction skipwhite skipempty \ nextgroup=phpFunction skipwhite skipempty

View File

@ -88,6 +88,7 @@ syn keyword pythonStatement exec return
syn keyword pythonStatement pass raise syn keyword pythonStatement pass raise
syn keyword pythonStatement global assert syn keyword pythonStatement global assert
syn keyword pythonStatement lambda yield syn keyword pythonStatement lambda yield
syn keyword pythonStatement async await
syn keyword pythonStatement with nonlocal True False None syn keyword pythonStatement with nonlocal True False None
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained
@ -210,7 +211,7 @@ if exists("python_highlight_builtins") && python_highlight_builtins != 0
syn keyword pythonBuiltinObj Ellipsis NotImplemented syn keyword pythonBuiltinObj Ellipsis NotImplemented
syn keyword pythonBuiltinFunc __import__ abs all any apply syn keyword pythonBuiltinFunc __import__ abs all any apply
syn keyword pythonBuiltinFunc basestring bool buffer callable syn keyword pythonBuiltinFunc basestring bool buffer bytearray bytes callable
syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex
syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
syn keyword pythonBuiltinFunc execfile file filter float frozenset getattr syn keyword pythonBuiltinFunc execfile file filter float frozenset getattr

View File

@ -32,7 +32,7 @@ endif
" Operators " Operators
if exists("ruby_operators") if exists("ruby_operators")
syn match rubyOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::" syn match rubyOperator "[~!^|*/%+-]\|&\.\@!\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
syn match rubyOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=" syn match rubyOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop
endif endif
@ -82,13 +82,13 @@ syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedPare
syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment
" Numbers and ASCII Codes " Numbers and ASCII Codes
syn match rubyASCIICode "\%(\w\|[]})\"'/\.]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*\>" display syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*r\=i\=\>" display
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)r\=i\=\>" display
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*\>" display syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*r\=i\=\>" display
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*\>" display syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*r\=i\=\>" display
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*r\=i\=\>" display
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)r\=i\=\>" display
" Identifiers " Identifiers
syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
@ -98,7 +98,7 @@ syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>
syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)" syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)"
syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"
syn match rubySymbol "[]})\"':]\@<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" syn match rubySymbol "[]})\"':]\@<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\="
@ -125,11 +125,12 @@ syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|o
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
" Generalized Regular Expression " Generalized Regular Expression
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z(\s\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
" Normal String " Normal String
let s:spell_cluster = exists('ruby_spellcheck_strings') ? ',@Spell' : '' let s:spell_cluster = exists('ruby_spellcheck_strings') ? ',@Spell' : ''
@ -145,12 +146,13 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
syn region rubyString matchgroup=rubyStringDelimiter start="%q " end=" " skip="\\\\\|\\)" fold syn region rubyString matchgroup=rubyStringDelimiter start="%q\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1" skip="\\\\\|\\\z1" fold syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
syn region rubyString matchgroup=rubyStringDelimiter start="%s\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold
" Generalized Double Quoted String and Array of Strings and Shell Command Output " Generalized Double Quoted String and Array of Strings and Shell Command Output
" Note: %= is not matched here as the beginning of a double quoted string " Note: %= is not matched here as the beginning of a double quoted string
@ -160,7 +162,7 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" en
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx] " end=" " skip="\\\\\|\\)" contains=@rubyStringSpecial fold syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx]\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
" Array of Symbols " Array of Symbols
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
@ -203,7 +205,7 @@ syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyC
syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration
syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2
syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter
@ -287,7 +289,7 @@ syn match rubySharpBang "\%^#!.*" display
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell
if !exists("ruby_no_comment_fold") if !exists("ruby_no_comment_fold")
syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend syn region rubyMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend
syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\%(\s.*\)\=$" contains=rubySpaceError,rubyTodo,@Spell fold syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\%(\s.*\)\=$" contains=rubySpaceError,rubyTodo,@Spell fold
else else
syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell

View File

@ -5,7 +5,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Maintainer: Patrick Walton <pcwalton@mozilla.com> " Maintainer: Patrick Walton <pcwalton@mozilla.com>
" Maintainer: Ben Blum <bblum@cs.cmu.edu> " Maintainer: Ben Blum <bblum@cs.cmu.edu>
" Maintainer: Chris Morgan <me@chrismorgan.info> " Maintainer: Chris Morgan <me@chrismorgan.info>
" Last Change: January 5, 2015 " Last Change: January 29, 2015
if version < 600 if version < 600
syntax clear syntax clear
@ -26,9 +26,9 @@ syn keyword rustKeyword continue
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
syn keyword rustKeyword for in if impl let syn keyword rustKeyword for in if impl let
syn keyword rustKeyword loop once pub syn keyword rustKeyword loop pub
syn keyword rustKeyword return super syn keyword rustKeyword return super
syn keyword rustKeyword unsafe virtual where while syn keyword rustKeyword unsafe where while
syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty
" FIXME: Scoped impl's name is also fallen in this category " FIXME: Scoped impl's name is also fallen in this category
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
@ -45,7 +45,6 @@ syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:spac
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained
syn keyword rustBoxPlacementExpr GC containedin=rustBoxPlacement
" Ideally we'd have syntax rules set up to match arbitrary expressions. Since " Ideally we'd have syntax rules set up to match arbitrary expressions. Since
" we don't, we'll just define temporary contained rules to handle balancing " we don't, we'll just define temporary contained rules to handle balancing
" delimiters. " delimiters.
@ -58,13 +57,13 @@ syn match rustMacroRepeatCount ".\?[*+]" contained
syn match rustMacroVariable "$\w\+" syn match rustMacroVariable "$\w\+"
" Reserved (but not yet used) keywords {{{2 " Reserved (but not yet used) keywords {{{2
syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield abstract final override macro syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro
" Built-in types {{{2 " Built-in types {{{2
syn keyword rustType isize usize float char bool u8 u16 u32 u64 f32 syn keyword rustType isize usize char bool u8 u16 u32 u64 f32
syn keyword rustType f64 i8 i16 i32 i64 str Self syn keyword rustType f64 i8 i16 i32 i64 str Self
" Things from the prelude (src/libstd/prelude.rs) {{{2 " Things from the libstd v1 prelude (src/libstd/prelude/v1.rs) {{{2
" This section is just straight transformation of the contents of the prelude, " This section is just straight transformation of the contents of the prelude,
" to make it easy to update. " to make it easy to update.
@ -73,30 +72,27 @@ syn keyword rustTrait Copy Send Sized Sync
syn keyword rustTrait Drop Fn FnMut FnOnce syn keyword rustTrait Drop Fn FnMut FnOnce
" Reexported functions {{{3 " Reexported functions {{{3
syn keyword rustFunction drop " Theres no point in highlighting these; when one writes drop( or drop::< it
" gets the same highlighting anyway, and if someone writes `let drop = …;` we
" dont really want *that* drop to be highlighted.
"syn keyword rustFunction drop
" Reexported types and traits {{{3 " Reexported types and traits {{{3
syn keyword rustTrait Box syn keyword rustTrait Box
syn keyword rustTrait CharExt syn keyword rustTrait ToOwned
syn keyword rustTrait Clone syn keyword rustTrait Clone
syn keyword rustTrait PartialEq PartialOrd Eq Ord syn keyword rustTrait PartialEq PartialOrd Eq Ord
syn keyword rustTrait DoubleEndedIterator syn keyword rustTrait AsRef AsMut Into From
syn keyword rustTrait ExactSizeIterator syn keyword rustTrait Default
syn keyword rustTrait Iterator IteratorExt Extend syn keyword rustTrait Iterator Extend IntoIterator
syn keyword rustTrait DoubleEndedIterator ExactSizeIterator
syn keyword rustEnum Option syn keyword rustEnum Option
syn keyword rustEnumVariant Some None syn keyword rustEnumVariant Some None
syn keyword rustTrait PtrExt MutPtrExt
syn keyword rustEnum Result syn keyword rustEnum Result
syn keyword rustEnumVariant Ok Err syn keyword rustEnumVariant Ok Err
syn keyword rustTrait AsSlice syn keyword rustTrait SliceConcatExt
syn keyword rustTrait SliceExt SliceConcatExt
syn keyword rustTrait Str StrExt
syn keyword rustTrait String ToString syn keyword rustTrait String ToString
syn keyword rustTrait Vec syn keyword rustTrait Vec
" FIXME: remove when path reform lands
syn keyword rustTrait Path GenericPath
" FIXME: remove when I/O reform lands
syn keyword rustTrait Buffer Writer Reader Seek BufferPrelude
" Other syntax {{{2 " Other syntax {{{2
syn keyword rustSelf self syn keyword rustSelf self
@ -122,6 +118,9 @@ syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1
" This isn't actually correct; a closure with no arguments can be `|| { }`. " This isn't actually correct; a closure with no arguments can be `|| { }`.
" Last, because the & in && isn't a sigil " Last, because the & in && isn't a sigil
syn match rustOperator display "&&\|||" syn match rustOperator display "&&\|||"
" This is rustArrowCharacter rather than rustArrow for the sake of matchparen,
" so it skips the ->; see http://stackoverflow.com/a/30309949 for details.
syn match rustArrowCharacter display "->"
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustPanic syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustPanic
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic
@ -136,13 +135,16 @@ syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEs
syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell
syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive
syn region rustDerive start="derive(" end=")" contained contains=rustTrait syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait
" This list comes from src/libsyntax/ext/deriving/mod.rs
" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show).
syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy
" Number literals " Number literals
syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(s\|8\|16\|32\|64\)\)\=" syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\)\)\="
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
" Special case for numbers of the form "1." which are float literals, unless followed by " Special case for numbers of the form "1." which are float literals, unless followed by
" an identifier, which makes them integer literals with a method call or field access, " an identifier, which makes them integer literals with a method call or field access,
@ -168,6 +170,7 @@ syn match rustCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:g
syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode
syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid
syn match rustShebang /\%^#![^[].*/
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell
@ -200,6 +203,7 @@ hi def link rustOctNumber rustNumber
hi def link rustBinNumber rustNumber hi def link rustBinNumber rustNumber
hi def link rustIdentifierPrime rustIdentifier hi def link rustIdentifierPrime rustIdentifier
hi def link rustTrait rustType hi def link rustTrait rustType
hi def link rustDeriveTrait rustTrait
hi def link rustMacroRepeatCount rustMacroRepeatDelimiters hi def link rustMacroRepeatCount rustMacroRepeatDelimiters
hi def link rustMacroRepeatDelimiters Macro hi def link rustMacroRepeatDelimiters Macro
@ -220,6 +224,7 @@ hi def link rustEnumVariant rustConstant
hi def link rustConstant Constant hi def link rustConstant Constant
hi def link rustSelf Constant hi def link rustSelf Constant
hi def link rustFloat Float hi def link rustFloat Float
hi def link rustArrowCharacter rustOperator
hi def link rustOperator Operator hi def link rustOperator Operator
hi def link rustKeyword Keyword hi def link rustKeyword Keyword
hi def link rustReservedKeyword Error hi def link rustReservedKeyword Error
@ -231,6 +236,7 @@ hi def link rustModPathSep Delimiter
hi def link rustFunction Function hi def link rustFunction Function
hi def link rustFuncName Function hi def link rustFuncName Function
hi def link rustFuncCall Function hi def link rustFuncCall Function
hi def link rustShebang Comment
hi def link rustCommentLine Comment hi def link rustCommentLine Comment
hi def link rustCommentLineDoc SpecialComment hi def link rustCommentLineDoc SpecialComment
hi def link rustCommentBlock rustCommentLine hi def link rustCommentBlock rustCommentLine
@ -249,7 +255,6 @@ hi def link rustInvalidBareKeyword Error
hi def link rustExternCrate rustKeyword hi def link rustExternCrate rustKeyword
hi def link rustObsoleteExternMod Error hi def link rustObsoleteExternMod Error
hi def link rustBoxPlacementParens Delimiter hi def link rustBoxPlacementParens Delimiter
hi def link rustBoxPlacementExpr rustKeyword
" Other Suggestions: " Other Suggestions:
" hi rustAttribute ctermfg=cyan " hi rustAttribute ctermfg=cyan

View File

@ -1,68 +1,229 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
" Language: Swift<https://developer.apple.com/swift/> " File: swift.vim
" Maintainer: toyama satoshi <toyamarinyon@gmail.com> " Author: Keith Smiley
" URL: http://github.com/toyamarinyon/vim-swift " Description: Runtime files for Swift
" License: GPL " Last Modified: June 15, 2014
" Bail if our syntax is already loaded. if exists("b:current_syntax")
if exists('b:current_syntax') && b:current_syntax == 'swift'
finish finish
endif endif
" {{{ Whitespace and Comments " Comments
syntax region swiftComment start=#\/\*# end=#\*\/# " Shebang
syntax match swiftComment /\/\/.*/ syntax match swiftShebang "\v#!.*$"
" Comment contained keywords
syntax keyword swiftTodos contained TODO XXX FIXME NOTE
syntax keyword swiftMarker contained MARK
syntax match swiftDocString "\v^\s*-\s*parameter"hs=s+1 contained
syntax match swiftDocString "\v^\s*-\s*returns"hs=s+1 contained
" Literals
" Strings
syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolatedWrapper
syntax region swiftInterpolatedWrapper start="\v[^\\]\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString
syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper
" Numbers
syntax match swiftNumber "\v<\d+>"
syntax match swiftNumber "\v<(\d+_+)+\d+(\.\d+(_+\d+)*)?>"
syntax match swiftNumber "\v<\d+\.\d+>"
syntax match swiftNumber "\v<\d*\.?\d+([Ee]-?)?\d+>"
syntax match swiftNumber "\v<0x\x+([Pp]-?)?\x+>"
syntax match swiftNumber "\v<0b[01]+>"
syntax match swiftNumber "\v<0o\o+>"
" BOOLs
syntax keyword swiftBoolean
\ true
\ false
" Operators
syntax match swiftOperator "\v\~"
syntax match swiftOperator "\v\s+!"
syntax match swiftOperator "\v\%"
syntax match swiftOperator "\v\^"
syntax match swiftOperator "\v\&"
syntax match swiftOperator "\v\*"
syntax match swiftOperator "\v-"
syntax match swiftOperator "\v\+"
syntax match swiftOperator "\v\="
syntax match swiftOperator "\v\|"
syntax match swiftOperator "\v\/"
syntax match swiftOperator "\v\."
syntax match swiftOperator "\v\<"
syntax match swiftOperator "\v\>"
syntax match swiftOperator "\v\?\?"
" Methods/Functions
syntax match swiftMethod "\(\.\)\@<=\w\+\((\)\@="
" Swift closure arguments
syntax match swiftClosureArgument "\$\d\+\(\.\d\+\)\?"
syntax match swiftAvailability "\v((\*(\s*,\s*[a-zA-Z="0-9.]+)*)|(\w+\s+\d+(\.\d+(.\d+)?)?\s*,\s*)+\*)" contains=swiftString
syntax keyword swiftPlatforms OSX iOS watchOS OSXApplicationExtension iOSApplicationExtension contained containedin=swiftAvailability
syntax keyword swiftAvailabilityArg renamed unavailable introduced deprecated obsoleted message contained containedin=swiftAvailability
" Keywords {{{
syntax keyword swiftKeywords
\ as
\ atexit
\ break
\ case
\ catch
\ class
\ continue
\ convenience
\ default
\ defer
\ deinit
\ didSet
\ do
\ dynamic
\ else
\ extension
\ fallthrough
\ final
\ for
\ func
\ get
\ guard
\ if
\ import
\ in
\ indirect
\ infix
\ init
\ inout
\ internal
\ is
\ lazy
\ let
\ mutating
\ nil
\ nonmutating
\ operator
\ optional
\ override
\ postfix
\ prefix
\ private
\ protocol
\ public
\ repeat
\ required
\ rethrows
\ return
\ self
\ set
\ static
\ subscript
\ super
\ switch
\ throw
\ throws
\ try
\ typealias
\ unowned
\ var
\ weak
\ where
\ while
\ willSet
" }}}
" Names surrounded by backticks. This aren't limited to keywords because 1)
" Swift doesn't limit them to keywords and 2) I couldn't make the keywords not
" highlight at the same time
syntax region swiftEscapedReservedWord start="`" end="`" oneline
syntax keyword swiftAttributes
\ @assignment
\ @autoclosure
\ @available
\ @convention
\ @exported
\ @IBAction
\ @IBDesignable
\ @IBInspectable
\ @IBOutlet
\ @noescape
\ @nonobjc
\ @noreturn
\ @NSApplicationMain
\ @NSCopying
\ @NSManaged
\ @objc
\ @testable
\ @UIApplicationMain
\ @warn_unused_result
syntax keyword swiftConditionStatement #available
syntax keyword swiftStructure
\ struct
\ enum
syntax region swiftTypeWrapper start="\v:\s*" skip="\s*,\s*$*\s*" end="$" contains=swiftString,swiftBoolean,swiftNumber,swiftType,swiftGenericsWrapper transparent
syntax region swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType transparent oneline
syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=swiftType,swiftString transparent oneline
syntax region swiftReturnWrapper start="\v-\>\s*" end="\v(\{|$)" contains=swiftType transparent oneline
syntax match swiftType "\v<\u\w*" contained containedin=swiftGenericsWrapper,swiftTypeWrapper,swiftLiteralWrapper,swiftGenericsWrapper
syntax keyword swiftImports import
" 'preprocesor' stuff
syntax keyword swiftPreprocessor
\ #if
\ #elseif
\ #else
\ #endif
" Comment patterns
syntax match swiftComment "\v\/\/.*$"
\ contains=swiftTodos,swiftDocString,swiftMarker,@Spell oneline
syntax region swiftComment start="/\*" end="\*/"
\ contains=swiftTodos,swiftDocString,swiftMarker,swiftComment,@Spell fold
" Set highlights
highlight default link swiftTodos Todo
highlight default link swiftDocString String
highlight default link swiftShebang Comment
highlight default link swiftComment Comment highlight default link swiftComment Comment
" }}} highlight default link swiftMarker Comment
" {{{ Identifiers highlight default link swiftString String
syntax match swiftIdentifier /[[:alpha:]_][[:alnum:]_]*/ highlight default link swiftInterpolatedWrapper Delimiter
highlight default link swiftIdentifier Identifier highlight default link swiftNumber Number
" }}} highlight default link swiftBoolean Boolean
" {{{ Keywords highlight default link swiftOperator Operator
" Keywords used in declarations: highlight default link swiftKeywords Keyword
syntax keyword swiftDeclarationKeywords class deinit enum extension func import init let protocol static struct subscript typealias var highlight default link swiftEscapedReservedWord Normal
highlight default link swiftDeclarationKeywords Keyword highlight default link swiftClosureArgument Operator
" Keywords used in statements: highlight default link swiftAttributes PreProc
syntax keyword swiftStatementKeywords break case continue default do else fallthrough if in for return switch where while highlight default link swiftConditionStatement PreProc
highlight default link swiftStatementKeywords Keyword highlight default link swiftStructure Structure
" Keywords used in expressions and types: highlight default link swiftType Type
syntax keyword swiftExpressionTypeKeywords as dynamicType is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ __LINE__ highlight default link swiftImports Include
highlight default link swiftExpressionTypeKeywords Keyword highlight default link swiftPreprocessor PreProc
" Keywords reserved in particular contexts: highlight default link swiftMethod Function
syntax keyword swiftReserveKeywords associativity didSet get infix inout left mutating none nonmutating operator override postfix precedence prefix right set unowned unowned(safe) unowned(unsafe) weak willSet
highlight default link swiftReserveKeywords Keyword
" }}}
" {{{ Literals highlight default link swiftConditionStatement PreProc
" Integer literal highlight default link swiftAvailability Normal
syntax match swiftIntegerLiteral /\<\d\+\%(_\d\+\)*\%(\.\d\+\%(_\d\+\)*\)\=\>/ highlight default link swiftAvailabilityArg Normal
syntax match swiftIntegerLiteral /\<\d\+\%(_\d\+\)*\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>/ highlight default link swiftPlatforms Keyword
syntax match swiftIntegerLiteral /\<0x\x\+\%(_\x\+\)*\>/
syntax match swiftIntegerLiteral /\<0o\o\+\%(_\o\+\)*\>/
syntax match swiftIntegerLiteral /\<0b[01]\+\%(_[01]\+\)*\>/
highlight default link swiftIntegerLiteral Number
" String literal
syntax region swiftStringLiteral start=/"/ skip=/\\"/ end=/"/
highlight default link swiftStringLiteral String
" }}}
" {{{ Operators " Force vim to sync at least x lines. This solves the multiline comment not
syntax keyword swiftOperatorKeywords / = - + ! * % < > & \| ^ ~ . " being highlighted issue
highlight default link swiftOperatorKeywords Operator syn sync minlines=100
" }}}
" {{{ Type let b:current_syntax = "swift"
syntax match swiftTypeIdentifier /\<[[:alpha:]_][[:alnum:]_.]*/ contained
syntax match swiftType /: .*/ contains=swiftTypeIdentifier
highlight default link swiftType Operator
highlight default link swiftTypeIdentifier Type
" }}}
if !exists('b:current_syntax')
let b:current_syntax = 'swift'
endif
endif endif

View File

@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1
" Language: TOML " Language: TOML
" Maintainer: Caleb Spare <cespare@gmail.com> " Maintainer: Caleb Spare <cespare@gmail.com>
" URL: http://github.com/cespare/vim-toml " URL: https://github.com/cespare/vim-toml
" LICENSE: MIT " LICENSE: MIT
if exists("b:current_syntax") if exists("b:current_syntax")
@ -37,7 +37,7 @@ hi def link tomlFloat Float
syn match tomlBoolean /\<\%(true\|false\)\>/ display syn match tomlBoolean /\<\%(true\|false\)\>/ display
hi def link tomlBoolean Boolean hi def link tomlBoolean Boolean
" http://tools.ietf.org/html/rfc3339 " https://tools.ietf.org/html/rfc3339
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)/ display syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)/ display
hi def link tomlDate Constant hi def link tomlDate Constant