This commit is contained in:
Adam Stankiewicz 2016-12-20 20:57:20 +01:00
parent 74652b465d
commit e404a658b1
No known key found for this signature in database
GPG Key ID: A62480DCEAC884DF
176 changed files with 5885 additions and 2052 deletions

View File

@ -45,7 +45,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect) - [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect)
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin, ftdetect) - [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin, ftdetect)
- [dockerfile](https://github.com/honza/dockerfile.vim) (syntax, ftdetect) - [dockerfile](https://github.com/honza/dockerfile.vim) (syntax, ftdetect)
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, ftplugin, ftdetect) - [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
- [elm](https://github.com/lambdatoast/elm.vim) (syntax, indent, autoload, ftplugin, ftdetect) - [elm](https://github.com/lambdatoast/elm.vim) (syntax, indent, autoload, ftplugin, ftdetect)
- [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin, ftdetect) - [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin, ftdetect)
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin, ftdetect) - [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin, ftdetect)

File diff suppressed because it is too large Load Diff

View File

@ -20,18 +20,20 @@ endfunction
function! dart#fmt(q_args) abort function! dart#fmt(q_args) abort
if executable('dartfmt') if executable('dartfmt')
let path = expand('%:p:gs:\:/:') let buffer_content = join(getline(1, '$'), "\n")
if filereadable(path) let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content)
let joined_lines = system(printf('dartfmt %s %s', a:q_args, shellescape(path))) if 0 == v:shell_error
if 0 == v:shell_error let win_view = winsaveview()
silent % delete _ silent % delete _
silent put=joined_lines silent put=joined_lines
silent 1 delete _ silent 1 delete _
else call winrestview(win_view)
call s:cexpr('line %l\, column %c of %f: %m', joined_lines)
endif
else else
call s:error(printf('cannot read a file: "%s"', path)) let errors = split(joined_lines, "\n")[2:]
let file_path = expand('%')
call map(errors, 'file_path.":".v:val')
let error_format = '%A%f:line %l\, column %c of stdin: %m,%C%.%#'
call s:cexpr(error_format, join(errors, "\n"))
endif endif
else else
call s:error('cannot execute binary file: dartfmt') call s:error('cannot execute binary file: dartfmt')

212
autoload/elixir/indent.vim Normal file
View File

@ -0,0 +1,212 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
let s:NO_COLON_BEFORE = ':\@<!'
let s:NO_COLON_AFTER = ':\@!'
let s:ENDING_SYMBOLS = '\]\|}\|)'
let s:STARTING_SYMBOLS = '\[\|{\|('
let s:ARROW = '->'
let s:END_WITH_ARROW = s:ARROW.'$'
let s:SKIP_SYNTAX = '\%(Comment\|String\)$'
let s:BLOCK_SKIP = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:SKIP_SYNTAX."'"
let s:DEF = '^\s*def'
let s:FN = '\<fn\>'
let s:MULTILINE_FN = s:FN.'\%(.*end\)\@!'
let s:BLOCK_START = '\%(\<do\>\|'.s:FN.'\)\>'
let s:MULTILINE_BLOCK = '\%(\<do\>'.s:NO_COLON_AFTER.'\|'.s:MULTILINE_FN.'\)'
let s:BLOCK_MIDDLE = '\<\%(else\|match\|elsif\|catch\|after\|rescue\)\>'
let s:BLOCK_END = 'end'
let s:STARTS_WITH_PIPELINE = '^\s*|>.*$'
let s:ENDING_WITH_ASSIGNMENT = '=\s*$'
let s:INDENT_KEYWORDS = s:NO_COLON_BEFORE.'\%('.s:MULTILINE_BLOCK.'\|'.s:BLOCK_MIDDLE.'\)'
let s:DEINDENT_KEYWORDS = '^\s*\<\%('.s:BLOCK_END.'\|'.s:BLOCK_MIDDLE.'\)\>'
let s:PAIR_START = '\<\%('.s:NO_COLON_BEFORE.s:BLOCK_START.'\)\>'.s:NO_COLON_AFTER
let s:PAIR_MIDDLE = '^\s*\%('.s:BLOCK_MIDDLE.'\)\>'.s:NO_COLON_AFTER.'\zs'
let s:PAIR_END = '\<\%('.s:NO_COLON_BEFORE.s:BLOCK_END.'\)\>\zs'
function! s:pending_parenthesis(line)
if a:line.last.text !~ s:ARROW
return elixir#util#count_indentable_symbol_diff(a:line.last, '(', '\%(end\s*\)\@<!)')
end
endfunction
function! s:pending_square_brackets(line)
if a:line.last.text !~ s:ARROW
return elixir#util#count_indentable_symbol_diff(a:line.last, '[', ']')
end
endfunction
function! s:pending_brackets(line)
if a:line.last.text !~ s:ARROW
return elixir#util#count_indentable_symbol_diff(a:line.last, '{', '}')
end
endfunction
function! elixir#indent#deindent_case_arrow(ind, line)
if get(b:old_ind, 'arrow', 0) > 0
\ && (a:line.current.text =~ s:ARROW
\ || a:line.current.text =~ s:BLOCK_END)
let ind = b:old_ind.arrow
let b:old_ind.arrow = 0
return ind
else
return a:ind
end
endfunction
function! elixir#indent#deindent_ending_symbols(ind, line)
if a:line.current.text =~ '^\s*\('.s:ENDING_SYMBOLS.'\)'
return a:ind - &sw
else
return a:ind
end
endfunction
function! elixir#indent#deindent_keywords(ind, line)
if a:line.current.text =~ s:DEINDENT_KEYWORDS
let bslnum = searchpair(
\ s:PAIR_START,
\ s:PAIR_MIDDLE,
\ s:PAIR_END,
\ 'nbW',
\ s:BLOCK_SKIP
\ )
return indent(bslnum)
else
return a:ind
end
endfunction
function! elixir#indent#deindent_opened_symbols(ind, line)
let s:opened_symbol =
\ s:pending_parenthesis(a:line)
\ + s:pending_square_brackets(a:line)
\ + s:pending_brackets(a:line)
if s:opened_symbol < 0
let ind = get(b:old_ind, 'symbol', a:ind + (s:opened_symbol * &sw))
let ind = float2nr(ceil(floor(ind)/&sw)*&sw)
return ind <= 0 ? 0 : ind
else
return a:ind
end
endfunction
function! elixir#indent#indent_after_pipeline(ind, line)
if a:line.last.text =~ s:STARTS_WITH_PIPELINE
if empty(substitute(a:line.current.text, ' ', '', 'g'))
\ || a:line.current.text =~ s:STARTS_WITH_PIPELINE
return indent(a:line.last.num)
elseif a:line.last.text !~ s:INDENT_KEYWORDS
let ind = b:old_ind.pipeline
let b:old_ind.pipeline = 0
return ind
end
end
return a:ind
endfunction
function! elixir#indent#indent_assignment(ind, line)
if a:line.last.text =~ s:ENDING_WITH_ASSIGNMENT
let b:old_ind.pipeline = indent(a:line.last.num) " FIXME: side effect
return a:ind + &sw
else
return a:ind
end
endfunction
function! elixir#indent#indent_brackets(ind, line)
if s:pending_brackets(a:line) > 0
return a:ind + &sw
else
return a:ind
end
endfunction
function! elixir#indent#indent_case_arrow(ind, line)
if a:line.last.text =~ s:END_WITH_ARROW && a:line.last.text !~ '\<fn\>'
let b:old_ind.arrow = a:ind
return a:ind + &sw
else
return a:ind
end
endfunction
function! elixir#indent#indent_ending_symbols(ind, line)
if a:line.last.text =~ '^\s*\('.s:ENDING_SYMBOLS.'\)\s*$'
return a:ind + &sw
else
return a:ind
end
endfunction
function! elixir#indent#indent_keywords(ind, line)
if a:line.last.text =~ s:INDENT_KEYWORDS
return a:ind + &sw
else
return a:ind
end
endfunction
function! elixir#indent#indent_parenthesis(ind, line)
if s:pending_parenthesis(a:line) > 0
\ && a:line.last.text !~ s:DEF
\ && a:line.last.text !~ s:END_WITH_ARROW
let b:old_ind.symbol = a:ind
return matchend(a:line.last.text, '(')
else
return a:ind
end
endfunction
function! elixir#indent#indent_pipeline_assignment(ind, line)
if a:line.current.text =~ s:STARTS_WITH_PIPELINE
\ && a:line.last.text =~ '^[^=]\+=.\+$'
let b:old_ind.pipeline = indent(a:line.last.num)
" if line starts with pipeline
" and last line is an attribution
" indents pipeline in same level as attribution
return match(a:line.last.text, '=\s*\zs[^ ]')
else
return a:ind
end
endfunction
function! elixir#indent#indent_pipeline_continuation(ind, line)
if a:line.last.text =~ s:STARTS_WITH_PIPELINE
\ && a:line.current.text =~ s:STARTS_WITH_PIPELINE
return indent(a:line.last.num)
else
return a:ind
end
endfunction
function! elixir#indent#indent_square_brackets(ind, line)
if s:pending_square_brackets(a:line) > 0
if a:line.last.text =~ '[\s*$'
return a:ind + &sw
else
" if start symbol is followed by a character, indent based on the
" whitespace after the symbol, otherwise use the default shiftwidth
" Avoid negative indentation index
return matchend(a:line.last.text, '[\s*')
end
else
return a:ind
end
endfunction
function! elixir#indent#deindent_case_arrow(ind, line)
if get(b:old_ind, 'arrow', 0) > 0
\ && (a:line.current.text =~ s:ARROW
\ || a:line.current.text =~ s:BLOCK_END)
let ind = b:old_ind.arrow
let b:old_ind.arrow = 0
return ind
else
return a:ind
end
endfunction
endif

56
autoload/elixir/util.vim Normal file
View File

@ -0,0 +1,56 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
let s:SKIP_SYNTAX = '\%(Comment\|String\)$'
let s:BLOCK_SKIP = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:SKIP_SYNTAX."'"
function! elixir#util#is_indentable_at(line, col)
if a:col == -1 " skip synID lookup for not found match
return 1
end
" TODO: Remove these 2 lines
" I don't know why, but for the test on spec/indent/lists_spec.rb:24.
" Vim is making some mess on parsing the syntax of 'end', it is being
" recognized as 'elixirString' when should be recognized as 'elixirBlock'.
call synID(a:line, a:col, 1)
" This forces vim to sync the syntax. Using fromstart is very slow on files
" over 1k lines
syntax sync minlines=20 maxlines=150
return synIDattr(synID(a:line, a:col, 1), "name")
\ !~ s:SKIP_SYNTAX
endfunction
function! elixir#util#is_indentable_match(line, pattern)
return elixir#util#is_indentable_at(a:line.num, match(a:line.text, a:pattern))
endfunction
function! elixir#util#count_indentable_symbol_diff(line, open, close)
if elixir#util#is_indentable_match(a:line, a:open)
\ && elixir#util#is_indentable_match(a:line, a:close)
return
\ s:match_count(a:line.text, a:open)
\ - s:match_count(a:line.text, a:close)
else
return 0
end
endfunction
function! s:match_count(string, pattern)
let size = strlen(a:string)
let index = 0
let counter = 0
while index < size
let index = match(a:string, a:pattern, index)
if index >= 0
let index += 1
let counter +=1
else
break
end
endwhile
return counter
endfunction
endif

File diff suppressed because it is too large Load Diff

View File

@ -198,7 +198,7 @@ function! rubycomplete#Complete(findstart, base)
if c =~ '\w' if c =~ '\w'
continue continue
elseif ! c =~ '\.' elseif ! c =~ '\.'
idx = -1 let idx = -1
break break
else else
break break

View File

@ -22,17 +22,20 @@ endif
let s:got_fmt_error = 0 let s:got_fmt_error = 0
function! rustfmt#Format() function! s:RustfmtCommandRange(filename, line1, line2)
let l:curw = winsaveview() let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" return printf("%s %s --write-mode=overwrite --file-lines '[%s]'", g:rustfmt_command, g:rustfmt_options, json_encode(l:arg))
call writefile(getline(1, '$'), l:tmpname) endfunction
let command = g:rustfmt_command . " --write-mode=overwrite " function! s:RustfmtCommand(filename)
return g:rustfmt_command . " --write-mode=overwrite " . g:rustfmt_options . " " . shellescape(a:filename)
endfunction
function! s:RunRustfmt(command, curw, tmpname)
if exists("*systemlist") if exists("*systemlist")
let out = systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname)) let out = systemlist(a:command)
else else
let out = split(system(command . g:rustfmt_options . " " . shellescape(l:tmpname)), '\r\?\n') let out = split(system(a:command), '\r\?\n')
endif endif
if v:shell_error == 0 || v:shell_error == 3 if v:shell_error == 0 || v:shell_error == 3
@ -40,7 +43,7 @@ function! rustfmt#Format()
try | silent undojoin | catch | endtry try | silent undojoin | catch | endtry
" Replace current file with temp file, then reload buffer " Replace current file with temp file, then reload buffer
call rename(l:tmpname, expand('%')) call rename(a:tmpname, expand('%'))
silent edit! silent edit!
let &syntax = &syntax let &syntax = &syntax
@ -78,10 +81,30 @@ function! rustfmt#Format()
let s:got_fmt_error = 1 let s:got_fmt_error = 1
lwindow lwindow
" We didn't use the temp file, so clean up " We didn't use the temp file, so clean up
call delete(l:tmpname) call delete(a:tmpname)
endif endif
call winrestview(l:curw) call winrestview(a:curw)
endfunction
function! rustfmt#FormatRange(line1, line2)
let l:curw = winsaveview()
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt"
call writefile(getline(1, '$'), l:tmpname)
let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2)
call s:RunRustfmt(command, l:curw, l:tmpname)
endfunction
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 = s:RustfmtCommand(l:tmpname)
call s:RunRustfmt(command, l:curw, l:tmpname)
endfunction endfunction
endif endif

View File

@ -62,6 +62,8 @@ let charset = [
\ 'windows-1256', 'windows-1257', 'windows-1258', 'TIS-620', ] \ 'windows-1256', 'windows-1257', 'windows-1258', 'TIS-620', ]
" }}} " }}}
let autofill_tokens = ['on', 'off', 'name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'username', 'new-password', 'current-password', 'organization-title', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'url', 'photo']
" Attributes_and_Settings: {{{ " Attributes_and_Settings: {{{
let core_attributes = {'accesskey': [], 'class': [], 'contenteditable': ['true', 'false', ''], 'contextmenu': [], 'dir': ['ltr', 'rtl'], 'draggable': ['true', 'false'], 'hidden': ['hidden', ''], 'id': [], 'is': [], 'lang': lang_tag, 'spellcheck': ['true', 'false', ''], 'style': [], 'tabindex': [], 'title': []} let core_attributes = {'accesskey': [], 'class': [], 'contenteditable': ['true', 'false', ''], 'contextmenu': [], 'dir': ['ltr', 'rtl'], 'draggable': ['true', 'false'], 'hidden': ['hidden', ''], 'id': [], 'is': [], 'lang': lang_tag, 'spellcheck': ['true', 'false', ''], 'style': [], 'tabindex': [], 'title': []}
let xml_attributes = {'xml:lang': lang_tag, 'xml:space': ['preserve'], 'xml:base': [], 'xmlns': ['http://www.w3.org/1999/xhtml', 'http://www.w3.org/1998/Math/MathML', 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink']} let xml_attributes = {'xml:lang': lang_tag, 'xml:space': ['preserve'], 'xml:base': [], 'xmlns': ['http://www.w3.org/1999/xhtml', 'http://www.w3.org/1998/Math/MathML', 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink']}
@ -80,7 +82,7 @@ let attributes_value = {
\ 'action': ['URL', ''], \ 'action': ['URL', ''],
\ 'alt': ['Text', ''], \ 'alt': ['Text', ''],
\ 'async': ['Bool', ''], \ 'async': ['Bool', ''],
\ 'autocomplete': ['on/off', ''], \ 'autocomplete': ['*Token', ''],
\ 'autofocus': ['Bool', ''], \ 'autofocus': ['Bool', ''],
\ 'autoplay': ['Bool', ''], \ 'autoplay': ['Bool', ''],
\ 'border': ['1', ''], \ 'border': ['1', ''],
@ -347,7 +349,7 @@ let g:xmldata_html5 = {
\ 'vimxmlroot': ['html', 'head', 'body'] + flow_elements, \ 'vimxmlroot': ['html', 'head', 'body'] + flow_elements,
\ 'a': [ \ 'a': [
\ filter(copy(flow_elements), "!(v:val =~ '". abutton_dec ."')"), \ filter(copy(flow_elements), "!(v:val =~ '". abutton_dec ."')"),
\ extend(copy(global_attributes), {'name': [], 'href': [], 'target': [], 'rel': linktypes, 'hreflang': lang_tag, 'media': [], 'type': []}) \ extend(copy(global_attributes), {'name': [], 'href': [], 'target': [], 'rel': linktypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
\ ], \ ],
\ 'abbr': [ \ 'abbr': [
\ phrasing_elements, \ phrasing_elements,
@ -359,7 +361,7 @@ let g:xmldata_html5 = {
\ ], \ ],
\ 'area': [ \ 'area': [
\ [], \ [],
\ extend(copy(global_attributes), {'alt': [], 'href': [], 'target': [], 'rel': linktypes, 'media': [], 'hreflang': lang_tag, 'type': [], 'shape': ['rect', 'circle', 'poly', 'default'], 'coords': []}) \ extend(copy(global_attributes), {'alt': [], 'href': [], 'target': [], 'rel': linktypes, 'media': [], 'hreflang': lang_tag, 'type': [], 'shape': ['rect', 'circle', 'poly', 'default'], 'coords': [], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
\ ], \ ],
\ 'article': [ \ 'article': [
\ flow_elements + ['style'], \ flow_elements + ['style'],
@ -495,7 +497,7 @@ let g:xmldata_html5 = {
\ ], \ ],
\ 'form': [ \ 'form': [
\ flow_elements, \ flow_elements,
\ extend(copy(global_attributes), {'name': [], 'action': [], 'enctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'method': ['get', 'post', 'put', 'delete'], 'target': [], 'novalidate': ['novalidate', ''], 'accept-charset': charset, 'autocomplete': ['on', 'off']}) \ extend(copy(global_attributes), {'name': [], 'action': [], 'enctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'method': ['get', 'post', 'put', 'delete'], 'target': [], 'novalidate': ['novalidate', ''], 'accept-charset': charset, 'autocomplete': autofill_tokens})
\ ], \ ],
\ 'h1': [ \ 'h1': [
\ phrasing_elements, \ phrasing_elements,
@ -547,15 +549,15 @@ let g:xmldata_html5 = {
\ ], \ ],
\ 'iframe': [ \ 'iframe': [
\ [], \ [],
\ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', '']}) \ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
\ ], \ ],
\ 'img': [ \ 'img': [
\ [], \ [],
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'usemap': [], 'ismap': ['ismap', '']}) \ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
\ ], \ ],
\ 'input': [ \ 'input': [
\ [], \ [],
\ extend(copy(global_attributes), {'type': ['text', 'password', 'checkbox', 'radio', 'button', 'submit', 'reset', 'file', 'hidden', 'image', 'datetime', 'datetime-local', 'date', 'month', 'time', 'week', 'number', 'range', 'email', 'url', 'search', 'tel', 'color'], 'name': [], 'disabled': ['disabled', ''], 'form': [], 'maxlength': [], 'readonly': ['readonly', ''], 'size': [], 'value': [], 'autocomplete': ['on', 'off'], 'autofocus': ['autofocus', ''], 'list': [], 'pattern': [], 'required': ['required', ''], 'placeholder': [], 'checked': ['checked'], 'accept': [], 'multiple': ['multiple', ''], 'alt': [], 'src': [], 'height': [], 'width': [], 'min': [], 'max': [], 'step': [], 'formenctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'formmethod': ['get', 'post', 'put', 'delete'], 'formtarget': [], 'formnovalidate': ['formnovalidate', '']}) \ extend(copy(global_attributes), {'type': ['text', 'password', 'checkbox', 'radio', 'button', 'submit', 'reset', 'file', 'hidden', 'image', 'datetime', 'datetime-local', 'date', 'month', 'time', 'week', 'number', 'range', 'email', 'url', 'search', 'tel', 'color'], 'name': [], 'disabled': ['disabled', ''], 'form': [], 'maxlength': [], 'readonly': ['readonly', ''], 'size': [], 'value': [], 'autocomplete': autofill_tokens, 'autofocus': ['autofocus', ''], 'list': [], 'pattern': [], 'required': ['required', ''], 'placeholder': [], 'checked': ['checked'], 'accept': [], 'multiple': ['multiple', ''], 'alt': [], 'src': [], 'height': [], 'width': [], 'min': [], 'max': [], 'step': [], 'formenctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'formmethod': ['get', 'post', 'put', 'delete'], 'formtarget': [], 'formnovalidate': ['formnovalidate', '']})
\ ], \ ],
\ 'ins': [ \ 'ins': [
\ flow_elements, \ flow_elements,
@ -583,7 +585,7 @@ let g:xmldata_html5 = {
\ ], \ ],
\ 'link': [ \ 'link': [
\ [], \ [],
\ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any']}) \ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
\ ], \ ],
\ 'main': [ \ 'main': [
\ flow_elements + ['style'], \ flow_elements + ['style'],
@ -691,7 +693,7 @@ let g:xmldata_html5 = {
\ ], \ ],
\ 'script': [ \ 'script': [
\ [], \ [],
\ extend(copy(global_attributes), {'src': [], 'defer': ['defer', ''], 'async': ['async', ''], 'type': [], 'charset': charset}) \ extend(copy(global_attributes), {'src': [], 'defer': ['defer', ''], 'async': ['async', ''], 'type': [], 'charset': charset, 'nonce': []})
\ ], \ ],
\ 'section': [ \ 'section': [
\ flow_elements + ['style'], \ flow_elements + ['style'],
@ -723,7 +725,7 @@ let g:xmldata_html5 = {
\ ], \ ],
\ 'style': [ \ 'style': [
\ [], \ [],
\ extend(copy(global_attributes), {'type': [], 'media': [], 'scoped': ['scoped', '']}) \ extend(copy(global_attributes), {'type': [], 'media': [], 'scoped': ['scoped', ''], 'nonce': []})
\ ], \ ],
\ 'sub': [ \ 'sub': [
\ phrasing_elements, \ phrasing_elements,

View File

@ -21,51 +21,12 @@ else
CompilerSet makeprg=cargo\ $* CompilerSet makeprg=cargo\ $*
endif endif
" Allow a configurable global Cargo.toml name. This makes it easy to " Ignore general cargo progress messages
" support variations like 'cargo.toml'. CompilerSet errorformat+=
let s:cargo_manifest_name = get(g:, 'cargo_manifest_name', 'Cargo.toml') \%-G%\\s%#Downloading%.%#,
\%-G%\\s%#Compiling%.%#,
function! s:is_absolute(path) \%-G%\\s%#Finished%.%#,
return a:path[0] == '/' || a:path =~ '[A-Z]\+:' \%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
endfunction \%-G%\\s%#To\ learn\ more\\,%.%#
CompilerSet errorformat+=%-G%\\s%#Compiling%.%#
let s:local_manifest = findfile(s:cargo_manifest_name, '.;')
if s:local_manifest != ''
let s:local_manifest = fnamemodify(s:local_manifest, ':p:h').'/'
augroup cargo
au!
au QuickfixCmdPost make call s:FixPaths()
augroup END
" FixPaths() is run after Cargo, and is used to change the file paths
" to be relative to the current directory instead of Cargo.toml.
function! s:FixPaths()
let qflist = getqflist()
let manifest = s:local_manifest
for qf in qflist
if !qf.valid
let m = matchlist(qf.text, '(file://\(.*\))$')
if !empty(m)
let manifest = m[1].'/'
" Manually strip another slash if needed; usually just an
" issue on Windows.
if manifest =~ '^/[A-Z]\+:/'
let manifest = manifest[1:]
endif
endif
continue
endif
let filename = bufname(qf.bufnr)
if s:is_absolute(filename)
continue
endif
let qf.filename = simplify(manifest.filename)
call remove(qf, 'bufnr')
endfor
call setqflist(qflist, 'r')
endfunction
endif
endif endif

View File

@ -23,6 +23,7 @@ else
CompilerSet makeprg=rustc\ \% CompilerSet makeprg=rustc\ \%
endif endif
" Old errorformat (before nightly 2016/08/10)
CompilerSet errorformat= CompilerSet errorformat=
\%f:%l:%c:\ %t%*[^:]:\ %m, \%f:%l:%c:\ %t%*[^:]:\ %m,
\%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m, \%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m,
@ -31,6 +32,17 @@ CompilerSet errorformat=
\%-G%*[\ ]^%*[~], \%-G%*[\ ]^%*[~],
\%-G%*[\ ]... \%-G%*[\ ]...
" New errorformat (after nightly 2016/08/10)
CompilerSet errorformat+=
\%-G,
\%-Gerror:\ aborting\ %.%#,
\%-Gerror:\ Could\ not\ compile\ %.%#,
\%Eerror:\ %m,
\%Eerror[E%n]:\ %m,
\%Wwarning:\ %m,
\%Inote:\ %m,
\%C\ %#-->\ %f:%l:%c
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save

View File

@ -8,13 +8,14 @@ syntax region jsFlowParens contained matchgroup=jsFlowNoise start=/(/
syntax match jsFlowNoise contained /[:;,<>]/ syntax match jsFlowNoise contained /[:;,<>]/
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object array bool class syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object array bool class
syntax keyword jsFlowTypeof contained typeof skipempty skipempty nextgroup=jsFlowTypeCustom,jsFlowType syntax keyword jsFlowTypeof contained typeof skipempty skipempty nextgroup=jsFlowTypeCustom,jsFlowType
syntax match jsFlowTypeCustom contained /\k*/ skipwhite skipempty nextgroup=jsFlowGroup syntax match jsFlowTypeCustom contained /[0-9a-zA-Z_.]*/ skipwhite skipempty nextgroup=jsFlowGroup
syntax region jsFlowGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster syntax region jsFlowGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster
syntax region jsFlowArrowArguments contained matchgroup=jsFlowNoise start=/(/ end=/)\%(\s*=>\)\@=/ oneline skipwhite skipempty nextgroup=jsFlowArrow contains=@jsFlowCluster syntax region jsFlowArrowArguments contained matchgroup=jsFlowNoise start=/(/ end=/)\%(\s*=>\)\@=/ oneline skipwhite skipempty nextgroup=jsFlowArrow contains=@jsFlowCluster
syntax match jsFlowArrow contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens syntax match jsFlowArrow contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens
syntax match jsFlowMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens,jsFlowArrowArguments syntax match jsFlowMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens,jsFlowArrowArguments
syntax match jsFlowObjectKey contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject syntax match jsFlowObjectKey contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject
syntax match jsFlowOrOperator contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster syntax match jsFlowOrOperator contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster
syntax keyword jsFlowImportType contained type skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup
syntax match jsFlowReturn contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster syntax match jsFlowReturn contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster
syntax region jsFlowReturnObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp syntax region jsFlowReturnObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp

View File

@ -20,7 +20,7 @@ syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRe
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
syntax region jsDocTypeNoParam contained start="{" end="}" oneline syntax region jsDocTypeNoParam contained start="{" end="}" oneline
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+" syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.\{-}]\|=\)\+"
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
if version >= 508 || !exists("did_javascript_syn_inits") if version >= 508 || !exists("did_javascript_syn_inits")

View File

@ -58,7 +58,7 @@ endif
" ftdetect/clojure.vim " ftdetect/clojure.vim
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1
autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc setlocal filetype=clojure autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc,{build,profile}.boot setlocal filetype=clojure
endif endif
@ -278,7 +278,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
" Language: OpenGL Shading Language " Language: OpenGL Shading Language
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io> " Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
autocmd! BufNewFile,BufRead *.glsl,*.geom,*.vert,*.frag,*.gsh,*.vsh,*.fsh,*.vs,*.fs,*.gs,*.tcs,*.tes set filetype=glsl autocmd! BufNewFile,BufRead *.glsl,*.geom,*.vert,*.frag,*.gsh,*.vsh,*.fsh,*.vs,*.fs,*.gs,*.tcs,*.tes,*.tesc,*.tese,*.comp set filetype=glsl
" vim:set sts=2 sw=2 : " vim:set sts=2 sw=2 :
@ -357,6 +357,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
au BufNewFile,BufRead *.js setf javascript au BufNewFile,BufRead *.js setf javascript
au BufNewFile,BufRead *.jsm setf javascript au BufNewFile,BufRead *.jsm setf javascript
au BufNewFile,BufRead Jakefile setf javascript au BufNewFile,BufRead Jakefile setf javascript
au BufNewFile,BufRead *.es6 setf javascript
fun! s:SelectJavascript() fun! s:SelectJavascript()
if getline(1) =~# '^#!.*/bin/\%(env\s\+\)\?node\>' if getline(1) =~# '^#!.*/bin/\%(env\s\+\)\?node\>'
@ -871,7 +872,7 @@ endif
" ftdetect/slim.vim " ftdetect/slim.vim
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
autocmd BufNewFile,BufRead *.slim setf slim autocmd BufNewFile,BufRead *.slim setfiletype slim
endif endif

View File

@ -4,5 +4,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
if exists('+regexpengine') && ('&regexpengine' == 0) if exists('+regexpengine') && ('&regexpengine' == 0)
setlocal regexpengine=1 setlocal regexpengine=1
endif endif
set path+=./../templates,./../files
endif endif

View File

@ -80,6 +80,23 @@ if exists("loaded_matchit")
let b:match_words = s:match_words let b:match_words = s:match_words
endif endif
if !exists('b:surround_45')
" When using surround `-` (ASCII 45) would provide `<% selection %>`
let b:surround_45 = "<% \r %>"
endif
if !exists('b:surround_61')
" When using surround `=` (ASCII 61) would provide `<%= selection %>`
let b:surround_61 = "<%= \r %>"
endif
if !exists('b:surround_35')
" When using surround `#` (ASCII 35) would provide `<%# selection %>`
let b:surround_35 = "<%# \r %>"
endif
if !exists('b:surround_5')
" When using surround `<C-e>` (ASCII 5 `ENQ`) would provide `<% selection %>\n<% end %>`
let b:surround_5 = "<% \r %>\n<% end %>"
endif
setlocal comments=:<%# setlocal comments=:<%#
setlocal commentstring=<%#\ %s\ %> setlocal commentstring=<%#\ %s\ %>

View File

@ -112,16 +112,6 @@ 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
@ -142,6 +132,9 @@ command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>)
" See |:RustFmt| for docs " See |:RustFmt| for docs
command! -buffer RustFmt call rustfmt#Format() command! -buffer RustFmt call rustfmt#Format()
" See |:RustFmtRange| for docs
command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>)
" Mappings {{{1 " Mappings {{{1
" Bind ⌘R in MacVim to :RustRun " Bind ⌘R in MacVim to :RustRun
@ -189,18 +182,27 @@ let b:undo_ftplugin = "
\|ounmap <buffer> ]] \|ounmap <buffer> ]]
\|set matchpairs-=<:> \|set matchpairs-=<:>
\|unlet b:match_skip \|unlet b:match_skip
\|augroup! rust.vim
\" \"
" }}}1 " }}}1
" Code formatting on save " Code formatting on save
if get(g:, "rustfmt_autosave", 0) if get(g:, "rustfmt_autosave", 0)
autocmd BufWritePre *.rs call rustfmt#Format() autocmd BufWritePre *.rs silent! call rustfmt#Format()
endif endif
augroup END augroup END
" %-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
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View File

@ -89,7 +89,7 @@ if exists("*searchpairpos")
function! s:match_pairs(open, close, stopat) function! s:match_pairs(open, close, stopat)
" Stop only on vector and map [ resp. {. Ignore the ones in strings and " Stop only on vector and map [ resp. {. Ignore the ones in strings and
" comments. " comments.
if a:stopat == 0 if a:stopat == 0 && g:clojure_maxlines > 0
let stopat = max([line(".") - g:clojure_maxlines, 0]) let stopat = max([line(".") - g:clojure_maxlines, 0])
else else
let stopat = a:stopat let stopat = a:stopat
@ -123,7 +123,7 @@ if exists("*searchpairpos")
if s:syn_id_name() !~? "string" if s:syn_id_name() !~? "string"
return -1 return -1
endif endif
if s:current_char() != '\\' if s:current_char() != '\'
return -1 return -1
endif endif
call cursor(0, col("$") - 1) call cursor(0, col("$") - 1)

View File

@ -8,6 +8,32 @@ let b:did_indent = 1
setlocal cindent setlocal cindent
setlocal cinoptions+=j1,J1 setlocal cinoptions+=j1,J1
setlocal indentexpr=DartIndent()
let b:undo_indent = 'setl cin< cino<' let b:undo_indent = 'setl cin< cino<'
if exists("*DartIndent")
finish
endif
function! DartIndent()
" Default to cindent in most cases
let indentTo = cindent(v:lnum)
let previousLine = getline(prevnonblank(v:lnum - 1))
let currentLine = getline(v:lnum)
" Don't indent after an annotation
if previousLine =~# '^\s*@.*$'
let indentTo = indent(v:lnum - 1)
endif
" Indent after opening List literal
if previousLine =~# '\[$' && !(currentLine =~# '^\s*\]')
let indentTo = indent(v:lnum - 1) + &shiftwidth
endif
return indentTo
endfunction
endif endif

View File

@ -1,201 +1,73 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
if exists("b:did_indent") setlocal nosmartindent
setlocal indentexpr=elixir#indent()
setlocal indentkeys+=0),0],0=\|>,=->
setlocal indentkeys+=0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue
if exists("b:did_indent") || exists("*elixir#indent")
finish finish
end end
let b:did_indent = 1 let b:did_indent = 1
setlocal nosmartindent
setlocal indentexpr=GetElixirIndent()
setlocal indentkeys+=0),0],0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue,0=\|>
if exists("*GetElixirIndent")
finish
end
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo&vim set cpo&vim
let s:no_colon_before = ':\@<!' function! elixir#indent()
let s:no_colon_after = ':\@!' " initiates the `old_ind` dictionary
let s:symbols_end = '\]\|}\|)' let b:old_ind = get(b:, 'old_ind', {})
let s:symbols_start = '\[\|{\|(' " initialtes the `line` dictionary
let s:arrow = '^.*->$' let line = s:build_line(v:lnum)
let s:skip_syntax = '\%(Comment\|String\)$'
let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'"
let s:block_start = '\<\%(do\|fn\)\>'
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
let s:block_end = 'end'
let s:starts_with_pipeline = '^\s*|>.*$'
let s:ending_with_assignment = '=\s*$'
let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow if s:is_beginning_of_file(line)
let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow " Reset `old_ind` dictionary at the beginning of the file
let b:old_ind = {}
let s:pair_start = '\<\%('.s:no_colon_before.s:block_start.'\)\>'.s:no_colon_after
let s:pair_middle = '^\s*\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs'
let s:pair_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs'
function! s:is_indentable_syntax()
" TODO: Remove these 2 lines
" I don't know why, but for the test on spec/indent/lists_spec.rb:24.
" Vim is making some mess on parsing the syntax of 'end', it is being
" recognized as 'elixirString' when should be recognized as 'elixirBlock'.
call synID(s:current_line_ref, 1, 1)
" This forces vim to sync the syntax.
syntax sync fromstart
return synIDattr(synID(s:current_line_ref, 1, 1), "name")
\ !~ s:skip_syntax
endfunction
function! s:indent_opened_symbol(ind)
if s:opened_symbol > 0
if s:pending_parenthesis > 0
\ && s:last_line !~ '^\s*def'
\ && s:last_line !~ s:arrow
let b:old_ind = a:ind
return matchend(s:last_line, '(')
" if start symbol is followed by a character, indent based on the
" whitespace after the symbol, otherwise use the default shiftwidth
" Avoid negative indentation index
elseif s:last_line =~ '\('.s:symbols_start.'\).'
let regex = '\('.s:symbols_start.'\)\s*'
let opened_prefix = matchlist(s:last_line, regex)[0]
return a:ind + (s:opened_symbol * strlen(opened_prefix))
else
return a:ind + (s:opened_symbol * &sw)
end
elseif s:opened_symbol < 0
let ind = get(b:, 'old_ind', a:ind + (s:opened_symbol * &sw))
let ind = float2nr(ceil(floor(ind)/&sw)*&sw)
return ind <= 0 ? 0 : ind
else
return a:ind
end
endfunction
function! s:indent_last_line_end_symbol_or_indent_keyword(ind)
if s:last_line =~ '^\s*\('.s:symbols_end.'\)'
\ || s:last_line =~ s:indent_keywords
return a:ind + &sw
else
return a:ind
end
endfunction
function! s:indent_symbols_ending(ind)
if s:current_line =~ '^\s*\('.s:symbols_end.'\)'
return a:ind - &sw
else
return a:ind
end
endfunction
function! s:indent_assignment(ind)
if s:last_line =~ s:ending_with_assignment
let b:old_ind = indent(s:last_line_ref) " FIXME: side effect
return a:ind + &sw
else
return a:ind
end
endfunction
function! s:indent_pipeline(ind)
if s:last_line =~ s:starts_with_pipeline
\ && s:current_line =~ s:starts_with_pipeline
indent(s:last_line_ref)
elseif s:current_line =~ s:starts_with_pipeline
\ && s:last_line =~ '^[^=]\+=.\+$'
let b:old_ind = indent(s:last_line_ref)
" if line starts with pipeline
" and last line is an attribution
" indents pipeline in same level as attribution
return match(s:last_line, '=\s*\zs[^ ]')
else
return a:ind
end
endfunction
function! s:indent_after_pipeline(ind)
if s:last_line =~ s:starts_with_pipeline
if empty(substitute(s:current_line, ' ', '', 'g'))
\ || s:current_line =~ s:starts_with_pipeline
return indent(s:last_line_ref)
elseif s:last_line !~ s:indent_keywords
return b:old_ind
else
return a:ind
end
else
return a:ind
end
endfunction
function! s:deindent_keyword(ind)
if s:current_line =~ s:deindent_keywords
let bslnum = searchpair(
\ s:pair_start,
\ s:pair_middle,
\ s:pair_end,
\ 'nbW',
\ s:block_skip
\ )
return indent(bslnum)
else
return a:ind
end
endfunction
function! s:indent_arrow(ind)
if s:current_line =~ s:arrow
" indent case statements '->'
return a:ind + &sw
else
return a:ind
end
endfunction
function! GetElixirIndent()
let s:current_line_ref = v:lnum
let s:last_line_ref = prevnonblank(s:current_line_ref - 1)
let s:current_line = getline(s:current_line_ref)
let s:last_line = getline(s:last_line_ref)
let s:pending_parenthesis = 0
let s:opened_symbol = 0
if s:last_line !~ s:arrow
let splitted_line = split(s:last_line, '\zs')
let s:pending_parenthesis =
\ + count(splitted_line, '(') - count(splitted_line, ')')
let s:opened_symbol =
\ + s:pending_parenthesis
\ + count(splitted_line, '[') - count(splitted_line, ']')
\ + count(splitted_line, '{') - count(splitted_line, '}')
end
if s:last_line_ref == 0
" At the start of the file use zero indent. " At the start of the file use zero indent.
return 0 return 0
elseif !s:is_indentable_syntax() elseif !s:is_indentable_line(line)
" Current syntax is not indentable, keep last line indentation " Keep last line indentation if the current line does not have an
return indent(s:last_line_ref) " indentable syntax
return indent(line.last.num)
else else
let ind = indent(s:last_line_ref) " Calculates the indenation level based on the rules
let ind = s:indent_opened_symbol(ind) " All the rules are defined in `autoload/indent.vim`
let ind = s:indent_symbols_ending(ind) let ind = indent(line.last.num)
let ind = s:indent_pipeline(ind) let ind = elixir#indent#deindent_case_arrow(ind, line)
let ind = s:indent_after_pipeline(ind) let ind = elixir#indent#indent_parenthesis(ind, line)
let ind = s:indent_assignment(ind) let ind = elixir#indent#indent_square_brackets(ind, line)
let ind = s:indent_last_line_end_symbol_or_indent_keyword(ind) let ind = elixir#indent#indent_brackets(ind, line)
let ind = s:deindent_keyword(ind) let ind = elixir#indent#deindent_opened_symbols(ind, line)
let ind = s:indent_arrow(ind) let ind = elixir#indent#indent_pipeline_assignment(ind, line)
let ind = elixir#indent#indent_pipeline_continuation(ind, line)
let ind = elixir#indent#indent_after_pipeline(ind, line)
let ind = elixir#indent#indent_assignment(ind, line)
let ind = elixir#indent#indent_ending_symbols(ind, line)
let ind = elixir#indent#indent_keywords(ind, line)
let ind = elixir#indent#deindent_keywords(ind, line)
let ind = elixir#indent#deindent_ending_symbols(ind, line)
let ind = elixir#indent#indent_case_arrow(ind, line)
return ind return ind
end end
endfunction endfunction
function! s:is_beginning_of_file(line)
return a:line.last.num == 0
endfunction
function! s:is_indentable_line(line)
return elixir#util#is_indentable_at(a:line.current.num, 1)
endfunction
function! s:build_line(line)
let line = { 'current': {}, 'last': {} }
let line.current.num = a:line
let line.current.text = getline(line.current.num)
let line.last.num = prevnonblank(line.current.num - 1)
let line.last.text = getline(line.last.num)
return line
endfunction
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save

View File

@ -32,13 +32,13 @@ function! GetGoHTMLTmplIndent(lnum)
" If need to indent based on last line " If need to indent based on last line
let last_line = getline(a:lnum-1) let last_line = getline(a:lnum-1)
if last_line =~ '^\s*{{\s*\%(if\|else\|range\|with\|define\|block\).*}}' if last_line =~ '^\s*{{-\=\s*\%(if\|else\|range\|with\|define\|block\).*}}'
let ind += sw let ind += sw
endif endif
" End of FuncMap block " End of FuncMap block
let current_line = getline(a:lnum) let current_line = getline(a:lnum)
if current_line =~ '^\s*{{\s*\%(else\|end\).*}}' if current_line =~ '^\s*{{-\=\s*\%(else\|end\).*}}'
let ind -= sw let ind -= sw
endif endif

View File

@ -15,6 +15,10 @@ endif
let b:did_indent = 1 let b:did_indent = 1
if !exists('g:haskell_indent_disable')
let g:haskell_indent_disable = 0
endif
if !exists('g:haskell_indent_if') if !exists('g:haskell_indent_if')
" if x " if x
" >>>then ... " >>>then ...
@ -59,8 +63,14 @@ if !exists('g:haskell_indent_guard')
let g:haskell_indent_guard = 2 let g:haskell_indent_guard = 2
endif endif
setlocal indentexpr=GetHaskellIndent() if exists("g:haskell_indent_disable") && g:haskell_indent_disable == 0
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space> setlocal indentexpr=GetHaskellIndent()
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
else
setlocal nocindent
setlocal nosmartindent
setlocal autoindent
endif
function! s:isInBlock(hlstack) function! s:isInBlock(hlstack)
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1 return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1
@ -270,7 +280,11 @@ function! GetHaskellIndent()
" case foo of " case foo of
" >>bar -> quux " >>bar -> quux
if l:prevline =~ '\C\<case\>.\+\<of\>\s*$' if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case if exists('g:haskell_indent_case_alternative') && g:haskell_indent_case_alternative
return match(l:prevline, '\S') + &shiftwidth
else
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
endif
endif endif
"" where foo "" where foo
@ -324,8 +338,8 @@ function! GetHaskellIndent()
while v:lnum != l:c while v:lnum != l:c
" fun decl " fun decl
let l:s = match(l:l, l:m) if l:l =~ ('^\s*' . l:m . '\(\s*::\|\n\s\+::\)')
if l:s >= 0 let l:s = match(l:l, l:m)
if match(l:l, '\C^\s*\<default\>') > -1 if match(l:l, '\C^\s*\<default\>') > -1
return l:s - 8 return l:s - 8
else else

View File

@ -42,6 +42,7 @@ setlocal indentkeys=o,O,*<Return>,<>>,{,},!^F
let s:tags = [] let s:tags = []
let s:no_tags = []
" [-- <ELEMENT ? - - ...> --] " [-- <ELEMENT ? - - ...> --]
call add(s:tags, 'a') call add(s:tags, 'a')
@ -165,6 +166,44 @@ call add(s:tags, 'text')
call add(s:tags, 'textPath') call add(s:tags, 'textPath')
call add(s:tags, 'tref') call add(s:tags, 'tref')
call add(s:tags, 'tspan') call add(s:tags, 'tspan')
" Common self closing SVG elements
call add(s:no_tags, 'animate')
call add(s:no_tags, 'animateTransform')
call add(s:no_tags, 'circle')
call add(s:no_tags, 'ellipse')
call add(s:no_tags, 'feBlend')
call add(s:no_tags, 'feColorMatrix')
call add(s:no_tags, 'feComposite')
call add(s:no_tags, 'feConvolveMatrix')
call add(s:no_tags, 'feDisplacementMap')
call add(s:no_tags, 'feFlood')
call add(s:no_tags, 'feFuncR')
call add(s:no_tags, 'feFuncG')
call add(s:no_tags, 'feFuncB')
call add(s:no_tags, 'feFuncA')
call add(s:no_tags, 'feGaussianBlur')
call add(s:no_tags, 'feImage')
call add(s:no_tags, 'feMergeNode')
call add(s:no_tags, 'feMorphology')
call add(s:no_tags, 'feOffset')
call add(s:no_tags, 'fePointLight')
call add(s:no_tags, 'feSpotLight')
call add(s:no_tags, 'feTile')
call add(s:no_tags, 'feTurbulence')
call add(s:no_tags, 'hatchpath')
call add(s:no_tags, 'hkern')
call add(s:no_tags, 'image')
call add(s:no_tags, 'line')
call add(s:no_tags, 'mpath')
call add(s:no_tags, 'polygon')
call add(s:no_tags, 'polyline')
call add(s:no_tags, 'path')
call add(s:no_tags, 'rect')
call add(s:no_tags, 'solidColor')
call add(s:no_tags, 'stop')
call add(s:no_tags, 'use')
call add(s:no_tags, 'view')
call add(s:no_tags, 'vkern')
call add(s:tags, 'html') call add(s:tags, 'html')
call add(s:tags, 'head') call add(s:tags, 'head')
@ -177,8 +216,6 @@ call add(s:tags, 'tr')
call add(s:tags, 'th') call add(s:tags, 'th')
call add(s:tags, 'td') call add(s:tags, 'td')
let s:no_tags = []
call add(s:no_tags, 'base') call add(s:no_tags, 'base')
call add(s:no_tags, 'link') call add(s:no_tags, 'link')
call add(s:no_tags, 'meta') call add(s:no_tags, 'meta')

View File

@ -2,9 +2,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
" Vim indent file " Vim indent file
" Language: Javascript " Language: Javascript
" Maintainer: vim-javascript community " Maintainer: Chris Paul ( https://github.com/bounceme )
" URL: https://github.com/pangloss/vim-javascript " URL: https://github.com/pangloss/vim-javascript
" Last Change: August 20, 2016 " Last Change: December 14, 2016
" Only load this indent file when no other was loaded. " Only load this indent file when no other was loaded.
if exists('b:did_indent') if exists('b:did_indent')
@ -14,11 +14,10 @@ let b:did_indent = 1
" Now, set up our indentation expression and keys that trigger it. " Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetJavascriptIndent() setlocal indentexpr=GetJavascriptIndent()
setlocal nolisp noautoindent nosmartindent setlocal autoindent nolisp nosmartindent
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e setlocal indentkeys+=0],0)
setlocal cinoptions+=j1,J1
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys< cinoptions<' let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
" Only define the function once. " Only define the function once.
if exists('*GetJavascriptIndent') if exists('*GetJavascriptIndent')
@ -39,159 +38,280 @@ else
endfunction endfunction
endif endif
let s:line_pre = '^\s*\%(\%(\%(\/\*.\{-}\)\=\*\+\/\s*\)\=\)\@>' " searchpair() wrapper
let s:expr_case = s:line_pre . '\%(\%(case\>.\+\)\|default\)\s*:' if has('reltime')
function s:GetPair(start,end,flags,skip,time,...)
return searchpair(a:start,'',a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 2000,0] + a:000),a:time)
endfunction
else
function s:GetPair(start,end,flags,skip,...)
return searchpair(a:start,'',a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 1000,get(a:000,1)]))
endfunction
endif
" Regex of syntax group names that are or delimit string or are comments. " Regex of syntax group names that are or delimit string or are comments.
let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)' let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template'
let s:syng_str = 'string\|template'
" Regex of syntax group names that are strings or documentation. let s:syng_com = 'comment\|doc'
let s:syng_comment = '\%(comment\|doc\)'
" Expression used to check whether we should skip a match with searchpair(). " Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'" let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
if has('reltime') function s:skip_func()
function s:GetPair(start,end,flags,time) if !s:free || search('`\|\*\/','nW',s:looksyn)
return searchpair(a:start,'',a:end,a:flags,s:skip_expr,max([prevnonblank(v:lnum) - 2000,0]),a:time) let s:free = !eval(s:skip_expr)
endfunction let s:looksyn = s:free ? line('.') : s:looksyn
else return !s:free
function s:GetPair(start,end,flags,n) endif
return searchpair(a:start,'',a:end,a:flags,0,max([prevnonblank(v:lnum) - 2000,0])) let s:looksyn = line('.')
endfunction return (search('\/','nbW',s:looksyn) || search('[''"\\]','nW',s:looksyn)) && eval(s:skip_expr)
endif endfunction
let s:line_term = '\s*\%(\%(\/\%(\%(\*.\{-}\*\/\)\|\%(\*\+\)\)\)\s*\)\=$' function s:alternatePair(stop)
while search('[][(){}]','bW',a:stop)
if !s:skip_func()
let idx = stridx('])}',s:looking_at())
if idx + 1
if !s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,a:stop)
break
endif
else
return
endif
endif
endwhile
call cursor(v:lnum,1)
endfunction
function s:syn_at(l,c)
return synIDattr(synID(a:l,a:c,0),'name')
endfunction
function s:looking_at()
return getline('.')[col('.')-1]
endfunction
function s:token()
return s:looking_at() =~ '\k' ? expand('<cword>') : s:looking_at()
endfunction
" NOTE: Moves the cursor, unless a arg is supplied.
function s:previous_token(...)
let l:pos = getpos('.')[1:2]
return [search('.\>\|[^[:alnum:][:space:]_$]','bW') ?
\ (s:looking_at() == '/' || line('.') != l:pos[0] && getline('.') =~ '\/\/') &&
\ s:syn_at(line('.'),col('.')) =~? s:syng_com ?
\ search('\_[^/]\zs\/[/*]','bW') ? s:previous_token() : ''
\ : s:token()
\ : ''][a:0 && call('cursor',l:pos)]
endfunction
" switch case label pattern
let s:case_stmt = '\<\%(case\>\s*[^ \t:].*\|default\s*\):\C'
function s:label_end(ln,con)
return !cursor(a:ln,match(' '.a:con, '.*\zs' . s:case_stmt . '$')) &&
\ (expand('<cword>') !=# 'default' || s:previous_token(1) !~ '[{,.]')
endfunction
" configurable regexes that define continuation lines, not including (, {, or [. " configurable regexes that define continuation lines, not including (, {, or [.
if !exists('g:javascript_opfirst') let s:opfirst = '^' . get(g:,'javascript_opfirst',
let g:javascript_opfirst = '\%([<>,:?^%|*&]\|\([-/.+]\)\1\@!\|=>\@!\|in\%(stanceof\)\=\>\)' \ '\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)')
endif let s:continuation = get(g:,'javascript_continuation',
if !exists('g:javascript_continuation') \ '\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|delete\|void\|in\|instanceof\)\)') . '$'
let g:javascript_continuation = '\%([<=,.?/*:^%|&]\|+\@<!+\|-\@<!-\|=\@<!>\|\<in\%(stanceof\)\=\)'
endif
let g:javascript_opfirst = s:line_pre . g:javascript_opfirst function s:continues(ln,con)
let g:javascript_continuation .= s:line_term return !cursor(a:ln, match(' '.a:con,s:continuation)) &&
\ eval((['s:syn_at(line("."),col(".")) !~? "regex"'] +
function s:OneScope(lnum,text,add) \ repeat(['s:previous_token() != "."'],5) + [1])[
return a:text =~# '\%(\<else\|\<do\|=>\)' . s:line_term ? 'no b' : \ index(split('/ typeof in instanceof void delete'),s:token())])
\ ((a:add && a:text =~ s:line_pre . '$' && search('\%' . s:PrevCodeLine(a:lnum - 1) . 'l.)' . s:line_term)) ||
\ cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1) &&
\ s:GetPair('(', ')', 'cbW', 100) > 0 && search('\C\l\+\_s*\%#','bW') &&
\ (a:add || ((expand('<cword>') !=# 'while' || !s:GetPair('\C\<do\>', '\C\<while\>','nbW',100)) &&
\ expand('cword') !=# 'each' || search('\C\<for\_s\+\%#','nbW'))) ? expand('<cword>') : ''
endfunction endfunction
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader " get the line of code stripped of comments. if called with two args, leave
function s:IsBlock() " cursor at the last non-comment char.
return getline(line('.'))[col('.')-1] == '{' && !search( function s:Trim(ln,...)
\ '\C\%(\<return\s*\|\%([-=~!<*+,.?^%|&\[(]\|=\@<!>\|\*\@<!\/\|\<\%(var\|const\|let\|yield\|delete\|void\|t\%(ypeof\|hrow\)\|new\|\<in\%(stanceof\)\=\)\)\_s*\)\%#','bnW') && let pline = substitute(getline(a:ln),'\s*$','','')
\ (!search(':\_s*\%#','bW') || (!s:GetPair('[({[]','[])}]','bW',200) || s:IsBlock())) let l:max = max([match(pline,'.*[^/]\zs\/[/*]'),0])
endfunction while l:max && s:syn_at(a:ln, strlen(pline)) =~? s:syng_com
let pline = substitute(strpart(pline, 0, l:max),'\s*$','','')
" Auxiliary Functions {{{2 let l:max = max([match(pline,'.*[^/]\zs\/[/*]'),0])
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
function s:PrevCodeLine(lnum)
let l:lnum = prevnonblank(a:lnum)
while l:lnum
if synIDattr(synID(l:lnum,matchend(getline(l:lnum), '^\s*[^''"]'),0),'name') !~? s:syng_strcom
return l:lnum
endif
let l:lnum = prevnonblank(l:lnum - 1)
endwhile endwhile
return !a:0 || cursor(a:ln,strlen(pline)) ? pline : pline
endfunction
" Find line above 'lnum' that isn't empty or in a comment
function s:PrevCodeLine(lnum)
let l:n = prevnonblank(a:lnum)
while getline(l:n) =~ '^\s*\/[/*]' || s:syn_at(l:n,1) =~? s:syng_com
let l:n = prevnonblank(l:n-1)
endwhile
return l:n
endfunction endfunction
" Check if line 'lnum' has a balanced amount of parentheses. " Check if line 'lnum' has a balanced amount of parentheses.
function s:Balanced(lnum) function s:Balanced(lnum)
let [open_0,open_2,open_4] = [0,0,0] let l:open = 0
let l:line = getline(a:lnum) let l:line = getline(a:lnum)
let pos = match(l:line, '[][(){}]', 0) let pos = match(l:line, '[][(){}]', 0)
while pos != -1 while pos != -1
if synIDattr(synID(a:lnum,pos + 1,0),'name') !~? s:syng_strcom if s:syn_at(a:lnum,pos + 1) !~? s:syng_strcom
let idx = stridx('(){}[]', l:line[pos]) let l:open += match(' ' . l:line[pos],'[[({]')
if idx % 2 == 0 if l:open < 0
let open_{idx} = open_{idx} + 1 return
else
let open_{idx - 1} = open_{idx - 1} - 1
endif endif
endif endif
let pos = match(l:line, '[][(){}]', pos + 1) let pos = match(l:line, '[][(){}]', pos + 1)
endwhile endwhile
return (!open_4 + !open_2 + !open_0) - 2 return !l:open
endfunction
function s:OneScope(lnum)
let pline = s:Trim(a:lnum,1)
if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0
let token = s:previous_token()
if index(split('await each'),token) + 1
return s:previous_token() ==# 'for'
endif
return index(split('for if let while with'),token) + 1
endif
return eval((['getline(".")[col(".")-2] == "="'] +
\ repeat(['s:previous_token(1) != "."'],2) + [0])[
\ index(split('> else do'),s:token())])
endfunction
" returns braceless levels started by 'i' and above lines * &sw. 'num' is the
" lineNr which encloses the entire context, 'cont' if whether line 'i' + 1 is
" a continued expression, which could have started in a braceless context
function s:iscontOne(i,num,cont)
let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0]
let pind = a:num ? indent(l:num) + s:W : 0
let ind = indent(l:i) + (a:cont ? 0 : s:W)
while l:i >= l:num && (ind > pind || l:i == l:num)
if indent(l:i) < ind && s:OneScope(l:i)
let bL += s:W
let l:i = line('.')
elseif !a:cont || bL || ind < indent(a:i)
break
endif
let ind = min([ind, indent(l:i)])
let l:i = s:PrevCodeLine(l:i - 1)
endwhile
return bL
endfunction
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
function s:IsBlock()
let l:ln = line('.')
let char = s:previous_token()
let syn = char =~ '[{>/]' ? s:syn_at(line('.'),col('.')-(char == '{')) : ''
if syn =~? 'xml\|jsx'
return char != '{'
elseif char =~ '\k'
return index(split('return const let import export yield default delete var void typeof throw new in instanceof')
\ ,char) < (0 + (line('.') != l:ln)) || s:previous_token() == '.'
elseif char == '>'
return getline('.')[col('.')-2] == '=' || syn =~? '^jsflow'
elseif char == ':'
return s:label_end(0,strpart(getline('.'),0,col('.')))
endif
return syn =~? 'regex' || char !~ '[-=~!<*+,/?^%|&([]'
endfunction endfunction
" }}}
function GetJavascriptIndent() function GetJavascriptIndent()
if !exists('b:js_cache') let b:js_cache = get(b:,'js_cache',[0,0,0])
let b:js_cache = [0,0,0]
endif
" Get the current line. " Get the current line.
let l:line = getline(v:lnum) let l:line = getline(v:lnum)
let syns = synIDattr(synID(v:lnum, 1, 0), 'name') let syns = s:syn_at(v:lnum, 1)
" start with strings,comments,etc.{{{2 " start with strings,comments,etc.
if (l:line !~ '^[''"`]' && syns =~? '\%(string\|template\)') || if syns =~? s:syng_com
\ (l:line !~ '^\s*[/*]' && syns =~? s:syng_comment) if l:line =~ '^\s*\*'
return cindent(v:lnum)
elseif l:line !~ '^\s*\/[/*]'
return -1
endif
elseif syns =~? s:syng_str && l:line !~ '^[''"]'
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
let b:js_cache[0] = v:lnum
endif
return -1 return -1
endif endif
if l:line !~ '^\%(\/\*\|\s*\/\/\)' && syns =~? s:syng_comment
return cindent(v:lnum)
endif
let l:lnum = s:PrevCodeLine(v:lnum - 1) let l:lnum = s:PrevCodeLine(v:lnum - 1)
if l:lnum == 0 if !l:lnum
return 0 return
endif endif
if (l:line =~# s:expr_case) let l:line = substitute(l:line,'^\s*','','')
let cpo_switch = &cpo if l:line[:1] == '/*'
set cpo+=% let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','')
let ind = cindent(v:lnum) endif
let &cpo = cpo_switch if l:line =~ '^\/[/*]'
return ind let l:line = ''
endif endif
"}}}
" the containing paren, bracket, curly. Memoize, last lineNr either has the " the containing paren, bracket, or curly. Many hacks for performance
" same scope or starts a new one, unless if it closed a scope.
call cursor(v:lnum,1) call cursor(v:lnum,1)
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && b:js_cache[0] && let idx = strlen(l:line) ? stridx('])}',l:line[0]) : -1
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum) > 0) if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum &&
let num = b:js_cache[1] \ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum))
elseif syns != '' && l:line[0] =~ '\s' call call('cursor',b:js_cache[1:])
let pattern = syns =~? 'block' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] :
\ syns =~? 'jsbracket'? ['\[','\]'] : ['[({[]','[])}]']
let num = s:GetPair(pattern[0],pattern[1],'bW',2000)
else else
let num = s:GetPair('[({[]','[])}]','bW',2000) let [s:looksyn, s:free, top] = [v:lnum - 1, 1, (!indent(l:lnum) &&
endif \ s:syn_at(l:lnum,1) !~? s:syng_str) * l:lnum]
let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')] if idx + 1
call s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,top)
if l:line =~ s:line_pre . '[])}]' elseif indent(v:lnum) && syns =~? 'block'
return indent(num) call s:GetPair('{','}','bW','s:skip_func()',2000,top)
else
call s:alternatePair(top)
endif
endif endif
call cursor(b:js_cache[1],b:js_cache[2]) if idx + 1
if idx == 2 && search('\S','bW',line('.')) && s:looking_at() == ')'
let swcase = getline(l:lnum) =~# s:expr_case call s:GetPair('(',')','bW',s:skip_expr,200)
let pline = swcase ? getline(l:lnum) : substitute(getline(l:lnum), '\%(:\@<!\/\/.*\)$', '','') endif
let inb = num == 0 || num < l:lnum && ((l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term) || s:IsBlock()) return indent('.')
let switch_offset = num == 0 || s:OneScope(num, strpart(getline(num),0,b:js_cache[2] - 1),1) !=# 'switch' ? 0 :
\ &cino !~ ':' || !has('float') ? s:sw() :
\ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (&cino =~# '.*:[^,]*s' ? s:sw() : 1))
" most significant, find the indent amount
if inb && !swcase && ((l:line =~# g:javascript_opfirst || pline =~# g:javascript_continuation) ||
\ num < l:lnum && s:OneScope(l:lnum,pline,0) =~# '\<\%(for\|each\|if\|let\|no\sb\|w\%(hile\|ith\)\)\>' &&
\ l:line !~ s:line_pre . '{')
return (num > 0 ? indent(num) : -s:sw()) + (s:sw() * 2) + switch_offset
elseif num > 0
return indent(num) + s:sw() + switch_offset
endif endif
let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [0,0] : getpos('.')[1:2])
let num = b:js_cache[1]
let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0]
if !num || s:looking_at() == '{' && s:IsBlock()
let pline = s:Trim(l:lnum)
if num && s:looking_at() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0
let num = line('.')
if s:previous_token() ==# 'switch'
if &cino !~ ':' || !has('float')
let switch_offset = s:W
else
let cinc = matchlist(&cino,'.*:\(-\)\=\([0-9.]*\)\(s\)\=\C')
let switch_offset = float2nr(str2float(cinc[1].(strlen(cinc[2]) ? cinc[2] : strlen(cinc[3])))
\ * (strlen(cinc[3]) ? s:W : 1))
endif
if pline[-1:] != '.' && l:line =~# '^' . s:case_stmt
return indent(num) + switch_offset
elseif s:label_end(l:lnum,pline)
return indent(l:lnum) + s:W
endif
endif
endif
if pline[-1:] !~ '[{;]'
let isOp = l:line =~# s:opfirst || s:continues(l:lnum,pline)
let bL = s:iscontOne(l:lnum,num,isOp)
let bL -= (bL && l:line[0] == '{') * s:W
endif
endif
" main return
if isOp
return (num ? indent(num) : -s:W) + (s:W * 2) + switch_offset + bL
elseif num
return indent(num) + s:W + switch_offset + bL
endif
return bL
endfunction endfunction
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save

View File

@ -14,45 +14,46 @@ if exists("*GetPlantUMLIndent")
endif endif
let s:incIndent = let s:incIndent =
\ '^\s*\(loop\|alt\|opt\|group\|critical\|else\|legend\|box\)\>\|' . \ '^\s*\%(loop\|alt\|opt\|group\|critical\|else\|legend\|box\|if\|while\)\>\|' .
\ '^\s*\([hr]\?note\|ref\)\>[^:]*$\|' . \ '^\s*ref\>[^:]*$\|' .
\ '^\s*title\s*$\|' . \ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' .
\ '^\s*skinparam\>.*{\s*$\|' . \ '^\s*title\s*$\|' .
\ '^\s*state\>.*{' \ '^\s*skinparam\>.*{\s*$\|' .
\ '^\s*\%(state\|class\|partition\|rectangle\)\>.*{'
let s:decIndent = '^\s*\(end\|else\|}\)' let s:decIndent = '^\s*\%(end\|else\|}\)'
function! GetPlantUMLIndent(...) abort function! GetPlantUMLIndent(...) abort
"for current line, use arg if given or v:lnum otherwise "for current line, use arg if given or v:lnum otherwise
let clnum = a:0 ? a:1 : v:lnum let clnum = a:0 ? a:1 : v:lnum
if !s:insidePlantUMLTags(clnum) if !s:insidePlantUMLTags(clnum)
return indent(clnum) return indent(clnum)
endif
let pnum = prevnonblank(clnum-1)
let pindent = indent(pnum)
let pline = getline(pnum)
let cline = getline(clnum)
if cline =~ s:decIndent
if pline =~ s:incIndent
return pindent
else
return pindent - shiftwidth()
endif endif
let pnum = prevnonblank(clnum-1) elseif pline =~ s:incIndent
let pindent = indent(pnum) return pindent + shiftwidth()
let pline = getline(pnum) endif
let cline = getline(clnum)
if cline =~ s:decIndent return pindent
if pline =~ s:incIndent
return pindent
else
return pindent - shiftwidth()
endif
elseif pline =~ s:incIndent
return pindent + shiftwidth()
endif
return pindent
endfunction endfunction
function! s:insidePlantUMLTags(lnum) abort function! s:insidePlantUMLTags(lnum) abort
call cursor(a:lnum, 1) call cursor(a:lnum, 1)
return search('@startuml', 'Wbn') && search('@enduml', 'Wn') return search('@startuml', 'Wbn') && search('@enduml', 'Wn')
endfunction endfunction
endif endif

View File

@ -51,11 +51,11 @@ let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
" Regex of syntax group names that are strings. " Regex of syntax group names that are strings.
let s:syng_string = let s:syng_string =
\ '\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\)\>' \ '\<ruby\%(String\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|StringEscape\)\>'
" Regex of syntax group names that are strings or documentation. " Regex of syntax group names that are strings or documentation.
let s:syng_stringdoc = let s:syng_stringdoc =
\'\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\|Documentation\)\>' \ '\<ruby\%(String\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|StringEscape\|Documentation\)\>'
" Expression used to check whether we should skip a match with searchpair(). " Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = let s:skip_expr =
@ -392,7 +392,7 @@ function! s:FindContainingClass()
call setpos('.', saved_position) call setpos('.', saved_position)
return found_lnum return found_lnum
endif endif
endif endwhile
call setpos('.', saved_position) call setpos('.', saved_position)
return 0 return 0

View File

@ -31,8 +31,15 @@ syn region bladeEcho matchgroup=bladeDelimiter start="@\@<!{{" end="}}"
syn region bladeEcho matchgroup=bladeDelimiter start="{!!" end="!!}" contains=@bladePhp,bladePhpParenBlock containedin=ALLBUT,@bladeExempt keepend syn region bladeEcho matchgroup=bladeDelimiter start="{!!" end="!!}" contains=@bladePhp,bladePhpParenBlock containedin=ALLBUT,@bladeExempt keepend
syn region bladeComment matchgroup=bladeDelimiter start="{{--" end="--}}" contains=bladeTodo containedin=ALLBUT,@bladeExempt keepend syn region bladeComment matchgroup=bladeDelimiter start="{{--" end="--}}" contains=bladeTodo containedin=ALLBUT,@bladeExempt keepend
syn keyword bladeKeyword @if @elseif @foreach @forelse @for @while @can @cannot @elsecan @elsecannot @include @includeIf @each @inject @extends @section @stack @push @unless @yield @parent @hasSection @break @continue @unset @lang @choice nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt syn keyword bladeKeyword @if @elseif @foreach @forelse @for @while @can @cannot @elsecan @elsecannot @include
syn keyword bladeKeyword @else @endif @endunless @endfor @endforeach @empty @endforelse @endwhile @endcan @endcannot @stop @append @endsection @endpush @show @overwrite @verbatim @endverbatim containedin=ALLBUT,@bladeExempt \ @includeIf @each @inject @extends @section @stack @push @unless @yield @parent @hasSection @break @continue
\ @unset @lang @choice @component @slot
\ nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt
syn keyword bladeKeyword @else @endif @endunless @endfor @endforeach @empty @endforelse @endwhile @endcan
\ @endcannot @stop @append @endsection @endpush @show @overwrite @verbatim @endverbatim @endcomponent
\ @endslot
\ containedin=ALLBUT,@bladeExempt
if exists('g:blade_custom_directives') if exists('g:blade_custom_directives')
exe "syn keyword bladeKeyword @" . join(g:blade_custom_directives, ' @') . " nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt" exe "syn keyword bladeKeyword @" . join(g:blade_custom_directives, ' @') . " nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt"

View File

@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c/c++') == -1
" Vim syntax file " Vim syntax file
" Language: C " Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2016 Apr 10 " Last Change: 2016 Nov 17
" Quit when a (custom) syntax file was already loaded " Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax") if exists("b:current_syntax")
@ -184,11 +184,6 @@ syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumbe
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>" syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
"hex number "hex number
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
if s:ft ==# 'cpp' && !exists("cpp_no_cpp14")
syn match cNumber display contained "\d\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cNumber display contained "0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cNumber display contained "0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
endif
" Flag the first zero of an octal number as something special " Flag the first zero of an octal number as something special
syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
syn match cOctalZero display contained "\<0" syn match cOctalZero display contained "\<0"
@ -365,36 +360,36 @@ if !exists("c_no_c99") " ISO C99
endif endif
" Accept %: for # (C99) " Accept %: for # (C99)
syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError syn region cPreCondit start="^\s*\zs\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
syn match cPreConditMatch display "^\s*\(%:\|#\)\s*\(else\|endif\)\>" syn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>"
if !exists("c_no_if0") if !exists("c_no_if0")
syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip
syn region cCppOutWrapper start="^\s*\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold
syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse
if !exists("c_no_if0_fold") if !exists("c_no_if0_fold")
syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
else else
syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
endif endif
syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*\(else\|elif\)" end="^\s*\zs\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit
syn region cCppInWrapper start="^\s*\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold syn region cCppInWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold
syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\zs\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit
if !exists("c_no_if0_fold") if !exists("c_no_if0_fold")
syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold syn region cCppInElse contained start="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold
else else
syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 syn region cCppInElse contained start="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2
endif endif
syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\zs\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\zs\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
syn region cCppOutSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip syn region cCppOutSkip contained start="^\s*\zs\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip
syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\zs\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\zs\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc
endif endif
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match cIncluded display contained "<[^>]*>" syn match cIncluded display contained "<[^>]*>"
syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded syn match cInclude display "^\s*\zs\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
"syn match cLineSkip "\\$" "syn match cLineSkip "\\$"
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock
syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell syn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell syn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
" Highlight User Labels " Highlight User Labels
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
@ -403,21 +398,21 @@ if s:ft ==# 'c' || exists("cpp_no_cpp11")
endif endif
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':' " Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
syn cluster cLabelGroup contains=cUserLabel syn cluster cLabelGroup contains=cUserLabel
syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup syn match cUserCont display "^\s*\zs\I\i*\s*:$" contains=@cLabelGroup
syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup syn match cUserCont display ";\s*\zs\I\i*\s*:$" contains=@cLabelGroup
if s:ft ==# 'cpp' if s:ft ==# 'cpp'
syn match cUserCont display "^\s*\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup syn match cUserCont display "^\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
syn match cUserCont display ";\s*\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup syn match cUserCont display ";\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
else else
syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup syn match cUserCont display "^\s*\zs\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup syn match cUserCont display ";\s*\zs\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
endif endif
syn match cUserLabel display "\I\i*" contained syn match cUserLabel display "\I\i*" contained
" Avoid recognizing most bitfields as labels " Avoid recognizing most bitfields as labels
syn match cBitField display "^\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType syn match cBitField display "^\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
syn match cBitField display ";\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType syn match cBitField display ";\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
if exists("c_minlines") if exists("c_minlines")
let b:c_minlines = c_minlines let b:c_minlines = c_minlines

View File

@ -34,7 +34,7 @@ hi def link coffeeConditional Conditional
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
hi def link coffeeException Exception hi def link coffeeException Exception
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\)\>/ syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\)\>/
\ display \ display
" The `own` keyword is only a keyword after `for`. " The `own` keyword is only a keyword after `for`.
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
@ -109,7 +109,7 @@ hi def link coffeeFloat Float
" An error for reserved keywords, taken from the RESERVED array: " An error for reserved keywords, taken from the RESERVED array:
" http://coffeescript.org/documentation/docs/lexer.html#section-67 " http://coffeescript.org/documentation/docs/lexer.html#section-67
syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|export\|import\|native\|__hasProp\|__extends\|__slice\|__bind\|__indexOf\|implements\|interface\|package\|private\|protected\|public\|static\)\>/ syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|native\|implements\|interface\|package\|private\|protected\|public\|static\)\>/
\ display \ display
hi def link coffeeReservedError Error hi def link coffeeReservedError Error

View File

@ -4,23 +4,16 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c/c++') == -1
" Language: C++ " Language: C++
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
" Last Change: 2015 Nov 10 " Last Change: 2016 Oct 28
" For version 5.x: Clear all syntax items " quit when a syntax file was already loaded
" For version 6.x: Quit when a syntax file was already loaded if exists("b:current_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish finish
endif endif
" Read the C syntax to start with " Read the C syntax to start with
if version < 600 runtime! syntax/c.vim
so <sfile>:p:h/c.vim unlet b:current_syntax
else
runtime! syntax/c.vim
unlet b:current_syntax
endif
" C++ extensions " C++ extensions
syn keyword cppStatement new delete this friend using syn keyword cppStatement new delete this friend using
@ -39,8 +32,8 @@ syn keyword cppConstant __cplusplus
" C++ 11 extensions " C++ 11 extensions
if !exists("cpp_no_cpp11") if !exists("cpp_no_cpp11")
syn keyword cppModifier override final auto syn keyword cppModifier override final
syn keyword cppType nullptr_t syn keyword cppType nullptr_t auto
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
@ -55,36 +48,31 @@ endif
" C++ 14 extensions " C++ 14 extensions
if !exists("cpp_no_cpp14") if !exists("cpp_no_cpp14")
syn match cppNumber display "\<0b[01]\+\(u\=l\{0,2}\|ll\=u\)\>" syn case ignore
syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn case match
endif endif
" The minimum and maximum operators in GNU C++ " The minimum and maximum operators in GNU C++
syn match cppMinMax "[<>]?" syn match cppMinMax "[<>]?"
" Default highlighting " Default highlighting
if version >= 508 || !exists("did_cpp_syntax_inits") hi def link cppAccess cppStatement
if version < 508 hi def link cppCast cppStatement
let did_cpp_syntax_inits = 1 hi def link cppExceptions Exception
command -nargs=+ HiLink hi link <args> hi def link cppOperator Operator
else hi def link cppStatement Statement
command -nargs=+ HiLink hi def link <args> hi def link cppModifier Type
endif hi def link cppType Type
HiLink cppAccess cppStatement hi def link cppStorageClass StorageClass
HiLink cppCast cppStatement hi def link cppStructure Structure
HiLink cppExceptions Exception hi def link cppBoolean Boolean
HiLink cppOperator Operator hi def link cppConstant Constant
HiLink cppStatement Statement hi def link cppRawStringDelimiter Delimiter
HiLink cppModifier Type hi def link cppRawString String
HiLink cppType Type hi def link cppNumber Number
HiLink cppStorageClass StorageClass
HiLink cppStructure Structure
HiLink cppBoolean Boolean
HiLink cppConstant Constant
HiLink cppRawStringDelimiter Delimiter
HiLink cppRawString String
HiLink cppNumber Number
delcommand HiLink
endif
let b:current_syntax = "cpp" let b:current_syntax = "cpp"

View File

@ -10,25 +10,23 @@ set cpo&vim
" syncing starts 2000 lines before top line so docstrings don't screw things up " syncing starts 2000 lines before top line so docstrings don't screw things up
syn sync minlines=2000 syn sync minlines=2000
syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@elixirDeclaration,elixirTodo,elixirArguments,elixirBlockDefinition syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@elixirDeclaration,elixirTodo,elixirArguments,elixirBlockDefinition,elixirUnusedVariable
syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation
syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass
syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDeclaration,elixirProtocolDeclaration,elixirImplDeclaration,elixirRecordDeclaration,elixirMacroDeclaration,elixirDelegateDeclaration,elixirOverridableDeclaration,elixirExceptionDeclaration,elixirCallbackDeclaration,elixirStructDeclaration syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDeclaration,elixirProtocolDeclaration,elixirImplDeclaration,elixirRecordDeclaration,elixirMacroDeclaration,elixirDelegateDeclaration,elixirOverridableDeclaration,elixirExceptionDeclaration,elixirCallbackDeclaration,elixirStructDeclaration
syn match elixirComment '^\s*#.*' contains=elixirTodo,@Spell syn match elixirComment '#.*' contains=elixirTodo,@Spell
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 with cond for if unless try receive send syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>'
syn keyword elixirKeyword do end exit raise throw after rescue catch else
syn keyword elixirKeyword quote unquote super spawn spawn_link spawn_monitor
" Functions used on guards syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|send\)\>'
syn keyword elixirKeyword contained is_atom is_binary is_bitstring is_boolean syn match elixirKeyword '\(\.\)\@<!\<\(exit\|raise\|throw\|after\|rescue\|catch\|else\)\>'
syn keyword elixirKeyword contained is_float is_function is_integer is_list syn match elixirKeyword '\(\.\)\@<!\<\(quote\|unquote\|super\|spawn\|spawn_link\|spawn_monitor\)\>'
syn keyword elixirKeyword contained is_map is_nil is_number is_pid is_port
syn keyword elixirKeyword contained is_record is_reference is_tuple is_exception " Kernel functions
syn keyword elixirKeyword contained abs bit_size byte_size div elem hd length syn match elixirKernelFunction contained containedin=elixirGuard '\<\(is_atom\|is_binary\|is_bitstring\|is_boolean\|is_float\|is_function\|is_integer\|is_list\|is_map\|is_nil\|is_number\|is_pid\|is_port\)\>\([ (]\)\@='
syn keyword elixirKeyword contained map_size node rem round tl trunc tuple_size syn match elixirKernelFunction contained containedin=elixirGuard '\<\(is_record\|is_reference\|is_tuple\|is_exception\|abs\|bit_size\|byte_size\|div\|elem\|hd\|length\|map_size\|node\|rem\|round\|tl\|trunc\|tuple_size\)\>\([ (]\)\@='
syn match elixirGuard '.*when.*' contains=ALLBUT,@elixirNotTop syn match elixirGuard '.*when.*' contains=ALLBUT,@elixirNotTop
@ -36,12 +34,10 @@ syn keyword elixirInclude import require alias use
syn keyword elixirSelf self syn keyword elixirSelf self
syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>'
" This unfortunately also matches function names in function calls " This unfortunately also matches function names in function calls
syn match elixirUnusedVariable '\(([^)]*\)\@<=\<_\w*\>' syn match elixirUnusedVariable contained '\<_\w*\>'
syn keyword elixirOperator and not or when xor in syn keyword elixirOperator and not or in
syn match elixirOperator '!==\|!=\|!' syn match elixirOperator '!==\|!=\|!'
syn match elixirOperator '=\~\|===\|==\|=' syn match elixirOperator '=\~\|===\|==\|='
syn match elixirOperator '<<<\|<<\|<=\|<-\|<' syn match elixirOperator '<<<\|<<\|<=\|<-\|<'
@ -58,6 +54,8 @@ syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)' syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!" syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"
syn match elixirBlockInline "\<\(do\|else\)\>:\@="
syn match elixirAlias '\<[!]\?[A-Z]\w*\(\.[A-Z]\w*\)*\>' syn match elixirAlias '\<[!]\?[A-Z]\w*\(\.[A-Z]\w*\)*\>'
syn keyword elixirBoolean true false nil syn keyword elixirBoolean true false nil
@ -79,20 +77,18 @@ syn match elixirRegexCharClass "\[:\(alnum\|alpha\|ascii\|blank\|cntrl\|
syn region elixirRegex matchgroup=elixirRegexDelimiter start="%r/" end="/[uiomxfr]*" skip="\\\\" contains=@elixirRegexSpecial syn region elixirRegex matchgroup=elixirRegexDelimiter start="%r/" end="/[uiomxfr]*" skip="\\\\" contains=@elixirRegexSpecial
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('\)+ end=+\z1+ skip=+\\\\+ contains=@elixirStringContained syn region elixirString matchgroup=elixirStringDelimiter start=+\z('\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("\)+ end=+\z1+ skip=+\\\\+ contains=@elixirStringContained syn region elixirString matchgroup=elixirStringDelimiter start=+\z("\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('''\)+ end=+^\s*\z1+ skip=+'\|\\\\+ contains=@elixirStringContained syn region elixirString matchgroup=elixirStringDelimiter start=+\z('''\)+ end=+^\s*\z1+ skip=+'\|\\\\+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("""\)+ end=+^\s*\z1+ skip=+"\|\\\\+ contains=@elixirStringContained syn region elixirString matchgroup=elixirStringDelimiter start=+\z("""\)+ end=+^\s*\z1+ skip=+"\|\\\\+ contains=@elixirStringContained
syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirComment,@elixirNotTop syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirKernelFunction,elixirComment,@elixirNotTop
syn match elixirDocString +\(@\w*doc\s*\)\@<=\%("""\_.\{-}\_^\s*"""\|".\{-\}"\)+ contains=elixirTodo,elixirInterpolation,@Spell fold
syn match elixirAtomInterpolated ':\("\)\@=' contains=elixirString syn match elixirAtomInterpolated ':\("\)\@=' contains=elixirString
syn match elixirString "\(\w\)\@<!?\%(\\\(x\d{1,2}\|\h{1,2}\h\@!\>\|0[0-7]{0,2}[0-7]\@!\>\|[^x0MC]\)\|(\\[MC]-)+\w\|[^\s\\]\)" syn match elixirString "\(\w\)\@<!?\%(\\\(x\d{1,2}\|\h{1,2}\h\@!\>\|0[0-7]{0,2}[0-7]\@!\>\|[^x0MC]\)\|(\\[MC]-)+\w\|[^\s\\]\)"
syn region elixirBlock matchgroup=elixirBlockDefinition start="\<do\>:\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold syn region elixirBlock matchgroup=elixirBlockDefinition start="\<do\>:\@!" end="\<end\>" contains=ALLBUT,elixirKernelFunction,@elixirNotTop fold
syn region elixirElseBlock matchgroup=elixirBlockDefinition start="\<else\>:\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold syn region elixirElseBlock matchgroup=elixirBlockDefinition start="\<else\>:\@!" end="\<end\>" contains=ALLBUT,elixirKernelFunction,@elixirNotTop fold
syn region elixirAnonymousFunction matchgroup=elixirBlockDefinition start="\<fn\>" end="\<end\>" contains=ALLBUT,@elixirNotTop fold syn region elixirAnonymousFunction matchgroup=elixirBlockDefinition start="\<fn\>" end="\<end\>" contains=ALLBUT,elixirKernelFunction,@elixirNotTop fold
syn region elixirArguments start="(" end=")" contained contains=elixirOperator,elixirAtom,elixirPseudoVariable,elixirAlias,elixirBoolean,elixirVariable,elixirUnusedVariable,elixirNumber,elixirDocString,elixirAtomInterpolated,elixirRegex,elixirString,elixirStringDelimiter,elixirRegexDelimiter,elixirInterpolationDelimiter,elixirSigilDelimiter syn region elixirArguments start="(" end=")" contained contains=elixirOperator,elixirAtom,elixirPseudoVariable,elixirAlias,elixirBoolean,elixirVariable,elixirUnusedVariable,elixirNumber,elixirDocString,elixirAtomInterpolated,elixirRegex,elixirString,elixirStringDelimiter,elixirRegexDelimiter,elixirInterpolationDelimiter,elixirSigilDelimiter
@ -109,26 +105,49 @@ syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l{"
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l<" end=">" skip="\\\\\|\\>" contains=@elixirStringContained,elixirRegexEscapePunctuation fold syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l<" end=">" skip="\\\\\|\\>" contains=@elixirStringContained,elixirRegexEscapePunctuation fold
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l\[" end="\]" skip="\\\\\|\\\]" contains=@elixirStringContained,elixirRegexEscapePunctuation fold syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l\[" end="\]" skip="\\\\\|\\\]" contains=@elixirStringContained,elixirRegexEscapePunctuation fold
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l(" end=")" skip="\\\\\|\\)" contains=@elixirStringContained,elixirRegexEscapePunctuation fold syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l(" end=")" skip="\\\\\|\\)" contains=@elixirStringContained,elixirRegexEscapePunctuation fold
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l\/" end="\/" skip="\\\\\|\\\/" contains=@elixirStringContained,elixirRegexEscapePunctuation fold
" Sigils surrounded with docString " Sigils surrounded with heredoc
syn region elixirSigil matchgroup=elixirSigilDelimiter start=+\~\a\z("""\)+ end=+^\s*\zs\z1+ skip=+\\"+ fold syn region elixirSigil matchgroup=elixirSigilDelimiter start=+\~\a\z("""\)+ end=+^\s*\zs\z1\s*$+ skip=+\\"+ fold
syn region elixirSigil matchgroup=elixirSigilDelimiter start=+\~\a\z('''\)+ end=+^\s*\zs\z1+ skip=+\\'+ fold syn region elixirSigil matchgroup=elixirSigilDelimiter start=+\~\a\z('''\)+ end=+^\s*\zs\z1\s*$+ skip=+\\'+ fold
" Documentation
if exists('g:elixir_use_markdown_for_docs') && g:elixir_use_markdown_for_docs
syn include @markdown syntax/markdown.vim
syn cluster elixirDocStringContained contains=@markdown,@Spell
else
let g:elixir_use_markdown_for_docs = 0
syn cluster elixirDocStringContained contains=elixirDocTest,elixirTodo,@Spell
" doctests
syn region elixirDocTest start="^\s*\%(iex\|\.\.\.\)\%((\d*)\)\?>\s" end="^\s*$" contained
endif
syn region elixirDocString matchgroup=elixirSigilDelimiter start="\%(@\w*doc\s\+\)\@<=\~[Ss]\z(/\|\"\|'\||\)" end="\z1" skip="\\\\\|\\\z1" contains=@elixirDocStringContained fold keepend
syn region elixirDocString matchgroup=elixirSigilDelimiter start="\%(@\w*doc\s\+\)\@<=\~[Ss]{" end="}" skip="\\\\\|\\}" contains=@elixirDocStringContained fold keepend
syn region elixirDocString matchgroup=elixirSigilDelimiter start="\%(@\w*doc\s\+\)\@<=\~[Ss]<" end=">" skip="\\\\\|\\>" contains=@elixirDocStringContained fold keepend
syn region elixirDocString matchgroup=elixirSigilDelimiter start="\%(@\w*doc\s\+\)\@<=\~[Ss]\[" end="\]" skip="\\\\\|\\\]" contains=@elixirDocStringContained fold keepend
syn region elixirDocString matchgroup=elixirSigilDelimiter start="\%(@\w*doc\s\+\)\@<=\~[Ss](" end=")" skip="\\\\\|\\)" contains=@elixirDocStringContained fold keepend
syn region elixirDocString matchgroup=elixirStringDelimiter start=+\%(@\w*doc\s\+\)\@<=\z("\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=@elixirDocStringContained keepend
syn region elixirDocString matchgroup=elixirStringDelimiter start=+\%(@\w*doc\s\+\)\@<=\z("""\)+ end=+\z1+ contains=@elixirDocStringContained fold keepend
syn region elixirDocString matchgroup=elixirSigilDelimiter start=+\%(@\w*doc\s\+\)\@<=\~[Ss]\z('''\)+ end=+\z1+ skip=+\\'+ contains=@elixirDocStringContained fold keepend
syn region elixirDocString matchgroup=elixirSigilDelimiter start=+\%(@\w*doc\s\+\)\@<=\~[Ss]\z("""\)+ end=+\z1+ skip=+\\"+ contains=@elixirDocStringContained fold keepend
" Defines " Defines
syn keyword elixirDefine def nextgroup=elixirFunctionDeclaration skipwhite skipnl syn match elixirDefine '\<def\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
syn keyword elixirPrivateDefine defp nextgroup=elixirFunctionDeclaration skipwhite skipnl syn match elixirPrivateDefine '\<defp\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
syn keyword elixirModuleDefine defmodule nextgroup=elixirModuleDeclaration skipwhite skipnl syn match elixirModuleDefine '\<defmodule\>\(:\)\@!' nextgroup=elixirModuleDeclaration skipwhite skipnl
syn keyword elixirProtocolDefine defprotocol nextgroup=elixirProtocolDeclaration skipwhite skipnl syn match elixirProtocolDefine '\<defprotocol\>\(:\)\@!' nextgroup=elixirProtocolDeclaration skipwhite skipnl
syn keyword elixirImplDefine defimpl nextgroup=elixirImplDeclaration skipwhite skipnl syn match elixirImplDefine '\<defimpl\>\(:\)\@!' nextgroup=elixirImplDeclaration skipwhite skipnl
syn keyword elixirRecordDefine defrecord nextgroup=elixirRecordDeclaration skipwhite skipnl syn match elixirRecordDefine '\<defrecord\>\(:\)\@!' nextgroup=elixirRecordDeclaration skipwhite skipnl
syn keyword elixirPrivateRecordDefine defrecordp nextgroup=elixirRecordDeclaration skipwhite skipnl syn match elixirPrivateRecordDefine '\<defrecordp\>\(:\)\@!' nextgroup=elixirRecordDeclaration skipwhite skipnl
syn keyword elixirMacroDefine defmacro nextgroup=elixirMacroDeclaration skipwhite skipnl syn match elixirMacroDefine '\<defmacro\>\(:\)\@!' nextgroup=elixirMacroDeclaration skipwhite skipnl
syn keyword elixirPrivateMacroDefine defmacrop nextgroup=elixirMacroDeclaration skipwhite skipnl syn match elixirPrivateMacroDefine '\<defmacrop\>\(:\)\@!' nextgroup=elixirMacroDeclaration skipwhite skipnl
syn keyword elixirDelegateDefine defdelegate nextgroup=elixirDelegateDeclaration skipwhite skipnl syn match elixirDelegateDefine '\<defdelegate\>\(:\)\@!' nextgroup=elixirDelegateDeclaration skipwhite skipnl
syn keyword elixirOverridableDefine defoverridable nextgroup=elixirOverridableDeclaration skipwhite skipnl syn match elixirOverridableDefine '\<defoverridable\>\(:\)\@!' nextgroup=elixirOverridableDeclaration skipwhite skipnl
syn keyword elixirExceptionDefine defexception nextgroup=elixirExceptionDeclaration skipwhite skipnl syn match elixirExceptionDefine '\<defexception\>\(:\)\@!' nextgroup=elixirExceptionDeclaration skipwhite skipnl
syn keyword elixirCallbackDefine defcallback nextgroup=elixirCallbackDeclaration skipwhite skipnl syn match elixirCallbackDefine '\<defcallback\>\(:\)\@!' nextgroup=elixirCallbackDeclaration skipwhite skipnl
syn keyword elixirStructDefine defstruct skipwhite skipnl syn match elixirStructDefine '\<defstruct\>\(:\)\@!' skipwhite skipnl
" Declarations " Declarations
syn match elixirModuleDeclaration "[^[:space:];#<]\+" contained nextgroup=elixirBlock skipwhite skipnl syn match elixirModuleDeclaration "[^[:space:];#<]\+" contained nextgroup=elixirBlock skipwhite skipnl
@ -143,6 +162,12 @@ syn match elixirOverridableDeclaration "[^[:space:];#<]\+" contained con
syn match elixirExceptionDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl syn match elixirExceptionDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
syn match elixirCallbackDeclaration "[^[:space:];#<,()\[\]]\+" contained contains=elixirFunctionDeclaration skipwhite skipnl syn match elixirCallbackDeclaration "[^[:space:];#<,()\[\]]\+" contained contains=elixirFunctionDeclaration skipwhite skipnl
" ExUnit
syn match elixirExUnitMacro "\(^\s*\)\@<=\<\(test\|describe\|setup\|setup_all\|on_exit\|doctest\)\>"
syn match elixirExUnitAssert "\(^\s*\)\@<=\<\(assert\|assert_in_delta\|assert_raise\|assert_receive\|assert_received\|catch_error\)\>"
syn match elixirExUnitAssert "\(^\s*\)\@<=\<\(catch_exit\|catch_throw\|flunk\|refute\|refute_in_delta\|refute_receive\|refute_received\)\>"
hi def link elixirBlockInline Keyword
hi def link elixirBlockDefinition Keyword hi def link elixirBlockDefinition Keyword
hi def link elixirDefine Define hi def link elixirDefine Define
hi def link elixirPrivateDefine Define hi def link elixirPrivateDefine Define
@ -158,6 +183,7 @@ hi def link elixirOverridableDefine Define
hi def link elixirExceptionDefine Define hi def link elixirExceptionDefine Define
hi def link elixirCallbackDefine Define hi def link elixirCallbackDefine Define
hi def link elixirStructDefine Define hi def link elixirStructDefine Define
hi def link elixirExUnitMacro Define
hi def link elixirModuleDeclaration Type hi def link elixirModuleDeclaration Type
hi def link elixirFunctionDeclaration Function hi def link elixirFunctionDeclaration Function
hi def link elixirMacroDeclaration Macro hi def link elixirMacroDeclaration Macro
@ -165,6 +191,8 @@ hi def link elixirInclude Include
hi def link elixirComment Comment hi def link elixirComment Comment
hi def link elixirTodo Todo hi def link elixirTodo Todo
hi def link elixirKeyword Keyword hi def link elixirKeyword Keyword
hi def link elixirExUnitAssert Keyword
hi def link elixirKernelFunction Keyword
hi def link elixirOperator Operator hi def link elixirOperator Operator
hi def link elixirAtom Constant hi def link elixirAtom Constant
hi def link elixirPseudoVariable Constant hi def link elixirPseudoVariable Constant
@ -175,6 +203,7 @@ hi def link elixirSelf Identifier
hi def link elixirUnusedVariable Comment hi def link elixirUnusedVariable Comment
hi def link elixirNumber Number hi def link elixirNumber Number
hi def link elixirDocString Comment hi def link elixirDocString Comment
hi def link elixirDocTest elixirKeyword
hi def link elixirAtomInterpolated elixirAtom hi def link elixirAtomInterpolated elixirAtom
hi def link elixirRegex elixirString hi def link elixirRegex elixirString
hi def link elixirRegexEscape elixirSpecial hi def link elixirRegexEscape elixirSpecial

View File

@ -8,7 +8,7 @@ if exists("b:current_syntax") && b:current_syntax == "glsl"
endif endif
" Statements " Statements
syn keyword glslConditional if else syn keyword glslConditional if else switch case default
syn keyword glslRepeat for while do syn keyword glslRepeat for while do
syn keyword glslStatement discard return break continue syn keyword glslStatement discard return break continue

View File

@ -129,12 +129,12 @@ hi def link goComplexes Type
" Predefined functions and values " Predefined functions and values
syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/ syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/
syn match goBuiltins /\<\v(make|new|panic|print|println|real|recover)\ze\(/ syn match goBuiltins /\<\v(make|new|panic|print|println|real|recover)\ze\(/
syn keyword goPredefinedIdentifiers nil iota
syn keyword goBoolean true false syn keyword goBoolean true false
syn keyword goPredefinedIdentifiers nil iota
hi def link goBuiltins Keyword hi def link goBuiltins Keyword
hi def link goPredefinedIdentifiers Identifier
hi def link goBoolean Boolean hi def link goBoolean Boolean
hi def link goPredefinedIdentifiers goBoolean
" Comments; their contents " Comments; their contents
syn keyword goTodo contained TODO FIXME XXX BUG syn keyword goTodo contained TODO FIXME XXX BUG
@ -304,16 +304,18 @@ if g:go_highlight_functions != 0
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
syn match goReceiverType /\w\+/ contained syn match goReceiverType /\w\+/ contained
syn match goFunction /\w\+/ contained syn match goFunction /\w\+/ contained
syn match goFunctionCall /\w\+\ze(/ contains=GoBuiltins,goDeclaration
else else
syn keyword goDeclaration func syn keyword goDeclaration func
endif endif
hi def link goFunction Function hi def link goFunction Function
hi def link goFunctionCall Type
" Methods; " Methods;
if g:go_highlight_methods != 0 if g:go_highlight_methods != 0
syn match goMethod /\.\w\+\ze(/hs=s+1 syn match goMethodCall /\.\w\+\ze(/hs=s+1
endif endif
hi def link goMethod Type hi def link goMethodCall Type
" Fields; " Fields;
if g:go_highlight_fields != 0 if g:go_highlight_fields != 0
@ -326,7 +328,7 @@ if g:go_highlight_types != 0
syn match goTypeConstructor /\<\w\+{/he=e-1 syn match goTypeConstructor /\<\w\+{/he=e-1
syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl
syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl
syn match goDeclType /\<interface\|struct\>/ contained skipwhite skipnl syn match goDeclType /\<interface\|struct\>/ skipwhite skipnl
hi def link goReceiverType Type hi def link goReceiverType Type
else else
syn keyword goDeclType struct interface syn keyword goDeclType struct interface
@ -374,12 +376,7 @@ endif
hi def link goCoverageNormalText Comment hi def link goCoverageNormalText Comment
function! s:hi() function! s:hi()
" :GoSameIds hi def link goSameId Search
if &background == 'dark'
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black guibg=white guifg=black
else
hi def goSameId term=bold cterm=bold ctermbg=14 guibg=Cyan
endif
" :GoCoverage commands " :GoCoverage commands
hi def goCoverageCovered ctermfg=green guifg=#A6E22E hi def goCoverageCovered ctermfg=green guifg=#A6E22E

View File

@ -13,6 +13,10 @@ elseif exists("b:current_syntax")
finish finish
endif endif
if !exists('g:haskell_disable_TH')
let g:haskell_disable_TH = 0
endif
syn spell notoplevel syn spell notoplevel
syn match haskellRecordField contained containedin=haskellBlock syn match haskellRecordField contained containedin=haskellBlock
\ "[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)" \ "[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)"
@ -82,7 +86,7 @@ syn match haskellLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$"
\ contains= \ contains=
\ haskellTodo, \ haskellTodo,
\ @Spell \ @Spell
syn match haskellBacktick "`[A-Za-z_][A-Za-z0-9_\.']*`" syn match haskellBacktick "`[A-Za-z_][A-Za-z0-9_\.']*#\?`"
syn region haskellString start=+"+ skip=+\\\\\|\\"+ end=+"+ syn region haskellString start=+"+ skip=+\\\\\|\\"+ end=+"+
\ contains=@Spell \ contains=@Spell
syn match haskellIdentifier "[_a-z][a-zA-z0-9_']*" contained syn match haskellIdentifier "[_a-z][a-zA-z0-9_']*" contained
@ -94,14 +98,16 @@ syn region haskellBlockComment start="{-" end="-}"
\ haskellTodo, \ haskellTodo,
\ @Spell \ @Spell
syn region haskellPragma start="{-#" end="#-}" syn region haskellPragma start="{-#" end="#-}"
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
syn match haskellPreProc "^#.*$" syn match haskellPreProc "^#.*$"
syn keyword haskellTodo TODO FIXME contained syn keyword haskellTodo TODO FIXME contained
" Treat a shebang line at the start of the file as a comment " Treat a shebang line at the start of the file as a comment
syn match haskellShebang "\%^#!.*$" syn match haskellShebang "\%^#!.*$"
if exists('g:haskell_disable_TH') && g:haskell_disable_TH == 0
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
endif
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1 if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
syn keyword haskellTypeRoles phantom representational nominal contained syn keyword haskellTypeRoles phantom representational nominal contained
syn region haskellTypeRoleBlock matchgroup=haskellTypeRoles start="type\s\+role" end="$" keepend syn region haskellTypeRoleBlock matchgroup=haskellTypeRoles start="type\s\+role" end="$" keepend

View File

@ -44,6 +44,29 @@ syn keyword htmlTagName contained missing-glyph mpath
syn keyword htmlTagName contained text textPath tref tspan vkern syn keyword htmlTagName contained text textPath tref tspan vkern
syn keyword htmlTagName contained metadata title syn keyword htmlTagName contained metadata title
" MathML tags
" https://www.w3.org/TR/MathML3/appendixi.html#index.elem
syn keyword htmlTagName contained abs and annotation annotation-xml apply approx arccos arccosh arccot arccoth
syn keyword htmlTagName contained arccsc arccsch arcsec arcsech arcsin arcsinh arctan arctanh arg bind
syn keyword htmlTagName contained bvar card cartesianproduct cbytes ceiling cerror ci cn codomain complexes
syn keyword htmlTagName contained compose condition conjugate cos cosh cot coth cs csc csch
syn keyword htmlTagName contained csymbol curl declare degree determinant diff divergence divide domain domainofapplication
syn keyword htmlTagName contained emptyset eq equivalent eulergamma exists exp exponentiale factorial factorof false
syn keyword htmlTagName contained floor fn forall gcd geq grad gt ident image imaginary
syn keyword htmlTagName contained imaginaryi implies in infinity int integers intersect interval inverse lambda
syn keyword htmlTagName contained laplacian lcm leq limit list ln log logbase lowlimit lt
syn keyword htmlTagName contained maction maligngroup malignmark math matrix matrixrow max mean median menclose
syn keyword htmlTagName contained merror mfenced mfrac mglyph mi mi" min minus mlabeledtr mlongdiv
syn keyword htmlTagName contained mmultiscripts mn mo mode moment momentabout mover mpadded mphantom mprescripts
syn keyword htmlTagName contained mroot mrow ms mscarries mscarry msgroup msline mspace msqrt msrow
syn keyword htmlTagName contained mstack mstyle msub msubsup msup mtable mtd mtext mtr munder
syn keyword htmlTagName contained munderover naturalnumbers neq none not notanumber notin notprsubset notsubset or
syn keyword htmlTagName contained otherwise outerproduct partialdiff pi piece piecewise plus power primes product
syn keyword htmlTagName contained prsubset quotient rationals real reals reln rem root scalarproduct sdev
syn keyword htmlTagName contained sec sech selector semantics sep set setdiff share sin sinh
syn keyword htmlTagName contained span subset sum tan tanh tendsto times transpose true union
syn keyword htmlTagName contained uplimit variance vector vectorproduct xor
" Custom Element " Custom Element
syn match htmlTagName contained "\<[a-z_]\([a-z0-9_.]\+\)\?\(\-[a-z0-9_.]\+\)\+\>" syn match htmlTagName contained "\<[a-z_]\([a-z0-9_.]\+\)\?\(\-[a-z0-9_.]\+\)\+\>"
@ -79,13 +102,26 @@ syn keyword htmlArg contained async
" <content> " <content>
syn keyword htmlArg contained select syn keyword htmlArg contained select
" <iframe> " <iframe>
syn keyword htmlArg contained seamless srcdoc sandbox syn keyword htmlArg contained seamless srcdoc sandbox allowfullscreen
" <picture> " <picture>
syn keyword htmlArg contained srcset sizes syn keyword htmlArg contained srcset sizes
" <a>
syn keyword htmlArg contained download media
" <script>, <style>
syn keyword htmlArg contained nonce
" <area>, <a>, <img>, <iframe>, <link>
syn keyword htmlArg contained referrerpolicy
" <script>
" https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute
syn keyword htmlArg contained integrity crossorigin
" Custom Data Attributes " Custom Data Attributes
" http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data " http://w3c.github.io/html/single-page.html#embedding-custom-non-visible-data-with-the-data-attributes
syn match htmlArg "\<\(data\-\([a-z_][a-z0-9_.\-]*\)\+\)\=\>" contained syn match htmlArg "\<\(data\-\([a-z_][a-z0-9_.\-]*\)\+\)\{1,}\>" contained
" Vendor Extension Attributes
" http://w3c.github.io/html/single-page.html#conformance-requirements-extensibility
syn match htmlArg "\<\(x\-\([a-z_][a-z0-9_.\-]*\)\+\)\{2,}\>" contained
" Microdata " Microdata
" http://dev.w3.org/html5/md/ " http://dev.w3.org/html5/md/
@ -120,4 +156,22 @@ syn keyword htmlArg contained y y1 y2 yChannelSelector
syn keyword htmlArg contained z zoomAndPan syn keyword htmlArg contained z zoomAndPan
syn keyword htmlArg contained alignment-baseline baseline-shift clip-path clip-rule clip color-interpolation-filters color-interpolation color-profile color-rendering color cursor direction display dominant-baseline enable-background fill-opacity fill-rule fill filter flood-color flood-opacity font-family font-size-adjust font-size font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering stop-color stop-opacity stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width stroke text-anchor text-decoration text-rendering unicode-bidi visibility word-spacing writing-mode syn keyword htmlArg contained alignment-baseline baseline-shift clip-path clip-rule clip color-interpolation-filters color-interpolation color-profile color-rendering color cursor direction display dominant-baseline enable-background fill-opacity fill-rule fill filter flood-color flood-opacity font-family font-size-adjust font-size font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering stop-color stop-opacity stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width stroke text-anchor text-decoration text-rendering unicode-bidi visibility word-spacing writing-mode
" MathML attributes
" https://www.w3.org/TR/MathML3/chapter2.html#interf.toplevel.atts
syn keyword htmlArg contained accent accentunder actiontype align alignmentscope altimg altimg-height altimg-valign altimg-width alttext
syn keyword htmlArg contained annotation-xml background base baseline bevelled cd cdgroup charalign charspacing close
syn keyword htmlArg contained closure color columnalign columnalignment columnlines columnspacing columnspan columnwidth crossout decimalpoint
syn keyword htmlArg contained definitionURL denomalign depth display displaystyle edge encoding equalcolumns equalrows fence
syn keyword htmlArg contained fontfamily fontsize fontstyle fontweight form frame framespacing groupalign height indentalign
syn keyword htmlArg contained indentalignfirst indentalignlast indentshift indentshiftfirst indentshiftlast indenttarget index infixlinebreakstyle integer largeop
syn keyword htmlArg contained leftoverhang length linebreak linebreakmultchar linebreakstyle lineleading linethickness location longdivstyle lquote
syn keyword htmlArg contained lspace ltr macros math mathbackground mathcolor mathsize mathvariant maxsize maxwidth
syn keyword htmlArg contained mediummathspace menclose minlabelspacing minsize mode movablelimits msgroup mslinethickness name nargs
syn keyword htmlArg contained newline notation numalign number occurrence open order other overflow position
syn keyword htmlArg contained rightoverhang role rowalign rowlines rowspacing rowspan rquote rspace schemaLocation scope
syn keyword htmlArg contained scriptlevel scriptminsize scriptsize scriptsizemultiplier selection separator separators shift side stackalign
syn keyword htmlArg contained stretchy subscriptshift superscriptshift symmetric thickmathspace thinmathspace type valign verythickmathspace verythinmathspace
syn keyword htmlArg contained veryverythickmathspace veryverythinmathspace voffset width xref
endif endif

View File

@ -11,7 +11,7 @@ endif
syntax case match syntax case match
" keywords " keywords
syntax keyword jasmineSuite describe it beforeEach afterEach syntax keyword jasmineSuite describe it beforeEach afterEach beforeAll afterAll
syntax keyword jasmine jasmine syntax keyword jasmine jasmine
" special " special
@ -35,6 +35,9 @@ syntax match jasmineClock /\.mockDate/
" disabled " disabled
syntax keyword jasmineDisabled xdescribe xit syntax keyword jasmineDisabled xdescribe xit
" focused
syntax keyword jasmineFocused fdescribe fit
" expectation " expectation
syntax keyword jasmineExpectation expect syntax keyword jasmineExpectation expect
@ -59,6 +62,7 @@ syntax cluster JavaScriptAll add=
\ jasmine, \ jasmine,
\ jasmineClock, \ jasmineClock,
\ jasmineDisabled, \ jasmineDisabled,
\ jasmineFocused,
\ jasmineExpectation, \ jasmineExpectation,
\ jasmineMatcher, \ jasmineMatcher,
\ jasmineNot, \ jasmineNot,
@ -72,6 +76,7 @@ let b:current_syntax = "jasmine"
hi def link jasmine Special hi def link jasmine Special
hi def link jasmineClock Special hi def link jasmineClock Special
hi def link jasmineDisabled Error hi def link jasmineDisabled Error
hi def link jasmineFocused Special
hi def link jasmineExpectation Statement hi def link jasmineExpectation Statement
hi def link jasmineMatcher Statement hi def link jasmineMatcher Statement
hi def link jasmineNot Special hi def link jasmineNot Special

View File

@ -39,16 +39,15 @@ syntax keyword jsBooleanTrue true
syntax keyword jsBooleanFalse false syntax keyword jsBooleanFalse false
" Modules " Modules
syntax keyword jsModuleKeywords contained import syntax keyword jsImport import skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup,jsFlowImportType
syntax keyword jsModuleKeywords contained export skipwhite skipempty nextgroup=jsExportBlock,jsModuleDefault syntax keyword jsExport export skipwhite skipempty nextgroup=@jsAll,jsModuleGroup,jsExportDefault,jsModuleAsterisk,jsModuleKeyword
syntax keyword jsModuleOperators contained from syntax match jsModuleKeyword contained /\k\+/ skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
syntax keyword jsModuleOperators contained as syntax keyword jsExportDefault contained default skipwhite skipempty nextgroup=@jsExpression
syntax region jsModuleGroup contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise,jsComment syntax keyword jsExportDefaultGroup contained default skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
syntax match jsModuleAsterisk contained /*/ syntax match jsModuleAsterisk contained /\*/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAs,jsFrom
syntax keyword jsModuleDefault contained default skipwhite skipempty nextgroup=@jsExpression syntax keyword jsModuleAs contained as skipwhite skipempty nextgroup=jsModuleKeyword,jsExportDefaultGroup
syntax region jsImportContainer start=/\<import\> / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsComment,jsString,jsTemplateString,jsNoise,jsModuleGroup,jsModuleAsterisk syntax keyword jsFrom contained from skipwhite skipempty nextgroup=jsString
syntax region jsExportContainer start=/\<export\> / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsStorageClass,jsModuleDefault,@jsExpression syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup
syntax region jsExportBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise,jsComment
" Strings, Templates, Numbers " Strings, Templates, Numbers
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend
@ -76,12 +75,14 @@ else
endif endif
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
" Objects
syntax match jsObjectKey contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue syntax match jsObjectKey contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
syntax match jsObjectColon contained /:/ skipwhite skipempty
syntax region jsObjectKeyString contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue syntax region jsObjectKeyString contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
syntax region jsObjectKeyString contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue syntax region jsObjectKeyString contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
syntax match jsObjectSeparator contained /,/ syntax match jsObjectSeparator contained /,/
syntax region jsObjectValue contained start=/:/ end=/\%(,\|}\)\@=/ contains=@jsExpression extend syntax region jsObjectValue contained start=/:/ end=/\%(,\|}\)\@=/ contains=jsObjectColon,@jsExpression extend
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup=jsFuncArgs syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup=jsFuncArgs
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/ syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/
syntax match jsObjectMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName syntax match jsObjectMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName
@ -93,32 +94,32 @@ exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal
exe 'syntax keyword jsUndefined undefined '.(exists('g:javascript_conceal_undefined') ? 'conceal cchar='.g:javascript_conceal_undefined : '') exe 'syntax keyword jsUndefined undefined '.(exists('g:javascript_conceal_undefined') ? 'conceal cchar='.g:javascript_conceal_undefined : '')
exe 'syntax keyword jsNan NaN '.(exists('g:javascript_conceal_NaN') ? 'conceal cchar='.g:javascript_conceal_NaN : '') exe 'syntax keyword jsNan NaN '.(exists('g:javascript_conceal_NaN') ? 'conceal cchar='.g:javascript_conceal_NaN : '')
exe 'syntax keyword jsPrototype prototype '.(exists('g:javascript_conceal_prototype') ? 'conceal cchar='.g:javascript_conceal_prototype : '') exe 'syntax keyword jsPrototype prototype '.(exists('g:javascript_conceal_prototype') ? 'conceal cchar='.g:javascript_conceal_prototype : '')
exe 'syntax keyword jsThis this contained '.(exists('g:javascript_conceal_this') ? 'conceal cchar='.g:javascript_conceal_this : '') exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal_this') ? 'conceal cchar='.g:javascript_conceal_this : '')
exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '') exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
" Statement Keywords " Statement Keywords
syntax keyword jsStatement contained break continue with yield debugger syntax keyword jsStatement contained break continue with yield debugger
syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse
syntax keyword jsConditional else skipwhite skipempty nextgroup=jsCommentMisc,jsBlock syntax keyword jsConditional else skipwhite skipempty nextgroup=jsCommentMisc,jsIfElseBlock
syntax keyword jsConditional switch skipwhite skipempty nextgroup=jsParenSwitch syntax keyword jsConditional switch skipwhite skipempty nextgroup=jsParenSwitch
syntax keyword jsRepeat while for skipwhite skipempty nextgroup=jsParenRepeat syntax keyword jsRepeat while for skipwhite skipempty nextgroup=jsParenRepeat,jsForAwait
syntax keyword jsDo do skipwhite skipempty nextgroup=jsBlock syntax keyword jsDo do skipwhite skipempty nextgroup=jsRepeatBlock
syntax keyword jsLabel contained case default syntax keyword jsLabel contained case default
syntax keyword jsTry try skipwhite skipempty nextgroup=jsTryCatchBlock syntax keyword jsTry try skipwhite skipempty nextgroup=jsTryCatchBlock
syntax keyword jsFinally contained finally skipwhite skipempty nextgroup=jsBlock syntax keyword jsFinally contained finally skipwhite skipempty nextgroup=jsFinallyBlock
syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch
syntax keyword jsException throw syntax keyword jsException throw
syntax keyword jsAsyncKeyword async await syntax keyword jsAsyncKeyword async await
syntax match jsSwitchColon contained /:/ skipwhite skipempty nextgroup=jsBlock syntax match jsSwitchColon contained /:/ skipwhite skipempty nextgroup=jsSwitchBlock
" Keywords " Keywords
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
syntax keyword jsGlobalNodeObjects module exports global process syntax keyword jsGlobalNodeObjects module exports global process
syntax match jsGlobalNodeObjects /require/ contains=jsFuncCall syntax match jsGlobalNodeObjects /require/ containedin=jsFuncCall
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval
" DISCUSS: How imporant is this, really? Perhaps it should be linked to an error because I assume the keywords are reserved? " DISCUSS: How imporant is this, really? Perhaps it should be linked to an error because I assume the keywords are reserved?
syntax keyword jsFutureKeys abstract enum int short boolean interface byte long char final native synchronized float package throws goto private transient implements protected volatile double public syntax keyword jsFutureKeys abstract enum int short boolean interface byte long char final native synchronized float package throws goto private transient implements protected volatile double public
" DISCUSS: Should we really be matching stuff like this? " DISCUSS: Should we really be matching stuff like this?
" DOM2 Objects " DOM2 Objects
@ -134,22 +135,27 @@ syntax keyword jsDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECT
" HTML events and internal variables " HTML events and internal variables
syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
"" Code blocks " Code blocks
syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression extend fold syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression,jsSpreadExpression extend fold
syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll extend fold syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll extend fold
syntax region jsParenIfElse contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsBlock extend fold syntax region jsParenDecorator contained matchgroup=jsParensDecorator start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc extend fold
syntax region jsParenRepeat contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsBlock extend fold syntax region jsParenIfElse contained matchgroup=jsParensIfElse start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsIfElseBlock extend fold
syntax region jsParenSwitch contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold syntax region jsParenRepeat contained matchgroup=jsParensRepeat start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsRepeatBlock extend fold
syntax region jsParenCatch contained matchgroup=jsParens start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold syntax region jsParenSwitch contained matchgroup=jsParensSwitch start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold
syntax region jsFuncArgs contained matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsRestExpression,jsFlowArgumentDef skipwhite skipempty nextgroup=jsCommentFunction,jsFuncBlock,jsFlowReturn extend fold syntax region jsParenCatch contained matchgroup=jsParensCatch start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold
syntax region jsFuncArgs contained matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsDestructuringArray,jsRestExpression,jsFlowArgumentDef skipwhite skipempty nextgroup=jsCommentFunction,jsFuncBlock,jsFlowReturn extend fold
syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsNoise extend fold syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsNoise extend fold
syntax region jsFuncBlock contained matchgroup=jsFuncBraces start=/{/ end=/}/ contains=@jsAll extend fold syntax region jsFuncBlock contained matchgroup=jsFuncBraces start=/{/ end=/}/ contains=@jsAll extend fold
syntax region jsIfElseBlock contained matchgroup=jsIfElseBraces start=/{/ end=/}/ contains=@jsAll extend fold
syntax region jsBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll extend fold syntax region jsBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll extend fold
syntax region jsTryCatchBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll skipwhite skipempty nextgroup=jsCatch,jsFinally extend fold syntax region jsTryCatchBlock contained matchgroup=jsTryCatchBraces start=/{/ end=/}/ contains=@jsAll skipwhite skipempty nextgroup=jsCatch,jsFinally extend fold
syntax region jsSwitchBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll,jsLabel,jsSwitchColon extend fold syntax region jsFinallyBlock contained matchgroup=jsFinallyBraces start=/{/ end=/}/ contains=@jsAll extend fold
syntax region jsSwitchBlock contained matchgroup=jsSwitchBraces start=/{/ end=/}/ contains=@jsAll,jsLabel,jsSwitchColon extend fold
syntax region jsRepeatBlock contained matchgroup=jsRepeatBraces start=/{/ end=/}/ contains=@jsAll extend fold
syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces start=/{/ end=/}/ contains=jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression extend fold syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces start=/{/ end=/}/ contains=jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression extend fold
syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression extend fold syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression extend fold
syntax region jsObject matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression extend fold syntax region jsObject matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator extend fold
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment skipwhite skipempty nextgroup=jsFrom
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression
syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/ syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/
@ -160,6 +166,7 @@ syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ s
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
syntax match jsFuncArgCommas contained ',' syntax match jsFuncArgCommas contained ','
syntax keyword jsArguments contained arguments syntax keyword jsArguments contained arguments
syntax keyword jsForAwait contained await skipwhite skipempty nextgroup=jsParenRepeat
" Matches a single keyword argument with no parens " Matches a single keyword argument with no parens
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
@ -167,14 +174,16 @@ syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArg
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '') exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock contains=jsFuncBraces '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '') exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock,jsCommentFunction '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
exe 'syntax match jsArrowFunction /()\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_noarg_arrow_function') ? 'conceal cchar='.g:javascript_conceal_noarg_arrow_function : '')
exe 'syntax match jsArrowFunction /_\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_underscore_arrow_function') ? 'conceal cchar='.g:javascript_conceal_underscore_arrow_function : '')
syntax keyword jsClassKeywords contained extends class " Classes
syntax keyword jsClassKeyword contained class
syntax keyword jsExtendsKeyword contained extends skipwhite skipempty nextgroup=@jsExpression
syntax match jsClassNoise contained /\./ syntax match jsClassNoise contained /\./
syntax match jsClassMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsFuncName,jsClassProperty syntax match jsClassMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsFuncName,jsClassProperty
syntax match jsClassDefinition /\<class\>\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
syntax match jsDecorator contained "@" nextgroup=jsDecoratorFunction
syntax match jsDecoratorFunction contained "[a-zA-Z_][a-zA-Z0-9_.]*"
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsClassValue syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsClassValue
syntax region jsClassValue contained start=/=/ end=/\%(;\|}\|\n\)\@=/ contains=@jsExpression syntax region jsClassValue contained start=/=/ end=/\%(;\|}\|\n\)\@=/ contains=@jsExpression
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
@ -207,6 +216,10 @@ syntax region jsCommentClass contained start=/\/\*/ end=/\*\// contains=j
syntax region jsCommentMisc contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsBlock extend keepend syntax region jsCommentMisc contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsBlock extend keepend
syntax region jsCommentMisc contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsBlock fold extend keepend syntax region jsCommentMisc contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsBlock fold extend keepend
" Decorators
syntax match jsDecorator /^\s*@/ nextgroup=jsDecoratorFunction
syntax match jsDecoratorFunction contained /[a-zA-Z_][a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator
if exists("javascript_plugin_jsdoc") if exists("javascript_plugin_jsdoc")
runtime extras/jsdoc.vim runtime extras/jsdoc.vim
" NGDoc requires JSDoc " NGDoc requires JSDoc
@ -220,7 +233,7 @@ if exists("javascript_plugin_flow")
endif endif
syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsBlock,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsBlock,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo
syntax cluster jsAll contains=@jsExpression,jsExportContainer,jsImportContainer,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsStatement,jsException,jsTry,jsAsyncKeyword syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsStatement,jsException,jsTry,jsAsyncKeyword
" Define the default highlighting. " Define the default highlighting.
" For version 5.7 and earlier: only when not done already " For version 5.7 and earlier: only when not done already
@ -234,6 +247,10 @@ if version >= 508 || !exists("did_javascript_syn_inits")
endif endif
HiLink jsComment Comment HiLink jsComment Comment
HiLink jsEnvComment PreProc HiLink jsEnvComment PreProc
HiLink jsParensIfElse jsParens
HiLink jsParensRepeat jsParens
HiLink jsParensSwitch jsParens
HiLink jsParensCatch jsParens
HiLink jsCommentTodo Todo HiLink jsCommentTodo Todo
HiLink jsString String HiLink jsString String
HiLink jsObjectKeyString String HiLink jsObjectKeyString String
@ -264,6 +281,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsFinally Exception HiLink jsFinally Exception
HiLink jsCatch Exception HiLink jsCatch Exception
HiLink jsAsyncKeyword Keyword HiLink jsAsyncKeyword Keyword
HiLink jsForAwait Keyword
HiLink jsArrowFunction Type HiLink jsArrowFunction Type
HiLink jsFunction Type HiLink jsFunction Type
HiLink jsGenerator jsFunction HiLink jsGenerator jsFunction
@ -277,7 +295,8 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsOperator Operator HiLink jsOperator Operator
HiLink jsOf Operator HiLink jsOf Operator
HiLink jsStorageClass StorageClass HiLink jsStorageClass StorageClass
HiLink jsClassKeywords Structure HiLink jsClassKeyword Keyword
HiLink jsExtendsKeyword Keyword
HiLink jsThis Special HiLink jsThis Special
HiLink jsSuper Constant HiLink jsSuper Constant
HiLink jsNan Number HiLink jsNan Number
@ -287,6 +306,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsFloat Float HiLink jsFloat Float
HiLink jsBooleanTrue Boolean HiLink jsBooleanTrue Boolean
HiLink jsBooleanFalse Boolean HiLink jsBooleanFalse Boolean
HiLink jsObjectColon jsNoise
HiLink jsNoise Noise HiLink jsNoise Noise
HiLink jsBrackets Noise HiLink jsBrackets Noise
HiLink jsParens Noise HiLink jsParens Noise
@ -295,8 +315,14 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsFuncParens Noise HiLink jsFuncParens Noise
HiLink jsClassBraces Noise HiLink jsClassBraces Noise
HiLink jsClassNoise Noise HiLink jsClassNoise Noise
HiLink jsIfElseBraces jsBraces
HiLink jsTryCatchBraces jsBraces
HiLink jsModuleBraces jsBraces
HiLink jsObjectBraces Noise HiLink jsObjectBraces Noise
HiLink jsObjectSeparator Noise HiLink jsObjectSeparator Noise
HiLink jsFinallyBraces jsBraces
HiLink jsRepeatBraces jsBraces
HiLink jsSwitchBraces jsBraces
HiLink jsSpecial Special HiLink jsSpecial Special
HiLink jsTemplateVar Special HiLink jsTemplateVar Special
HiLink jsTemplateBraces jsBraces HiLink jsTemplateBraces jsBraces
@ -304,13 +330,18 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsGlobalNodeObjects Constant HiLink jsGlobalNodeObjects Constant
HiLink jsExceptions Constant HiLink jsExceptions Constant
HiLink jsBuiltins Constant HiLink jsBuiltins Constant
HiLink jsModuleKeywords Include HiLink jsImport Include
HiLink jsModuleOperators Include HiLink jsExport Include
HiLink jsModuleDefault Include HiLink jsExportDefault StorageClass
HiLink jsDecorator Special HiLink jsExportDefaultGroup jsExportDefault
HiLink jsDecoratorFunction Special HiLink jsModuleAs Include
HiLink jsFuncArgOperator jsFuncArgs HiLink jsModuleComma jsNoise
HiLink jsModuleAsterisk Noise HiLink jsModuleAsterisk Noise
HiLink jsFrom Include
HiLink jsDecorator Special
HiLink jsDecoratorFunction Function
HiLink jsParensDecorator jsParens
HiLink jsFuncArgOperator jsFuncArgs
HiLink jsClassProperty jsObjectKey HiLink jsClassProperty jsObjectKey
HiLink jsSpreadOperator Operator HiLink jsSpreadOperator Operator
HiLink jsRestOperator Operator HiLink jsRestOperator Operator

25
syntax/layout/footer.vim Normal file
View File

@ -0,0 +1,25 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" highlight
hi link ngxComment Comment
hi link ngxVariable Identifier
hi link ngxVariableString PreProc
hi link ngxString String
hi link ngxLocationPath String
hi link ngxLocationNamedLoc Identifier
hi link ngxBoolean Boolean
hi link ngxRewriteFlag Boolean
hi link ngxDirectiveBlock Statement
hi link ngxDirectiveImportant Type
hi link ngxDirectiveControl Keyword
hi link ngxDirectiveError Constant
hi link ngxDirectiveDeprecated Error
hi link ngxDirective Identifier
hi link ngxDirectiveThirdParty Special
let b:current_syntax = "nginx"
endif

566
syntax/layout/header.vim Normal file
View File

@ -0,0 +1,566 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Vim syntax file
" Language: nginx.conf
if exists("b:current_syntax")
finish
end
setlocal iskeyword+=.
setlocal iskeyword+=/
setlocal iskeyword+=:
syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
syn match ngxComment ' *#.*$'
syn match ngxRewriteURI /\S\+/ contained contains=ngxVariableString nextgroup=ngxURI skipwhite
syn match ngxURI /\S\+/ contained contains=ngxVariableString skipwhite
syn match ngxLocationPath /[^ {]\+/ contained
syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
syn keyword ngxBoolean on
syn keyword ngxBoolean off
syn keyword ngxDirectiveBlock http
syn keyword ngxDirectiveBlock mail
syn keyword ngxDirectiveBlock events
syn keyword ngxDirectiveBlock server
syn keyword ngxDirectiveBlock types
syn match ngxLocationOperator /\(=\|\~\*\|\^\~\|\~\)/ contained nextgroup=ngxLocationPath,ngxString skipwhite
syn match ngxLocationNamedLoc /@\w\+/
syn keyword ngxDirectiveBlock location nextgroup=ngxLocationNamedLoc,ngxLocationOperator,ngxLocationPath,ngxString skipwhite
syn keyword ngxDirectiveBlock upstream
syn keyword ngxDirectiveBlock charset_map
syn keyword ngxDirectiveBlock limit_except
syn keyword ngxDirectiveBlock if
syn keyword ngxDirectiveBlock geo
syn keyword ngxDirectiveBlock map
syn keyword ngxDirectiveBlock split_clients
syn keyword ngxDirectiveImportant include
syn keyword ngxDirectiveImportant root
syn keyword ngxDirectiveImportant server
syn keyword ngxDirectiveImportant server_name
syn keyword ngxDirectiveImportant listen
syn keyword ngxDirectiveImportant internal
syn keyword ngxDirectiveImportant proxy_pass
syn keyword ngxDirectiveImportant memcached_pass
syn keyword ngxDirectiveImportant fastcgi_pass
syn keyword ngxDirectiveImportant scgi_pass
syn keyword ngxDirectiveImportant uwsgi_pass
syn keyword ngxDirectiveImportant try_files
syn keyword ngxDirectiveControl break
syn keyword ngxDirectiveControl return
syn keyword ngxDirectiveControl rewrite nextgroup=ngxRewriteURI skipwhite
syn keyword ngxDirectiveControl set
syn keyword ngxRewriteFlag last break redirect permanent
syn keyword ngxDirectiveError error_page
syn keyword ngxDirectiveError post_action
syn keyword ngxDirectiveDeprecated connections
syn keyword ngxDirectiveDeprecated imap
syn keyword ngxDirectiveDeprecated limit_zone
syn keyword ngxDirectiveDeprecated mysql_test
syn keyword ngxDirectiveDeprecated open_file_cache_retest
syn keyword ngxDirectiveDeprecated optimize_server_names
syn keyword ngxDirectiveDeprecated satisfy_any
syn keyword ngxDirectiveDeprecated so_keepalive
syn keyword ngxDirective accept_mutex
syn keyword ngxDirective accept_mutex_delay
syn keyword ngxDirective acceptex_read
syn keyword ngxDirective access_log
syn keyword ngxDirective add_after_body
syn keyword ngxDirective add_before_body
syn keyword ngxDirective add_header
syn keyword ngxDirective addition_types
syn keyword ngxDirective aio
syn keyword ngxDirective alias
syn keyword ngxDirective allow
syn keyword ngxDirective ancient_browser
syn keyword ngxDirective ancient_browser_value
syn keyword ngxDirective auth_basic
syn keyword ngxDirective auth_basic_user_file
syn keyword ngxDirective auth_http
syn keyword ngxDirective auth_http_header
syn keyword ngxDirective auth_http_timeout
syn keyword ngxDirective auth_request
syn keyword ngxDirective auth_request_set
syn keyword ngxDirective autoindex
syn keyword ngxDirective autoindex_exact_size
syn keyword ngxDirective autoindex_localtime
syn keyword ngxDirective charset
syn keyword ngxDirective charset_types
syn keyword ngxDirective chunked_transfer_encoding
syn keyword ngxDirective client_body_buffer_size
syn keyword ngxDirective client_body_in_file_only
syn keyword ngxDirective client_body_in_single_buffer
syn keyword ngxDirective client_body_temp_path
syn keyword ngxDirective client_body_timeout
syn keyword ngxDirective client_header_buffer_size
syn keyword ngxDirective client_header_timeout
syn keyword ngxDirective client_max_body_size
syn keyword ngxDirective connection_pool_size
syn keyword ngxDirective create_full_put_path
syn keyword ngxDirective daemon
syn keyword ngxDirective dav_access
syn keyword ngxDirective dav_methods
syn keyword ngxDirective debug_connection
syn keyword ngxDirective debug_points
syn keyword ngxDirective default_type
syn keyword ngxDirective degradation
syn keyword ngxDirective degrade
syn keyword ngxDirective deny
syn keyword ngxDirective devpoll_changes
syn keyword ngxDirective devpoll_events
syn keyword ngxDirective directio
syn keyword ngxDirective directio_alignment
syn keyword ngxDirective disable_symlinks
syn keyword ngxDirective empty_gif
syn keyword ngxDirective env
syn keyword ngxDirective epoll_events
syn keyword ngxDirective error_log
syn keyword ngxDirective etag
syn keyword ngxDirective eventport_events
syn keyword ngxDirective expires
syn keyword ngxDirective fastcgi_bind
syn keyword ngxDirective fastcgi_buffer_size
syn keyword ngxDirective fastcgi_buffering
syn keyword ngxDirective fastcgi_buffers
syn keyword ngxDirective fastcgi_busy_buffers_size
syn keyword ngxDirective fastcgi_cache
syn keyword ngxDirective fastcgi_cache_bypass
syn keyword ngxDirective fastcgi_cache_key
syn keyword ngxDirective fastcgi_cache_lock
syn keyword ngxDirective fastcgi_cache_lock_age
syn keyword ngxDirective fastcgi_cache_lock_timeout
syn keyword ngxDirective fastcgi_cache_methods
syn keyword ngxDirective fastcgi_cache_min_uses
syn keyword ngxDirective fastcgi_cache_path
syn keyword ngxDirective fastcgi_cache_purge
syn keyword ngxDirective fastcgi_cache_revalidate
syn keyword ngxDirective fastcgi_cache_use_stale
syn keyword ngxDirective fastcgi_cache_valid
syn keyword ngxDirective fastcgi_catch_stderr
syn keyword ngxDirective fastcgi_connect_timeout
syn keyword ngxDirective fastcgi_force_ranges
syn keyword ngxDirective fastcgi_hide_header
syn keyword ngxDirective fastcgi_ignore_client_abort
syn keyword ngxDirective fastcgi_ignore_headers
syn keyword ngxDirective fastcgi_index
syn keyword ngxDirective fastcgi_intercept_errors
syn keyword ngxDirective fastcgi_keep_conn
syn keyword ngxDirective fastcgi_limit_rate
syn keyword ngxDirective fastcgi_max_temp_file_size
syn keyword ngxDirective fastcgi_next_upstream
syn keyword ngxDirective fastcgi_next_upstream_timeout
syn keyword ngxDirective fastcgi_next_upstream_tries
syn keyword ngxDirective fastcgi_no_cache
syn keyword ngxDirective fastcgi_param
syn keyword ngxDirective fastcgi_pass_header
syn keyword ngxDirective fastcgi_pass_request_body
syn keyword ngxDirective fastcgi_pass_request_headers
syn keyword ngxDirective fastcgi_read_timeout
syn keyword ngxDirective fastcgi_request_buffering
syn keyword ngxDirective fastcgi_send_lowat
syn keyword ngxDirective fastcgi_send_timeout
syn keyword ngxDirective fastcgi_split_path_info
syn keyword ngxDirective fastcgi_store
syn keyword ngxDirective fastcgi_store_access
syn keyword ngxDirective fastcgi_temp_file_write_size
syn keyword ngxDirective fastcgi_temp_path
syn keyword ngxDirective flv
syn keyword ngxDirective geoip_city
syn keyword ngxDirective geoip_country
syn keyword ngxDirective geoip_org
syn keyword ngxDirective geoip_proxy
syn keyword ngxDirective geoip_proxy_recursive
syn keyword ngxDirective google_perftools_profiles
syn keyword ngxDirective gunzip
syn keyword ngxDirective gunzip_buffers
syn keyword ngxDirective gzip
syn keyword ngxDirective gzip_buffers
syn keyword ngxDirective gzip_comp_level
syn keyword ngxDirective gzip_disable
syn keyword ngxDirective gzip_hash
syn keyword ngxDirective gzip_http_version
syn keyword ngxDirective gzip_min_length
syn keyword ngxDirective gzip_no_buffer
syn keyword ngxDirective gzip_proxied
syn keyword ngxDirective gzip_static
syn keyword ngxDirective gzip_types
syn keyword ngxDirective gzip_vary
syn keyword ngxDirective gzip_window
syn keyword ngxDirective hash
syn keyword ngxDirective http2 " Not a real directive
syn keyword ngxDirective if_modified_since
syn keyword ngxDirective ignore_invalid_headers
syn keyword ngxDirective image_filter
syn keyword ngxDirective image_filter_buffer
syn keyword ngxDirective image_filter_interlace
syn keyword ngxDirective image_filter_jpeg_quality
syn keyword ngxDirective image_filter_sharpen
syn keyword ngxDirective image_filter_transparency
syn keyword ngxDirective imap_auth
syn keyword ngxDirective imap_capabilities
syn keyword ngxDirective imap_client_buffer
syn keyword ngxDirective index
syn keyword ngxDirective iocp_threads
syn keyword ngxDirective ip_hash
syn keyword ngxDirective js_run
syn keyword ngxDirective js_set
syn keyword ngxDirective keepalive
syn keyword ngxDirective keepalive_disable
syn keyword ngxDirective keepalive_requests
syn keyword ngxDirective keepalive_timeout
syn keyword ngxDirective kqueue_changes
syn keyword ngxDirective kqueue_events
syn keyword ngxDirective large_client_header_buffers
syn keyword ngxDirective least_conn
syn keyword ngxDirective limit_conn
syn keyword ngxDirective limit_conn_log_level
syn keyword ngxDirective limit_conn_status
syn keyword ngxDirective limit_conn_zone
syn keyword ngxDirective limit_rate
syn keyword ngxDirective limit_rate_after
syn keyword ngxDirective limit_req
syn keyword ngxDirective limit_req_log_level
syn keyword ngxDirective limit_req_status
syn keyword ngxDirective limit_req_zone
syn keyword ngxDirective lingering_close
syn keyword ngxDirective lingering_time
syn keyword ngxDirective lingering_timeout
syn keyword ngxDirective load_module
syn keyword ngxDirective lock_file
syn keyword ngxDirective log_format
syn keyword ngxDirective log_not_found
syn keyword ngxDirective log_subrequest
syn keyword ngxDirective map_hash_bucket_size
syn keyword ngxDirective map_hash_max_size
syn keyword ngxDirective master_process
syn keyword ngxDirective max_ranges
syn keyword ngxDirective memcached_bind
syn keyword ngxDirective memcached_buffer_size
syn keyword ngxDirective memcached_connect_timeout
syn keyword ngxDirective memcached_gzip_flag
syn keyword ngxDirective memcached_next_upstream
syn keyword ngxDirective memcached_next_upstream_timeout
syn keyword ngxDirective memcached_next_upstream_tries
syn keyword ngxDirective memcached_read_timeout
syn keyword ngxDirective memcached_send_timeout
syn keyword ngxDirective merge_slashes
syn keyword ngxDirective min_delete_depth
syn keyword ngxDirective modern_browser
syn keyword ngxDirective modern_browser_value
syn keyword ngxDirective mp4
syn keyword ngxDirective mp4_buffer_size
syn keyword ngxDirective mp4_max_buffer_size
syn keyword ngxDirective mp4_limit_rate
syn keyword ngxDirective mp4_limit_rate_after
syn keyword ngxDirective msie_padding
syn keyword ngxDirective msie_refresh
syn keyword ngxDirective multi_accept
syn keyword ngxDirective open_file_cache
syn keyword ngxDirective open_file_cache_errors
syn keyword ngxDirective open_file_cache_events
syn keyword ngxDirective open_file_cache_min_uses
syn keyword ngxDirective open_file_cache_valid
syn keyword ngxDirective open_log_file_cache
syn keyword ngxDirective output_buffers
syn keyword ngxDirective override_charset
syn keyword ngxDirective pcre_jit
syn keyword ngxDirective perl
syn keyword ngxDirective perl_modules
syn keyword ngxDirective perl_require
syn keyword ngxDirective perl_set
syn keyword ngxDirective pid
syn keyword ngxDirective pop3_auth
syn keyword ngxDirective pop3_capabilities
syn keyword ngxDirective port_in_redirect
syn keyword ngxDirective post_acceptex
syn keyword ngxDirective postpone_gzipping
syn keyword ngxDirective postpone_output
syn keyword ngxDirective protocol nextgroup=ngxMailProtocol skipwhite
syn keyword ngxMailProtocol imap pop3 smtp
syn keyword ngxDirective proxy
syn keyword ngxDirective proxy_bind
syn keyword ngxDirective proxy_buffer
syn keyword ngxDirective proxy_buffer_size
syn keyword ngxDirective proxy_buffering
syn keyword ngxDirective proxy_buffers
syn keyword ngxDirective proxy_busy_buffers_size
syn keyword ngxDirective proxy_cache
syn keyword ngxDirective proxy_cache_bypass
syn keyword ngxDirective proxy_cache_key
syn keyword ngxDirective proxy_cache_lock
syn keyword ngxDirective proxy_cache_lock_timeout
syn keyword ngxDirective proxy_cache_methods
syn keyword ngxDirective proxy_cache_min_uses
syn keyword ngxDirective proxy_cache_path
syn keyword ngxDirective proxy_cache_revalidate
syn keyword ngxDirective proxy_cache_use_stale
syn keyword ngxDirective proxy_cache_valid
syn keyword ngxDirective proxy_connect_timeout
syn keyword ngxDirective proxy_cookie_domain
syn keyword ngxDirective proxy_cookie_path
syn keyword ngxDirective proxy_force_ranges
syn keyword ngxDirective proxy_headers_hash_bucket_size
syn keyword ngxDirective proxy_headers_hash_max_size
syn keyword ngxDirective proxy_hide_header
syn keyword ngxDirective proxy_http_version
syn keyword ngxDirective proxy_ignore_client_abort
syn keyword ngxDirective proxy_ignore_headers
syn keyword ngxDirective proxy_intercept_errors
syn keyword ngxDirective proxy_max_temp_file_size
syn keyword ngxDirective proxy_method
syn keyword ngxDirective proxy_next_upstream
syn keyword ngxDirective proxy_next_upstream_timeout
syn keyword ngxDirective proxy_next_upstream_tries
syn keyword ngxDirective proxy_no_cache
syn keyword ngxDirective proxy_pass_error_message
syn keyword ngxDirective proxy_pass_header
syn keyword ngxDirective proxy_pass_request_body
syn keyword ngxDirective proxy_pass_request_headers
syn keyword ngxDirective proxy_read_timeout
syn keyword ngxDirective proxy_redirect
syn keyword ngxDirective proxy_send_lowat
syn keyword ngxDirective proxy_send_timeout
syn keyword ngxDirective proxy_set_body
syn keyword ngxDirective proxy_set_header
syn keyword ngxDirective proxy_ssl_ciphers
syn keyword ngxDirective proxy_ssl_crl
syn keyword ngxDirective proxy_ssl_name
syn keyword ngxDirective proxy_ssl_protocols
syn keyword ngxDirective proxy_ssl_server_name
syn keyword ngxDirective proxy_ssl_session_reuse
syn keyword ngxDirective proxy_ssl_trusted_certificate
syn keyword ngxDirective proxy_ssl_verify
syn keyword ngxDirective proxy_ssl_verify_depth
syn keyword ngxDirective proxy_store
syn keyword ngxDirective proxy_store_access
syn keyword ngxDirective proxy_temp_file_write_size
syn keyword ngxDirective proxy_temp_path
syn keyword ngxDirective proxy_timeout
syn keyword ngxDirective random_index
syn keyword ngxDirective read_ahead
syn keyword ngxDirective real_ip_header
syn keyword ngxDirective real_ip_recursive
syn keyword ngxDirective recursive_error_pages
syn keyword ngxDirective referer_hash_bucket_size
syn keyword ngxDirective referer_hash_max_size
syn keyword ngxDirective request_pool_size
syn keyword ngxDirective reset_timedout_connection
syn keyword ngxDirective resolver
syn keyword ngxDirective resolver_timeout
syn keyword ngxDirective rewrite_log
syn keyword ngxDirective rtsig_overflow_events
syn keyword ngxDirective rtsig_overflow_test
syn keyword ngxDirective rtsig_overflow_threshold
syn keyword ngxDirective rtsig_signo
syn keyword ngxDirective satisfy
syn keyword ngxDirective scgi_bind
syn keyword ngxDirective scgi_buffer_size
syn keyword ngxDirective scgi_buffering
syn keyword ngxDirective scgi_buffers
syn keyword ngxDirective scgi_busy_buffers_size
syn keyword ngxDirective scgi_cache
syn keyword ngxDirective scgi_cache_bypass
syn keyword ngxDirective scgi_cache_key
syn keyword ngxDirective scgi_cache_lock
syn keyword ngxDirective scgi_cache_lock_timeout
syn keyword ngxDirective scgi_cache_methods
syn keyword ngxDirective scgi_cache_min_uses
syn keyword ngxDirective scgi_cache_path
syn keyword ngxDirective scgi_cache_revalidate
syn keyword ngxDirective scgi_cache_use_stale
syn keyword ngxDirective scgi_cache_valid
syn keyword ngxDirective scgi_connect_timeout
syn keyword ngxDirective scgi_force_ranges
syn keyword ngxDirective scgi_hide_header
syn keyword ngxDirective scgi_ignore_client_abort
syn keyword ngxDirective scgi_ignore_headers
syn keyword ngxDirective scgi_intercept_errors
syn keyword ngxDirective scgi_max_temp_file_size
syn keyword ngxDirective scgi_next_upstream
syn keyword ngxDirective scgi_next_upstream_timeout
syn keyword ngxDirective scgi_next_upstream_tries
syn keyword ngxDirective scgi_no_cache
syn keyword ngxDirective scgi_param
syn keyword ngxDirective scgi_pass_header
syn keyword ngxDirective scgi_pass_request_body
syn keyword ngxDirective scgi_pass_request_headers
syn keyword ngxDirective scgi_read_timeout
syn keyword ngxDirective scgi_send_timeout
syn keyword ngxDirective scgi_store
syn keyword ngxDirective scgi_store_access
syn keyword ngxDirective scgi_temp_file_write_size
syn keyword ngxDirective scgi_temp_path
syn keyword ngxDirective secure_link
syn keyword ngxDirective secure_link_md5
syn keyword ngxDirective secure_link_secret
syn keyword ngxDirective send_lowat
syn keyword ngxDirective send_timeout
syn keyword ngxDirective sendfile
syn keyword ngxDirective sendfile_max_chunk
syn keyword ngxDirective server_name_in_redirect
syn keyword ngxDirective server_names_hash_bucket_size
syn keyword ngxDirective server_names_hash_max_size
syn keyword ngxDirective server_tokens
syn keyword ngxDirective set_real_ip_from
syn keyword ngxDirective smtp_auth
syn keyword ngxDirective smtp_capabilities
syn keyword ngxDirective smtp_client_buffer
syn keyword ngxDirective smtp_greeting_delay
syn keyword ngxDirective source_charset
syn keyword ngxDirective spdy_chunk_size
syn keyword ngxDirective spdy_headers_comp
syn keyword ngxDirective spdy_keepalive_timeout
syn keyword ngxDirective spdy_max_concurrent_streams
syn keyword ngxDirective spdy_pool_size
syn keyword ngxDirective spdy_recv_buffer_size
syn keyword ngxDirective spdy_recv_timeout
syn keyword ngxDirective spdy_streams_index_size
syn keyword ngxDirective ssi
syn keyword ngxDirective ssi_ignore_recycled_buffers
syn keyword ngxDirective ssi_last_modified
syn keyword ngxDirective ssi_min_file_chunk
syn keyword ngxDirective ssi_silent_errors
syn keyword ngxDirective ssi_types
syn keyword ngxDirective ssi_value_length
syn keyword ngxDirective ssl
syn keyword ngxDirective ssl_buffer_size
syn keyword ngxDirective ssl_certificate
syn keyword ngxDirective ssl_certificate_key
syn keyword ngxDirective ssl_ciphers
syn keyword ngxDirective ssl_client_certificate
syn keyword ngxDirective ssl_crl
syn keyword ngxDirective ssl_dhparam
syn keyword ngxDirective ssl_ecdh_curve
syn keyword ngxDirective ssl_engine
syn keyword ngxDirective ssl_password_file
syn keyword ngxDirective ssl_prefer_server_ciphers
syn keyword ngxDirective ssl_protocols
syn keyword ngxDirective ssl_session_cache
syn keyword ngxDirective ssl_session_ticket_key
syn keyword ngxDirective ssl_session_tickets
syn keyword ngxDirective ssl_session_timeout
syn keyword ngxDirective ssl_stapling
syn keyword ngxDirective ssl_stapling_file
syn keyword ngxDirective ssl_stapling_responder
syn keyword ngxDirective ssl_stapling_verify
syn keyword ngxDirective ssl_trusted_certificate
syn keyword ngxDirective ssl_verify_client
syn keyword ngxDirective ssl_verify_depth
syn keyword ngxDirective starttls
syn keyword ngxDirective stub_status
syn keyword ngxDirective sub_filter
syn keyword ngxDirective sub_filter_last_modified
syn keyword ngxDirective sub_filter_once
syn keyword ngxDirective sub_filter_types
syn keyword ngxDirective tcp_nodelay
syn keyword ngxDirective tcp_nopush
syn keyword ngxDirective thread_pool
syn keyword ngxDirective thread_stack_size
syn keyword ngxDirective timeout
syn keyword ngxDirective timer_resolution
syn keyword ngxDirective types_hash_bucket_size
syn keyword ngxDirective types_hash_max_size
syn keyword ngxDirective underscores_in_headers
syn keyword ngxDirective uninitialized_variable_warn
syn keyword ngxDirective use
syn keyword ngxDirective user
syn keyword ngxDirective userid
syn keyword ngxDirective userid_domain
syn keyword ngxDirective userid_expires
syn keyword ngxDirective userid_mark
syn keyword ngxDirective userid_name
syn keyword ngxDirective userid_p3p
syn keyword ngxDirective userid_path
syn keyword ngxDirective userid_service
syn keyword ngxDirective uwsgi_bind
syn keyword ngxDirective uwsgi_buffer_size
syn keyword ngxDirective uwsgi_buffering
syn keyword ngxDirective uwsgi_buffers
syn keyword ngxDirective uwsgi_busy_buffers_size
syn keyword ngxDirective uwsgi_cache
syn keyword ngxDirective uwsgi_cache_bypass
syn keyword ngxDirective uwsgi_cache_key
syn keyword ngxDirective uwsgi_cache_lock
syn keyword ngxDirective uwsgi_cache_lock_age
syn keyword ngxDirective uwsgi_cache_lock_timeout
syn keyword ngxDirective uwsgi_cache_methods
syn keyword ngxDirective uwsgi_cache_min_uses
syn keyword ngxDirective uwsgi_cache_path
syn keyword ngxDirective uwsgi_cache_revalidate
syn keyword ngxDirective uwsgi_cache_use_stale
syn keyword ngxDirective uwsgi_cache_valid
syn keyword ngxDirective uwsgi_connect_timeout
syn keyword ngxDirective uwsgi_force_ranges
syn keyword ngxDirective uwsgi_hide_header
syn keyword ngxDirective uwsgi_ignore_client_abort
syn keyword ngxDirective uwsgi_ignore_headers
syn keyword ngxDirective uwsgi_intercept_errors
syn keyword ngxDirective uwsgi_max_temp_file_size
syn keyword ngxDirective uwsgi_modifier1
syn keyword ngxDirective uwsgi_modifier2
syn keyword ngxDirective uwsgi_next_upstream
syn keyword ngxDirective uwsgi_next_upstream_timeout
syn keyword ngxDirective uwsgi_next_upstream_tries
syn keyword ngxDirective uwsgi_no_cache
syn keyword ngxDirective uwsgi_param
syn keyword ngxDirective uwsgi_pass
syn keyword ngxDirective uwsgi_pass_header
syn keyword ngxDirective uwsgi_pass_request_body
syn keyword ngxDirective uwsgi_pass_request_headers
syn keyword ngxDirective uwsgi_read_timeout
syn keyword ngxDirective uwsgi_request_buffering
syn keyword ngxDirective uwsgi_send_timeout
syn keyword ngxDirective uwsgi_ssl_certificate
syn keyword ngxDirective uwsgi_ssl_certificate_key
syn keyword ngxDirective uwsgi_ssl_ciphers
syn keyword ngxDirective uwsgi_ssl_crl
syn keyword ngxDirective uwsgi_ssl_name
syn keyword ngxDirective uwsgi_ssl_password_file
syn keyword ngxDirective uwsgi_ssl_protocols
syn keyword ngxDirective uwsgi_ssl_server_name
syn keyword ngxDirective uwsgi_ssl_session_reuse
syn keyword ngxDirective uwsgi_ssl_trusted_certificate
syn keyword ngxDirective uwsgi_ssl_verify
syn keyword ngxDirective uwsgi_ssl_verify_depth
syn keyword ngxDirective uwsgi_store
syn keyword ngxDirective uwsgi_store_access
syn keyword ngxDirective uwsgi_string
syn keyword ngxDirective uwsgi_temp_file_write_size
syn keyword ngxDirective uwsgi_temp_path
syn keyword ngxDirective valid_referers
syn keyword ngxDirective variables_hash_bucket_size
syn keyword ngxDirective variables_hash_max_size
syn keyword ngxDirective worker_aio_requests
syn keyword ngxDirective worker_connections
syn keyword ngxDirective worker_cpu_affinity
syn keyword ngxDirective worker_priority
syn keyword ngxDirective worker_processes
syn keyword ngxDirective worker_rlimit_core
syn keyword ngxDirective worker_rlimit_nofile
syn keyword ngxDirective worker_rlimit_sigpending
syn keyword ngxDirective worker_threads
syn keyword ngxDirective working_directory
syn keyword ngxDirective xclient
syn keyword ngxDirective xml_entities
syn keyword ngxDirective xslt_last_modified
syn keyword ngxDirective xslt_param
syn keyword ngxDirective xslt_string_param
syn keyword ngxDirective xslt_stylesheet
syn keyword ngxDirective xslt_types
" 3rd party module list:
" https://www.nginx.com/resources/wiki/modules/
endif

View File

@ -15,20 +15,33 @@ endif
syntax sync fromstart syntax sync fromstart
function! s:FoldableRegion(tag, name, expr)
let synexpr = 'syntax region ' . a:name . ' ' . a:expr
let pfx = 'g:lua_syntax_fold_'
if !exists('g:lua_syntax_nofold') || exists(pfx . a:tag) || exists(pfx . a:name)
let synexpr .= ' fold'
end
exec synexpr
endfunction
" Clusters " Clusters
syntax cluster luaBase contains=luaComment,luaCommentLong,luaConstant,luaNumber,luaString,luaStringLong,luaBuiltIn syntax cluster luaBase contains=luaComment,luaCommentLong,luaConstant,luaNumber,luaString,luaStringLong,luaBuiltIn
syntax cluster luaExpr contains=@luaBase,luaTable,luaParen,luaBracket,luaSpecialTable,luaSpecialValue,luaOperator,luaEllipsis,luaComma,luaFunc,luaFuncCall,luaError syntax cluster luaExpr contains=@luaBase,luaTable,luaParen,luaBracket,luaSpecialTable,luaSpecialValue,luaOperator,luaSymbolOperator,luaEllipsis,luaComma,luaFunc,luaFuncCall,luaError
syntax cluster luaStat contains=@luaExpr,luaIfThen,luaBlock,luaLoop,luaGoto,luaLabel,luaLocal,luaStatement,luaSemiCol syntax cluster luaStat
\ contains=@luaExpr,luaIfThen,luaBlock,luaLoop,luaGoto,luaLabel,luaLocal,luaStatement,luaSemiCol,luaErrHand
syntax match luaNoise /\%(\.\|,\|:\|\;\)/ syntax match luaNoise /\%(\.\|,\|:\|\;\)/
" Symbols " Symbols
syntax region luaTable transparent matchgroup=luaBraces start="{" end="}" contains=@luaExpr fold call s:FoldableRegion('table', 'luaTable',
\ 'transparent matchgroup=luaBraces start="{" end="}" contains=@luaExpr')
syntax region luaParen transparent matchgroup=luaParens start='(' end=')' contains=@luaExpr syntax region luaParen transparent matchgroup=luaParens start='(' end=')' contains=@luaExpr
syntax region luaBracket transparent matchgroup=luaBrackets start="\[" end="\]" contains=@luaExpr syntax region luaBracket transparent matchgroup=luaBrackets start="\[" end="\]" contains=@luaExpr
syntax match luaComma "," syntax match luaComma ","
syntax match luaSemiCol ";" syntax match luaSemiCol ";"
syntax match luaOperator "[#<>=~^&|*/%+-]\|\.\." if !exists('g:lua_syntax_nosymboloperator')
syntax match luaSymbolOperator "[#<>=~^&|*/%+-]\|\.\."
endi
syntax match luaEllipsis "\.\.\." syntax match luaEllipsis "\.\.\."
" Catch errors caused by unbalanced brackets and keywords " Catch errors caused by unbalanced brackets and keywords
@ -43,14 +56,16 @@ syntax match luaComment "\%^#!.*"
" Comments " Comments
syntax keyword luaCommentTodo contained TODO FIXME XXX TBD syntax keyword luaCommentTodo contained TODO FIXME XXX TBD
syntax match luaComment "--.*$" contains=luaCommentTodo,luaDocTag,@Spell syntax match luaComment "--.*$" contains=luaCommentTodo,luaDocTag,@Spell
syntax region luaCommentLong matchgroup=luaCommentLongTag start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaCommentTodo,luaDocTag,@Spell fold call s:FoldableRegion('comment', 'luaCommentLong',
\ 'matchgroup=luaCommentLongTag start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaCommentTodo,luaDocTag,@Spell')
syntax match luaDocTag contained "\s@\k\+" syntax match luaDocTag contained "\s@\k\+"
" Function calls " Function calls
syntax match luaFuncCall /\k\+\%(\s*[{('"]\)\@=/ syntax match luaFuncCall /\k\+\%(\s*[{('"]\)\@=/
" Functions " Functions
syntax region luaFunc transparent matchgroup=luaFuncKeyword start="\<function\>" end="\<end\>" contains=@luaStat,luaFuncSig fold call s:FoldableRegion('function', 'luaFunc',
\ 'transparent matchgroup=luaFuncKeyword start="\<function\>" end="\<end\>" contains=@luaStat,luaFuncSig')
syntax region luaFuncSig contained transparent start="\(\<function\>\)\@<=" end=")" contains=luaFuncId,luaFuncArgs keepend syntax region luaFuncSig contained transparent start="\(\<function\>\)\@<=" end=")" contains=luaFuncId,luaFuncArgs keepend
syntax match luaFuncId contained "[^(]*(\@=" contains=luaFuncTable,luaFuncName syntax match luaFuncId contained "[^(]*(\@=" contains=luaFuncTable,luaFuncName
syntax match luaFuncTable contained /\k\+\%(\s*[.:]\)\@=/ syntax match luaFuncTable contained /\k\+\%(\s*[.:]\)\@=/
@ -63,7 +78,8 @@ syntax match luaFuncArgComma contained /,/
syntax region luaIfThen transparent matchgroup=luaCond start="\<if\>" end="\<then\>"me=e-4 contains=@luaExpr nextgroup=luaThenEnd skipwhite skipempty syntax region luaIfThen transparent matchgroup=luaCond start="\<if\>" end="\<then\>"me=e-4 contains=@luaExpr nextgroup=luaThenEnd skipwhite skipempty
" then ... end " then ... end
syntax region luaThenEnd contained transparent matchgroup=luaCond start="\<then\>" end="\<end\>" contains=@luaStat,luaElseifThen,luaElse fold call s:FoldableRegion('control', 'luaThenEnd',
\ 'contained transparent matchgroup=luaCond start="\<then\>" end="\<end\>" contains=@luaStat,luaElseifThen,luaElse')
" elseif ... then " elseif ... then
syntax region luaElseifThen contained transparent matchgroup=luaCond start="\<elseif\>" end="\<then\>" contains=@luaExpr syntax region luaElseifThen contained transparent matchgroup=luaCond start="\<elseif\>" end="\<then\>" contains=@luaExpr
@ -72,16 +88,20 @@ syntax region luaElseifThen contained transparent matchgroup=luaCond start="\<el
syntax keyword luaElse contained else syntax keyword luaElse contained else
" do ... end " do ... end
syntax region luaBlock transparent matchgroup=luaRepeat start="\<do\>" end="\<end\>" contains=@luaStat fold call s:FoldableRegion('control', 'luaLoopBlock',
\ 'transparent matchgroup=luaRepeat start="\<do\>" end="\<end\>" contains=@luaStat contained')
call s:FoldableRegion('control', 'luaBlock',
\ 'transparent matchgroup=luaStatement start="\<do\>" end="\<end\>" contains=@luaStat')
" repeat ... until " repeat ... until
syntax region luaLoop transparent matchgroup=luaRepeat start="\<repeat\>" end="\<until\>" contains=@luaStat nextgroup=@luaExpr fold call s:FoldableRegion('control', 'luaLoop',
\ 'transparent matchgroup=luaRepeat start="\<repeat\>" end="\<until\>" contains=@luaStat nextgroup=@luaExpr')
" while ... do " while ... do
syntax region luaLoop transparent matchgroup=luaRepeat start="\<while\>" end="\<do\>"me=e-2 contains=@luaExpr nextgroup=luaBlock skipwhite skipempty fold syntax region luaLoop transparent matchgroup=luaRepeat start="\<while\>" end="\<do\>"me=e-2 contains=@luaExpr nextgroup=luaLoopBlock skipwhite skipempty
" for ... do and for ... in ... do " for ... do and for ... in ... do
syntax region luaLoop transparent matchgroup=luaRepeat start="\<for\>" end="\<do\>"me=e-2 contains=@luaExpr,luaIn nextgroup=luaBlock skipwhite skipempty syntax region luaLoop transparent matchgroup=luaRepeat start="\<for\>" end="\<do\>"me=e-2 contains=@luaExpr,luaIn nextgroup=luaLoopBlock skipwhite skipempty
syntax keyword luaIn contained in syntax keyword luaIn contained in
" goto and labels " goto and labels
@ -98,7 +118,8 @@ syntax keyword luaStatement break return
" Strings " Strings
syntax match luaStringSpecial contained #\\[\\abfnrtvz'"]\|\\x[[:xdigit:]]\{2}\|\\[[:digit:]]\{,3}# syntax match luaStringSpecial contained #\\[\\abfnrtvz'"]\|\\x[[:xdigit:]]\{2}\|\\[[:digit:]]\{,3}#
syntax region luaStringLong matchgroup=luaStringLongTag start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell call s:FoldableRegion('string', 'luaStringLong',
\ 'matchgroup=luaStringLongTag start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell')
syntax region luaString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaStringSpecial,@Spell syntax region luaString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaStringSpecial,@Spell
syntax region luaString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaStringSpecial,@Spell syntax region luaString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaStringSpecial,@Spell
@ -113,50 +134,60 @@ syntax match luaFloat "\.\d\+\%([eE][-+]\=\d\+\)\=\>"
" Floating point constant, without dot, with exponent " Floating point constant, without dot, with exponent
syntax match luaFloat "\<\d\+[eE][-+]\=\d\+\>" syntax match luaFloat "\<\d\+[eE][-+]\=\d\+\>"
" Special names from the Standard Library
syntax keyword luaSpecialTable
\ bit32
\ coroutine
\ debug
\ io
\ math
\ os
\ package
\ string
\ table
\ utf8
syntax keyword luaSpecialValue " Special names from the Standard Library
\ _G if !exists('g:lua_syntax_nostdlib')
\ _VERSION syntax keyword luaSpecialValue
\ assert \ module
\ collectgarbage \ require
\ dofile
\ error syntax keyword luaSpecialTable _G
\ getfenv
\ getmetatable syntax keyword luaErrHand
\ ipairs \ assert
\ load \ error
\ loadfile \ pcall
\ loadstring \ xpcall
\ module
\ next if !exists('g:lua_syntax_noextendedstdlib')
\ pairs syntax keyword luaSpecialTable
\ pcall \ bit32
\ print \ coroutine
\ rawequal \ debug
\ rawget \ io
\ rawlen \ math
\ rawset \ os
\ require \ package
\ select \ string
\ setfenv \ table
\ setmetatable \ utf8
\ tonumber
\ tostring syntax keyword luaSpecialValue
\ type \ _VERSION
\ unpack \ collectgarbage
\ xpcall \ dofile
\ getfenv
\ getmetatable
\ ipairs
\ load
\ loadfile
\ loadstring
\ next
\ pairs
\ print
\ rawequal
\ rawget
\ rawlen
\ rawset
\ select
\ setfenv
\ setmetatable
\ tonumber
\ tostring
\ type
\ unpack
endif
endif
" Define the default highlighting. " Define the default highlighting.
" For version 5.7 and earlier: only when not done already " For version 5.7 and earlier: only when not done already
@ -173,21 +204,23 @@ if version >= 508 || !exists("did_lua_syn_inits")
HiLink luaBrackets Noise HiLink luaBrackets Noise
HiLink luaBuiltIn Special HiLink luaBuiltIn Special
HiLink luaComment Comment HiLink luaComment Comment
HiLink luaCommentLongTag luaCommentLong
HiLink luaCommentLong luaComment HiLink luaCommentLong luaComment
HiLink luaCommentTodo Todo HiLink luaCommentTodo Todo
HiLink luaCond Conditional HiLink luaCond Conditional
HiLink luaConstant Boolean HiLink luaConstant Constant
HiLink luaDocTag Underlined HiLink luaDocTag Underlined
HiLink luaEllipsis StorageClass HiLink luaEllipsis Special
HiLink luaElse Conditional HiLink luaElse Conditional
HiLink luaError Error HiLink luaError Error
HiLink luaFloat Float HiLink luaFloat Float
HiLink luaFuncTable Function
HiLink luaFuncArgName Noise HiLink luaFuncArgName Noise
HiLink luaFuncCall PreProc HiLink luaFuncCall PreProc
HiLink luaFuncId Function HiLink luaFuncId Function
HiLink luaFuncKeyword Type HiLink luaFuncName luaFuncId
HiLink luaFuncName Function HiLink luaFuncTable luaFuncId
HiLink luaFuncKeyword luaFunction
HiLink luaFunction Structure
HiLink luaFuncParens Noise HiLink luaFuncParens Noise
HiLink luaGoto luaStatement HiLink luaGoto luaStatement
HiLink luaGotoLabel Noise HiLink luaGotoLabel Noise
@ -195,6 +228,7 @@ if version >= 508 || !exists("did_lua_syn_inits")
HiLink luaLabel Label HiLink luaLabel Label
HiLink luaLocal Type HiLink luaLocal Type
HiLink luaNumber Number HiLink luaNumber Number
HiLink luaSymbolOperator luaOperator
HiLink luaOperator Operator HiLink luaOperator Operator
HiLink luaRepeat Repeat HiLink luaRepeat Repeat
HiLink luaSemiCol Delimiter HiLink luaSemiCol Delimiter
@ -204,6 +238,7 @@ if version >= 508 || !exists("did_lua_syn_inits")
HiLink luaString String HiLink luaString String
HiLink luaStringLong luaString HiLink luaStringLong luaString
HiLink luaStringSpecial SpecialChar HiLink luaStringSpecial SpecialChar
HiLink luaErrHand Exception
delcommand HiLink delcommand HiLink
end end

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Accept Language Module <https://www.nginx.com/resources/wiki/modules/accept_language/>
" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales.
syn keyword ngxDirectiveThirdParty set_from_accept_language
endif

View File

@ -0,0 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Access Key Module (DEPRECATED) <http://wiki.nginx.org/NginxHttpAccessKeyModule>
" Denies access unless the request URL contains an access key.
syn keyword ngxDirectiveThirdParty accesskey
syn keyword ngxDirectiveThirdParty accesskey_arg
syn keyword ngxDirectiveThirdParty accesskey_hashmethod
syn keyword ngxDirectiveThirdParty accesskey_signature
endif

42
syntax/modules/afcgi.vim Normal file
View File

@ -0,0 +1,42 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Asynchronous FastCGI Module <https://github.com/rsms/afcgi>
" Primarily a modified version of the Nginx FastCGI module which implements multiplexing of connections, allowing a single FastCGI server to handle many concurrent requests.
" syn keyword ngxDirectiveThirdParty fastcgi_bind
" syn keyword ngxDirectiveThirdParty fastcgi_buffer_size
" syn keyword ngxDirectiveThirdParty fastcgi_buffers
" syn keyword ngxDirectiveThirdParty fastcgi_busy_buffers_size
" syn keyword ngxDirectiveThirdParty fastcgi_cache
" syn keyword ngxDirectiveThirdParty fastcgi_cache_key
" syn keyword ngxDirectiveThirdParty fastcgi_cache_methods
" syn keyword ngxDirectiveThirdParty fastcgi_cache_min_uses
" syn keyword ngxDirectiveThirdParty fastcgi_cache_path
" syn keyword ngxDirectiveThirdParty fastcgi_cache_use_stale
" syn keyword ngxDirectiveThirdParty fastcgi_cache_valid
" syn keyword ngxDirectiveThirdParty fastcgi_catch_stderr
" syn keyword ngxDirectiveThirdParty fastcgi_connect_timeout
" syn keyword ngxDirectiveThirdParty fastcgi_hide_header
" syn keyword ngxDirectiveThirdParty fastcgi_ignore_client_abort
" syn keyword ngxDirectiveThirdParty fastcgi_ignore_headers
" syn keyword ngxDirectiveThirdParty fastcgi_index
" syn keyword ngxDirectiveThirdParty fastcgi_intercept_errors
" syn keyword ngxDirectiveThirdParty fastcgi_max_temp_file_size
" syn keyword ngxDirectiveThirdParty fastcgi_next_upstream
" syn keyword ngxDirectiveThirdParty fastcgi_param
" syn keyword ngxDirectiveThirdParty fastcgi_pass
" syn keyword ngxDirectiveThirdParty fastcgi_pass_header
" syn keyword ngxDirectiveThirdParty fastcgi_pass_request_body
" syn keyword ngxDirectiveThirdParty fastcgi_pass_request_headers
" syn keyword ngxDirectiveThirdParty fastcgi_read_timeout
" syn keyword ngxDirectiveThirdParty fastcgi_send_lowat
" syn keyword ngxDirectiveThirdParty fastcgi_send_timeout
" syn keyword ngxDirectiveThirdParty fastcgi_split_path_info
" syn keyword ngxDirectiveThirdParty fastcgi_store
" syn keyword ngxDirectiveThirdParty fastcgi_store_access
" syn keyword ngxDirectiveThirdParty fastcgi_temp_file_write_size
" syn keyword ngxDirectiveThirdParty fastcgi_temp_path
syn keyword ngxDirectiveThirdParty fastcgi_upstream_fail_timeout
syn keyword ngxDirectiveThirdParty fastcgi_upstream_max_fails
endif

View File

@ -0,0 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Akamai G2O Module <https://github.com/kaltura/nginx_mod_akamai_g2o>
" Nginx Module for Authenticating Akamai G2O requests
syn keyword ngxDirectiveThirdParty g2o
syn keyword ngxDirectiveThirdParty g2o_nonce
syn keyword ngxDirectiveThirdParty g2o_key
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Lua Module <https://github.com/alacner/nginx_lua_module>
" You can be very simple to execute lua code for nginx
syn keyword ngxDirectiveThirdParty lua_file
endif

View File

@ -0,0 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Array Variable Module <https://github.com/openresty/array-var-nginx-module>
" Add support for array-typed variables to nginx config files
syn keyword ngxDirectiveThirdParty array_split
syn keyword ngxDirectiveThirdParty array_join
syn keyword ngxDirectiveThirdParty array_map
syn keyword ngxDirectiveThirdParty array_map_op
endif

View File

@ -0,0 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Nginx Audio Track for HTTP Live Streaming <https://github.com/flavioribeiro/nginx-audio-track-for-hls-module>
" This nginx module generates audio track for hls streams on the fly.
syn keyword ngxDirectiveThirdParty ngx_hls_audio_track
syn keyword ngxDirectiveThirdParty ngx_hls_audio_track_rootpath
syn keyword ngxDirectiveThirdParty ngx_hls_audio_track_output_format
syn keyword ngxDirectiveThirdParty ngx_hls_audio_track_output_header
endif

View File

@ -0,0 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" AWS Proxy Module <https://github.com/anomalizer/ngx_aws_auth>
" Nginx module to proxy to authenticated AWS services
syn keyword ngxDirectiveThirdParty aws_access_key
syn keyword ngxDirectiveThirdParty aws_key_scope
syn keyword ngxDirectiveThirdParty aws_signing_key
syn keyword ngxDirectiveThirdParty aws_endpoint
syn keyword ngxDirectiveThirdParty aws_s3_bucket
syn keyword ngxDirectiveThirdParty aws_sign
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Backtrace module <https://github.com/alibaba/nginx-backtrace>
" A Nginx module to dump backtrace when a worker process exits abnormally
syn keyword ngxDirectiveThirdParty backtrace_log
syn keyword ngxDirectiveThirdParty backtrace_max_stack_size
endif

14
syntax/modules/brotli.vim Normal file
View File

@ -0,0 +1,14 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Brotli Module <https://github.com/google/ngx_brotli>
" Nginx module for Brotli compression
syn keyword ngxDirectiveThirdParty brotli_static
syn keyword ngxDirectiveThirdParty brotli
syn keyword ngxDirectiveThirdParty brotli_types
syn keyword ngxDirectiveThirdParty brotli_buffers
syn keyword ngxDirectiveThirdParty brotli_comp_level
syn keyword ngxDirectiveThirdParty brotli_window
syn keyword ngxDirectiveThirdParty brotli_min_length
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Cache Purge Module <https://github.com/FRiCKLE/ngx_cache_purge>
" Module adding ability to purge content from FastCGI and proxy caches.
syn keyword ngxDirectiveThirdParty fastcgi_cache_purge
syn keyword ngxDirectiveThirdParty proxy_cache_purge
endif

View File

@ -0,0 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Chunkin Module (DEPRECATED) <http://wiki.nginx.org/NginxHttpChunkinModule>
" HTTP 1.1 chunked-encoding request body support for Nginx.
syn keyword ngxDirectiveThirdParty chunkin
syn keyword ngxDirectiveThirdParty chunkin_keepalive
syn keyword ngxDirectiveThirdParty chunkin_max_chunks_per_buf
syn keyword ngxDirectiveThirdParty chunkin_resume
endif

View File

@ -0,0 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Circle GIF Module <https://github.com/evanmiller/nginx_circle_gif>
" Generates simple circle images with the colors and size specified in the URL.
syn keyword ngxDirectiveThirdParty circle_gif
syn keyword ngxDirectiveThirdParty circle_gif_max_radius
syn keyword ngxDirectiveThirdParty circle_gif_min_radius
syn keyword ngxDirectiveThirdParty circle_gif_step_radius
endif

View File

@ -0,0 +1,39 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Nginx-Clojure Module http://nginx-clojure.github.io/index.html<>
" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales.
syn keyword ngxDirectiveThirdParty jvm_path
syn keyword ngxDirectiveThirdParty jvm_var
syn keyword ngxDirectiveThirdParty jvm_classpath
syn keyword ngxDirectiveThirdParty jvm_classpath_check
syn keyword ngxDirectiveThirdParty jvm_workers
syn keyword ngxDirectiveThirdParty jvm_options
syn keyword ngxDirectiveThirdParty jvm_handler_type
syn keyword ngxDirectiveThirdParty jvm_init_handler_name
syn keyword ngxDirectiveThirdParty jvm_init_handler_code
syn keyword ngxDirectiveThirdParty jvm_exit_handler_name
syn keyword ngxDirectiveThirdParty jvm_exit_handler_code
syn keyword ngxDirectiveThirdParty handlers_lazy_init
syn keyword ngxDirectiveThirdParty auto_upgrade_ws
syn keyword ngxDirectiveThirdParty content_handler_type
syn keyword ngxDirectiveThirdParty content_handler_name
syn keyword ngxDirectiveThirdParty content_handler_code
syn keyword ngxDirectiveThirdParty rewrite_handler_type
syn keyword ngxDirectiveThirdParty rewrite_handler_name
syn keyword ngxDirectiveThirdParty rewrite_handler_code
syn keyword ngxDirectiveThirdParty access_handler_type
syn keyword ngxDirectiveThirdParty access_handler_name
syn keyword ngxDirectiveThirdParty access_handler_code
syn keyword ngxDirectiveThirdParty header_filter_type
syn keyword ngxDirectiveThirdParty header_filter_name
syn keyword ngxDirectiveThirdParty header_filter_code
syn keyword ngxDirectiveThirdParty content_handler_property
syn keyword ngxDirectiveThirdParty rewrite_handler_property
syn keyword ngxDirectiveThirdParty access_handler_property
syn keyword ngxDirectiveThirdParty header_filter_property
syn keyword ngxDirectiveThirdParty always_read_body
syn keyword ngxDirectiveThirdParty shared_map
syn keyword ngxDirectiveThirdParty write_page_size
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Upstream Consistent Hash <https://www.nginx.com/resources/wiki/modules/consistent_hash/>
" A load balancer that uses an internal consistent hash ring to select the right backend node.
syn keyword ngxDirectiveThirdParty consistent_hash
endif

View File

@ -0,0 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Nginx Development Kit <https://github.com/simpl/ngx_devel_kit>
" The NDK is an Nginx module that is designed to extend the core functionality of the excellent Nginx webserver in a way that can be used as a basis of other Nginx modules.
" NDK_UPSTREAM_LIST
" This submodule provides a directive that creates a list of upstreams, with optional weighting. This list can then be used by other modules to hash over the upstreams however they choose.
syn keyword ngxDirectiveThirdParty upstream_list
endif

View File

@ -0,0 +1,17 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Drizzle Module <https://github.com/openresty/drizzle-nginx-module>
" Make nginx talk directly to mysql, drizzle, and sqlite3 by libdrizzle.
syn keyword ngxDirectiveThirdParty drizzle_connect_timeout
syn keyword ngxDirectiveThirdParty drizzle_dbname
syn keyword ngxDirectiveThirdParty drizzle_keepalive
syn keyword ngxDirectiveThirdParty drizzle_module_header
syn keyword ngxDirectiveThirdParty drizzle_pass
syn keyword ngxDirectiveThirdParty drizzle_query
syn keyword ngxDirectiveThirdParty drizzle_recv_cols_timeout
syn keyword ngxDirectiveThirdParty drizzle_recv_rows_timeout
syn keyword ngxDirectiveThirdParty drizzle_send_query_timeout
syn keyword ngxDirectiveThirdParty drizzle_server
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Dynamic ETags Module <https://github.com/kali/nginx-dynamic-etags>
" Attempt at handling ETag / If-None-Match on proxied content.
syn keyword ngxDirectiveThirdParty dynamic_etags
endif

24
syntax/modules/echo.vim Normal file
View File

@ -0,0 +1,24 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Echo Module <https://github.com/openresty/echo-nginx-module>
" Brings 'echo', 'sleep', 'time', 'exec' and more shell-style goodies to Nginx config file.
syn keyword ngxDirectiveThirdParty echo
syn keyword ngxDirectiveThirdParty echo_after_body
syn keyword ngxDirectiveThirdParty echo_before_body
syn keyword ngxDirectiveThirdParty echo_blocking_sleep
syn keyword ngxDirectiveThirdParty echo_duplicate
syn keyword ngxDirectiveThirdParty echo_end
syn keyword ngxDirectiveThirdParty echo_exec
syn keyword ngxDirectiveThirdParty echo_flush
syn keyword ngxDirectiveThirdParty echo_foreach_split
syn keyword ngxDirectiveThirdParty echo_location
syn keyword ngxDirectiveThirdParty echo_location_async
syn keyword ngxDirectiveThirdParty echo_read_request_body
syn keyword ngxDirectiveThirdParty echo_request_body
syn keyword ngxDirectiveThirdParty echo_reset_timer
syn keyword ngxDirectiveThirdParty echo_sleep
syn keyword ngxDirectiveThirdParty echo_subrequest
syn keyword ngxDirectiveThirdParty echo_subrequest_async
endif

View File

@ -0,0 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Encrypted Session Module <https://github.com/openresty/encrypted-session-nginx-module>
" Encrypt and decrypt nginx variable values
syn keyword ngxDirectiveThirdParty encrypted_session_key
syn keyword ngxDirectiveThirdParty encrypted_session_iv
syn keyword ngxDirectiveThirdParty encrypted_session_expires
syn keyword ngxDirectiveThirdParty set_encrypt_session
syn keyword ngxDirectiveThirdParty set_decrypt_session
endif

View File

@ -0,0 +1,19 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Enhanced Memcached Module <https://github.com/bpaquet/ngx_http_enhanced_memcached_module>
" This module is based on the standard Nginx Memcached module, with some additonal features
syn keyword ngxDirectiveThirdParty enhanced_memcached_pass
syn keyword ngxDirectiveThirdParty enhanced_memcached_hash_keys_with_md5
syn keyword ngxDirectiveThirdParty enhanced_memcached_allow_put
syn keyword ngxDirectiveThirdParty enhanced_memcached_allow_delete
syn keyword ngxDirectiveThirdParty enhanced_memcached_stats
syn keyword ngxDirectiveThirdParty enhanced_memcached_flush
syn keyword ngxDirectiveThirdParty enhanced_memcached_flush_namespace
syn keyword ngxDirectiveThirdParty enhanced_memcached_bind
syn keyword ngxDirectiveThirdParty enhanced_memcached_connect_timeout
syn keyword ngxDirectiveThirdParty enhanced_memcached_send_timeout
syn keyword ngxDirectiveThirdParty enhanced_memcached_buffer_size
syn keyword ngxDirectiveThirdParty enhanced_memcached_read_timeout
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Events Module (DEPRECATED) <http://docs.dutov.org/nginx_modules_events_en.html>
" Provides options for start/stop events.
syn keyword ngxDirectiveThirdParty on_start
syn keyword ngxDirectiveThirdParty on_stop
endif

View File

@ -0,0 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" EY Balancer Module <https://github.com/ezmobius/nginx-ey-balancer>
" Adds a request queue to Nginx that allows the limiting of concurrent requests passed to the upstream.
syn keyword ngxDirectiveThirdParty max_connections
syn keyword ngxDirectiveThirdParty max_connections_max_queue_length
syn keyword ngxDirectiveThirdParty max_connections_queue_timeout
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Upstream Fair Balancer <https://www.nginx.com/resources/wiki/modules/fair_balancer/>
" Sends an incoming request to the least-busy backend server, rather than distributing requests round-robin.
syn keyword ngxDirectiveThirdParty fair
syn keyword ngxDirectiveThirdParty upstream_fair_shm_size
endif

View File

@ -0,0 +1,14 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Fancy Indexes Module <https://github.com/aperezdc/ngx-fancyindex>
" Like the built-in autoindex module, but fancier.
syn keyword ngxDirectiveThirdParty fancyindex
syn keyword ngxDirectiveThirdParty fancyindex_exact_size
syn keyword ngxDirectiveThirdParty fancyindex_footer
syn keyword ngxDirectiveThirdParty fancyindex_header
syn keyword ngxDirectiveThirdParty fancyindex_localtime
syn keyword ngxDirectiveThirdParty fancyindex_readme
syn keyword ngxDirectiveThirdParty fancyindex_readme_mode
endif

View File

@ -0,0 +1,12 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Form Auth Module <https://github.com/veruu/ngx_form_auth>
" Provides authentication and authorization with credentials submitted via POST request
syn keyword ngxDirectiveThirdParty form_auth
syn keyword ngxDirectiveThirdParty form_auth_pam_service
syn keyword ngxDirectiveThirdParty form_auth_login
syn keyword ngxDirectiveThirdParty form_auth_password
syn keyword ngxDirectiveThirdParty form_auth_remote_user
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Form Input Module <https://github.com/calio/form-input-nginx-module>
" Reads HTTP POST and PUT request body encoded in "application/x-www-form-urlencoded" and parses the arguments into nginx variables.
syn keyword ngxDirectiveThirdParty set_form_input
syn keyword ngxDirectiveThirdParty set_form_input_multi
endif

8
syntax/modules/geoip.vim Normal file
View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" GeoIP Module (DEPRECATED) <http://wiki.nginx.org/NginxHttp3rdPartyGeoIPModule>
" Country code lookups via the MaxMind GeoIP API.
syn keyword ngxDirectiveThirdParty geoip_country_file
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" GridFS Module <https://github.com/mdirolf/nginx-gridfs>
" Nginx module for serving files from MongoDB's GridFS
syn keyword ngxDirectiveThirdParty gridfs
endif

View File

@ -0,0 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Headers More Module <https://github.com/openresty/headers-more-nginx-module>
" Set and clear input and output headers...more than "add"!
syn keyword ngxDirectiveThirdParty more_clear_headers
syn keyword ngxDirectiveThirdParty more_clear_input_headers
syn keyword ngxDirectiveThirdParty more_set_headers
syn keyword ngxDirectiveThirdParty more_set_input_headers
endif

View File

@ -0,0 +1,15 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Health Checks Upstreams Module <https://www.nginx.com/resources/wiki/modules/healthcheck/>
" Polls backends and if they respond with HTTP 200 + an optional request body, they are marked good. Otherwise, they are marked bad.
syn keyword ngxDirectiveThirdParty healthcheck_enabled
syn keyword ngxDirectiveThirdParty healthcheck_delay
syn keyword ngxDirectiveThirdParty healthcheck_timeout
syn keyword ngxDirectiveThirdParty healthcheck_failcount
syn keyword ngxDirectiveThirdParty healthcheck_send
syn keyword ngxDirectiveThirdParty healthcheck_expected
syn keyword ngxDirectiveThirdParty healthcheck_buffer
syn keyword ngxDirectiveThirdParty healthcheck_status
endif

View File

@ -0,0 +1,12 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Accounting Module <https://github.com/Lax/ngx_http_accounting_module>
" Add traffic stat function to nginx. Useful for http accounting based on nginx configuration logic
syn keyword ngxDirectiveThirdParty http_accounting
syn keyword ngxDirectiveThirdParty http_accounting_log
syn keyword ngxDirectiveThirdParty http_accounting_id
syn keyword ngxDirectiveThirdParty http_accounting_interval
syn keyword ngxDirectiveThirdParty http_accounting_perturb
endif

View File

@ -0,0 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Nginx Digest Authentication module <https://github.com/atomx/nginx-http-auth-digest>
" Digest Authentication for Nginx
syn keyword ngxDirectiveThirdParty auth_digest
syn keyword ngxDirectiveThirdParty auth_digest_user_file
syn keyword ngxDirectiveThirdParty auth_digest_timeout
syn keyword ngxDirectiveThirdParty auth_digest_expires
syn keyword ngxDirectiveThirdParty auth_digest_replays
syn keyword ngxDirectiveThirdParty auth_digest_shm_size
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Auth PAM Module <https://github.com/sto/ngx_http_auth_pam_module>
" HTTP Basic Authentication using PAM.
syn keyword ngxDirectiveThirdParty auth_pam
syn keyword ngxDirectiveThirdParty auth_pam_service_name
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Auth Request Module <http://nginx.org/en/docs/http/ngx_http_auth_request_module.html>
" Implements client authorization based on the result of a subrequest
syn keyword ngxDirectiveThirdParty auth_request
syn keyword ngxDirectiveThirdParty auth_request_set
endif

View File

@ -0,0 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Concatenation module for Nginx <https://github.com/alibaba/nginx-http-concat>
" A Nginx module for concatenating files in a given context: CSS and JS files usually
syn keyword ngxDirectiveThirdParty concat
syn keyword ngxDirectiveThirdParty concat_types
syn keyword ngxDirectiveThirdParty concat_unique
syn keyword ngxDirectiveThirdParty concat_max_files
syn keyword ngxDirectiveThirdParty concat_delimiter
syn keyword ngxDirectiveThirdParty concat_ignore_file_error
endif

View File

@ -0,0 +1,12 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Dynamic Upstream Module <https://github.com/yzprofile/ngx_http_dyups_module>
" Update upstreams' config by restful interface
syn keyword ngxDirectiveThirdParty dyups_interface
syn keyword ngxDirectiveThirdParty dyups_read_msg_timeout
syn keyword ngxDirectiveThirdParty dyups_shm_zone_size
syn keyword ngxDirectiveThirdParty dyups_upstream_conf
syn keyword ngxDirectiveThirdParty dyups_trylock
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Footer If Filter Module <https://github.com/flygoast/ngx_http_footer_if_filter>
" The ngx_http_footer_if_filter_module is used to add given content to the end of the response according to the condition specified.
syn keyword ngxDirectiveThirdParty footer_if
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Footer Filter Module <https://github.com/alibaba/nginx-http-footer-filter>
" This module implements a body filter that adds a given string to the page footer.
syn keyword ngxDirectiveThirdParty footer
syn keyword ngxDirectiveThirdParty footer_types
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Internal Redirect Module <https://github.com/flygoast/ngx_http_internal_redirect>
" Make an internal redirect to the uri specified according to the condition specified.
syn keyword ngxDirectiveThirdParty internal_redirect_if
syn keyword ngxDirectiveThirdParty internal_redirect_if_no_postponed
endif

View File

@ -0,0 +1,15 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP JavaScript Module <https://github.com/peter-leonov/ngx_http_js_module>
" Embedding SpiderMonkey. Nearly full port on Perl module.
syn keyword ngxDirectiveThirdParty js
syn keyword ngxDirectiveThirdParty js_filter
syn keyword ngxDirectiveThirdParty js_filter_types
syn keyword ngxDirectiveThirdParty js_load
syn keyword ngxDirectiveThirdParty js_maxmem
syn keyword ngxDirectiveThirdParty js_require
syn keyword ngxDirectiveThirdParty js_set
syn keyword ngxDirectiveThirdParty js_utf8
endif

View File

@ -0,0 +1,12 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Push Module (DEPRECATED) <http://pushmodule.slact.net/>
" Turn Nginx into an adept long-polling HTTP Push (Comet) server.
syn keyword ngxDirectiveThirdParty push_buffer_size
syn keyword ngxDirectiveThirdParty push_listener
syn keyword ngxDirectiveThirdParty push_message_timeout
syn keyword ngxDirectiveThirdParty push_queue_messages
syn keyword ngxDirectiveThirdParty push_sender
endif

View File

@ -0,0 +1,14 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" HTTP Redis Module <https://www.nginx.com/resources/wiki/modules/redis/>
" Redis <http://code.google.com/p/redis/> support.>
syn keyword ngxDirectiveThirdParty redis_bind
syn keyword ngxDirectiveThirdParty redis_buffer_size
syn keyword ngxDirectiveThirdParty redis_connect_timeout
syn keyword ngxDirectiveThirdParty redis_next_upstream
syn keyword ngxDirectiveThirdParty redis_pass
syn keyword ngxDirectiveThirdParty redis_read_timeout
syn keyword ngxDirectiveThirdParty redis_send_timeout
endif

10
syntax/modules/iconv.vim Normal file
View File

@ -0,0 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Iconv Module <https://github.com/calio/iconv-nginx-module>
" A character conversion nginx module using libiconv
syn keyword ngxDirectiveThirdParty set_iconv
syn keyword ngxDirectiveThirdParty iconv_buffer_size
syn keyword ngxDirectiveThirdParty iconv_filter
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" IP Blocker Module <https://github.com/tmthrgd/nginx-ip-blocker>
" An efficient shared memory IP blocking system for nginx.
syn keyword ngxDirectiveThirdParty ip_blocker
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" IP2Location Module <https://github.com/chrislim2888/ip2location-nginx>
" Allows user to lookup for geolocation information using IP2Location database
syn keyword ngxDirectiveThirdParty ip2location_database
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Limit Upload Rate Module <https://github.com/cfsego/limit_upload_rate>
" Limit client-upload rate when they are sending request bodies to you
syn keyword ngxDirectiveThirdParty limit_upload_rate
syn keyword ngxDirectiveThirdParty limit_upload_rate_after
endif

View File

@ -0,0 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Limit Upstream Module <https://github.com/cfsego/nginx-limit-upstream>
" Limit the number of connections to upstream for NGINX
syn keyword ngxDirectiveThirdParty limit_upstream_zone
syn keyword ngxDirectiveThirdParty limit_upstream_conn
syn keyword ngxDirectiveThirdParty limit_upstream_log_level
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Log If Module <https://github.com/cfsego/ngx_log_if>
" Conditional accesslog for nginx
syn keyword ngxDirectiveThirdParty access_log_bypass_if
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Log Request Speed (DEPRECATED) <http://wiki.nginx.org/NginxHttpLogRequestSpeed>
" Log the time it took to process each request.
syn keyword ngxDirectiveThirdParty log_request_speed_filter
syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout
endif

View File

@ -0,0 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Log ZeroMQ Module <https://github.com/alticelabs/nginx-log-zmq>
" ZeroMQ logger module for nginx
syn keyword ngxDirectiveThirdParty log_zmq_server
syn keyword ngxDirectiveThirdParty log_zmq_endpoint
syn keyword ngxDirectiveThirdParty log_zmq_format
syn keyword ngxDirectiveThirdParty log_zmq_off
endif

View File

@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Lower/UpperCase Module <https://github.com/replay/ngx_http_lower_upper_case>
" This module simply uppercases or lowercases a string and saves it into a new variable.
syn keyword ngxDirectiveThirdParty lower
syn keyword ngxDirectiveThirdParty upper
endif

View File

@ -0,0 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Lua Upstream Module <https://github.com/openresty/lua-upstream-nginx-module>
" Nginx C module to expose Lua API to ngx_lua for Nginx upstreams
endif

66
syntax/modules/lua.vim Normal file
View File

@ -0,0 +1,66 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Lua Module <https://github.com/openresty/lua-nginx-module>
" Embed the Power of Lua into NGINX HTTP servers
syn keyword ngxDirectiveThirdParty lua_use_default_type
syn keyword ngxDirectiveThirdParty lua_code_cache
syn keyword ngxDirectiveThirdParty lua_regex_cache_max_entries
syn keyword ngxDirectiveThirdParty lua_regex_match_limit
syn keyword ngxDirectiveThirdParty lua_package_path
syn keyword ngxDirectiveThirdParty lua_package_cpath
syn keyword ngxDirectiveThirdParty init_by_lua
syn keyword ngxDirectiveThirdParty init_by_lua_block
syn keyword ngxDirectiveThirdParty init_by_lua_file
syn keyword ngxDirectiveThirdParty init_worker_by_lua
syn keyword ngxDirectiveThirdParty init_worker_by_lua_block
syn keyword ngxDirectiveThirdParty init_worker_by_lua_file
syn keyword ngxDirectiveThirdParty set_by_lua
syn keyword ngxDirectiveThirdParty set_by_lua_block
syn keyword ngxDirectiveThirdParty set_by_lua_file
syn keyword ngxDirectiveThirdParty content_by_lua
syn keyword ngxDirectiveThirdParty content_by_lua_block
syn keyword ngxDirectiveThirdParty content_by_lua_file
syn keyword ngxDirectiveThirdParty rewrite_by_lua
syn keyword ngxDirectiveThirdParty rewrite_by_lua_block
syn keyword ngxDirectiveThirdParty rewrite_by_lua_file
syn keyword ngxDirectiveThirdParty access_by_lua
syn keyword ngxDirectiveThirdParty access_by_lua_block
syn keyword ngxDirectiveThirdParty access_by_lua_file
syn keyword ngxDirectiveThirdParty header_filter_by_lua
syn keyword ngxDirectiveThirdParty header_filter_by_lua_block
syn keyword ngxDirectiveThirdParty header_filter_by_lua_file
syn keyword ngxDirectiveThirdParty body_filter_by_lua
syn keyword ngxDirectiveThirdParty body_filter_by_lua_block
syn keyword ngxDirectiveThirdParty body_filter_by_lua_file
syn keyword ngxDirectiveThirdParty log_by_lua
syn keyword ngxDirectiveThirdParty log_by_lua_block
syn keyword ngxDirectiveThirdParty log_by_lua_file
syn keyword ngxDirectiveThirdParty balancer_by_lua_block
syn keyword ngxDirectiveThirdParty balancer_by_lua_file
syn keyword ngxDirectiveThirdParty lua_need_request_body
syn keyword ngxDirectiveThirdParty ssl_certificate_by_lua_block
syn keyword ngxDirectiveThirdParty ssl_certificate_by_lua_file
syn keyword ngxDirectiveThirdParty lua_shared_dict
syn keyword ngxDirectiveThirdParty lua_socket_connect_timeout
syn keyword ngxDirectiveThirdParty lua_socket_send_timeout
syn keyword ngxDirectiveThirdParty lua_socket_send_lowat
syn keyword ngxDirectiveThirdParty lua_socket_read_timeout
syn keyword ngxDirectiveThirdParty lua_socket_buffer_size
syn keyword ngxDirectiveThirdParty lua_socket_pool_size
syn keyword ngxDirectiveThirdParty lua_socket_keepalive_timeout
syn keyword ngxDirectiveThirdParty lua_socket_log_errors
syn keyword ngxDirectiveThirdParty lua_ssl_ciphers
syn keyword ngxDirectiveThirdParty lua_ssl_crl
syn keyword ngxDirectiveThirdParty lua_ssl_protocols
syn keyword ngxDirectiveThirdParty lua_ssl_trusted_certificate
syn keyword ngxDirectiveThirdParty lua_ssl_verify_depth
syn keyword ngxDirectiveThirdParty lua_http10_buffering
syn keyword ngxDirectiveThirdParty rewrite_by_lua_no_postpone
syn keyword ngxDirectiveThirdParty access_by_lua_no_postpone
syn keyword ngxDirectiveThirdParty lua_transform_underscores_in_response_headers
syn keyword ngxDirectiveThirdParty lua_check_client_abort
syn keyword ngxDirectiveThirdParty lua_max_pending_timers
syn keyword ngxDirectiveThirdParty lua_max_running_timers
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" MD5 Filter Module <https://github.com/kainswor/nginx_md5_filter>
" A content filter for nginx, which returns the md5 hash of the content otherwise returned.
syn keyword ngxDirectiveThirdParty md5_filter
endif

17
syntax/modules/memc.vim Normal file
View File

@ -0,0 +1,17 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Memc Module <https://github.com/openresty/memc-nginx-module>
" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands.
syn keyword ngxDirectiveThirdParty memc_buffer_size
syn keyword ngxDirectiveThirdParty memc_cmds_allowed
syn keyword ngxDirectiveThirdParty memc_connect_timeout
syn keyword ngxDirectiveThirdParty memc_flags_to_last_modified
syn keyword ngxDirectiveThirdParty memc_next_upstream
syn keyword ngxDirectiveThirdParty memc_pass
syn keyword ngxDirectiveThirdParty memc_read_timeout
syn keyword ngxDirectiveThirdParty memc_send_timeout
syn keyword ngxDirectiveThirdParty memc_upstream_fail_timeout
syn keyword ngxDirectiveThirdParty memc_upstream_max_fails
endif

View File

@ -0,0 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Mod Security Module <https://github.com/SpiderLabs/ModSecurity>
" ModSecurity is an open source, cross platform web application firewall (WAF) engine
syn keyword ngxDirectiveThirdParty ModSecurityConfig
syn keyword ngxDirectiveThirdParty ModSecurityEnabled
syn keyword ngxDirectiveThirdParty pool_context
syn keyword ngxDirectiveThirdParty pool_context_hash_size
endif

View File

@ -0,0 +1,15 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Mogilefs Module <http://www.grid.net.ru/nginx/mogilefs.en.html>
" Implements a MogileFS client, provides a replace to the Perlbal reverse proxy of the original MogileFS.
syn keyword ngxDirectiveThirdParty mogilefs_connect_timeout
syn keyword ngxDirectiveThirdParty mogilefs_domain
syn keyword ngxDirectiveThirdParty mogilefs_methods
syn keyword ngxDirectiveThirdParty mogilefs_noverify
syn keyword ngxDirectiveThirdParty mogilefs_pass
syn keyword ngxDirectiveThirdParty mogilefs_read_timeout
syn keyword ngxDirectiveThirdParty mogilefs_send_timeout
syn keyword ngxDirectiveThirdParty mogilefs_tracker
endif

20
syntax/modules/mongo.vim Normal file
View File

@ -0,0 +1,20 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Mongo Module <https://github.com/simpl/ngx_mongo>
" Upstream module that allows nginx to communicate directly with MongoDB database.
syn keyword ngxDirectiveThirdParty mongo_auth
syn keyword ngxDirectiveThirdParty mongo_pass
syn keyword ngxDirectiveThirdParty mongo_query
syn keyword ngxDirectiveThirdParty mongo_json
syn keyword ngxDirectiveThirdParty mongo_bind
syn keyword ngxDirectiveThirdParty mongo_connect_timeout
syn keyword ngxDirectiveThirdParty mongo_send_timeout
syn keyword ngxDirectiveThirdParty mongo_read_timeout
syn keyword ngxDirectiveThirdParty mongo_buffering
syn keyword ngxDirectiveThirdParty mongo_buffer_size
syn keyword ngxDirectiveThirdParty mongo_buffers
syn keyword ngxDirectiveThirdParty mongo_busy_buffers_size
syn keyword ngxDirectiveThirdParty mongo_next_upstream
endif

View File

@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" MP4 Streaming Lite Module <https://www.nginx.com/resources/wiki/modules/mp4_streaming/>
" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL.
syn keyword ngxDirectiveThirdParty mp4
endif

Some files were not shown because too many files have changed in this diff Show More