From c69562f864cb0ee973142a45091f6cb46ce0b1df Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sun, 26 Jun 2016 18:03:28 +0200 Subject: [PATCH] Update --- README.md | 4 +- build | 2 +- compiler/go.vim | 6 +- ftdetect/polyglot.vim | 17 +++-- ftplugin/rust.vim | 36 +++++++++- ftplugin/tmux.vim | 5 ++ indent/blade.vim | 26 ++++++-- indent/go.vim | 80 +++++++++++----------- indent/gohtmltmpl.vim | 2 + indent/javascript.vim | 151 +++++++++++++++++++++--------------------- indent/proto.vim | 21 ++++++ syntax/go.vim | 58 ++++++++-------- syntax/godefstack.vim | 4 +- syntax/gohtmltmpl.vim | 6 +- syntax/gotexttmpl.vim | 4 +- syntax/javascript.vim | 145 +++++++++++++++++++--------------------- syntax/ruby.vim | 4 +- syntax/tmux.vim | 138 ++++++++++++++++++++++---------------- syntax/vimgo.vim | 4 +- 19 files changed, 405 insertions(+), 308 deletions(-) create mode 100644 ftplugin/tmux.vim create mode 100644 indent/proto.vim diff --git a/README.md b/README.md index c7d7cf9..774c65d 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo - [php](https://github.com/StanAngeloff/php.vim) (syntax) - [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, ftplugin, ftdetect) - [powershell](https://github.com/Persistent13/vim-ps1) (syntax, indent, ftplugin, ftdetect) -- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, ftdetect) +- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent, ftdetect) - [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin, ftdetect) - [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin, ftdetect) - [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftdetect) @@ -99,7 +99,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo - [systemd](https://github.com/kurayama/systemd-vim-syntax) (syntax, ftdetect) - [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect) - [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect) -- [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect) +- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin, ftdetect) - [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax) - [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect) - [twig](https://github.com/evidens/vim-twig) (syntax, ftplugin) diff --git a/build b/build index 49bf8c7..e590328 100755 --- a/build +++ b/build @@ -170,7 +170,7 @@ PACKS=" systemd:kurayama/systemd-vim-syntax textile:timcharper/textile.vim thrift:solarnz/thrift.vim - tmux:tejr/vim-tmux + tmux:keith/tmux.vim tomdoc:wellbredgrapefruit/tomdoc.vim toml:cespare/vim-toml twig:evidens/vim-twig diff --git a/compiler/go.vim b/compiler/go.vim index 59fca65..5c30dd2 100644 --- a/compiler/go.vim +++ b/compiler/go.vim @@ -18,9 +18,9 @@ endif let s:save_cpo = &cpo set cpo-=C if filereadable("makefile") || filereadable("Makefile") - CompilerSet makeprg=make + CompilerSet makeprg=make else - CompilerSet makeprg=go\ build + CompilerSet makeprg=go\ build endif " Define the patterns that will be recognized by QuickFix when parsing the @@ -40,6 +40,6 @@ CompilerSet errorformat+=%-G%.%# " All lines not matching a let &cpo = s:save_cpo unlet s:save_cpo -" vim:ts=4:sw=4:et +" vim: sw=2 ts=2 et endif diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index abadf07..4659caa 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -157,14 +157,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1 let s:current_fileformats = '' let s:current_fileencodings = '' function! s:gofiletype_pre(type) - let s:current_fileformats = &g:fileformats - let s:current_fileencodings = &g:fileencodings - set fileencodings=utf-8 fileformats=unix - let &l:filetype = a:type + let s:current_fileformats = &g:fileformats + let s:current_fileencodings = &g:fileencodings + set fileencodings=utf-8 fileformats=unix + let &l:filetype = a:type endfunction function! s:gofiletype_post() - let &g:fileformats = s:current_fileformats - let &g:fileencodings = s:current_fileencodings + let &g:fileformats = s:current_fileformats + let &g:fileencodings = s:current_fileencodings endfunction au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix au BufRead *.go call s:gofiletype_pre("go") @@ -436,7 +436,7 @@ au BufNewFile,BufRead .pryrc call s:setf('ruby') au BufNewFile,BufRead Puppetfile call s:setf('ruby') au BufNewFile,BufRead *.rabl call s:setf('ruby') au BufNewFile,BufRead [rR]outefile call s:setf('ruby') -au BufNewFile,BufRead .simplecov call s:setf('ruby) +au BufNewFile,BufRead .simplecov call s:setf('ruby') au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby') au BufNewFile,BufRead [vV]agrantfile call s:setf('ruby') endif @@ -507,8 +507,7 @@ au BufNewFile,BufRead *.thrift setlocal filetype=thrift endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1 -autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux -autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal commentstring=#\ %s +autocmd BufNewFile,BufRead {.,}tmux*.conf* setfiletype tmux endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1 diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index e7c604e..2023656 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " Description: Vim syntax file for Rust " Maintainer: Chris Morgan " Maintainer: Kevin Ballard -" Last Change: January 29, 2015 +" Last Change: June 08, 2016 if exists("b:did_ftplugin") finish @@ -14,6 +14,9 @@ let b:did_ftplugin = 1 let s:save_cpo = &cpo set cpo&vim +augroup rust.vim +autocmd! + " Variables {{{1 " The rust source code at present seems to typically omit a leader on /*! @@ -56,7 +59,33 @@ if exists("g:loaded_delimitMate") if exists("b:delimitMate_excluded_regions") let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions endif - let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate' + + let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' + + " For this buffer, when delimitMate issues the `User delimitMate_map` + " event in the autocommand system, add the above-defined extra excluded + " regions to delimitMate's state, if they have not already been added. + autocmd User + \ if expand('') ==# 'delimitMate_map' && match( + \ delimitMate#Get("excluded_regions"), + \ s:delimitMate_extra_excluded_regions) == -1 + \| let b:delimitMate_excluded_regions = + \ delimitMate#Get("excluded_regions") + \ . s:delimitMate_extra_excluded_regions + \|endif + + " For this buffer, when delimitMate issues the `User delimitMate_unmap` + " event in the autocommand system, delete the above-defined extra excluded + " regions from delimitMate's state (the deletion being idempotent and + " having no effect if the extra excluded regions are not present in the + " targeted part of delimitMate's state). + autocmd User + \ if expand('') ==# 'delimitMate_unmap' + \| let b:delimitMate_excluded_regions = substitute( + \ delimitMate#Get("excluded_regions"), + \ '\C\V' . s:delimitMate_extra_excluded_regions, + \ '', 'g') + \|endif endif if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 @@ -161,10 +190,13 @@ let b:undo_ftplugin = " \|ounmap ]] \|set matchpairs-=<:> \|unlet b:match_skip + \|augroup! rust.vim \" " }}}1 +augroup END + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/ftplugin/tmux.vim b/ftplugin/tmux.vim new file mode 100644 index 0000000..fa2ae58 --- /dev/null +++ b/ftplugin/tmux.vim @@ -0,0 +1,5 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1 + +setlocal commentstring=#\ %s + +endif diff --git a/indent/blade.vim b/indent/blade.vim index 4c89ed6..e5bf510 100644 --- a/indent/blade.vim +++ b/indent/blade.vim @@ -7,13 +7,20 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1 if exists("b:did_indent") finish endif + runtime! indent/html.vim +let s:htmlindent = &indentexpr unlet! b:did_indent + +runtime! indent/php.vim +let s:phpindent = &indentexpr +unlet! b:did_indent + let b:did_indent = 1 setlocal autoindent setlocal indentexpr=GetBladeIndent() -setlocal indentkeys=o,O,*,<>>,!^F,=@else,=@end,=@empty,=@show +setlocal indentkeys=o,O,*,<>>,!^F,=@else,=@end,=@empty,=@show,=@stop " Only define the function once. if exists("*GetBladeIndent") @@ -30,13 +37,19 @@ function! GetBladeIndent() let cline = substitute(substitute(getline(v:lnum), '\s\+$', '', ''), '^\s\+', '', '') let indent = indent(lnum) let cindent = indent(v:lnum) - if cline =~# '@\%(else\|elseif\|empty\|end\|show\)' + if cline =~# '@\%(else\|elseif\|empty\|end\|show\|stop\)' || + \ cline =~# '\%(\|\%({{.*\)\@', 'bWr') + execute 'let hindent = ' . s:phpindent else - let hindent = HtmlIndent() + execute 'let hindent = ' . s:htmlindent endif if hindent > -1 let indent = hindent @@ -47,10 +60,13 @@ function! GetBladeIndent() let indent = cindent <= indent ? -1 : increase endif - if line =~# '@\%(section\)\%(.*\s*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)' + if line =~# '@\%(section\)\%(.*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)' return indent - elseif line =~# '@\%(if\|elseif\|else\|unless\|foreach\|forelse\|for\|while\|empty\|push\|section\|can\)\%(.*\s*@end\)\@!' + elseif line =~# '@\%(if\|elseif\|else\|unless\|foreach\|forelse\|for\|while\|empty\|push\|section\|can\|hasSection\)\%(.*@end\|.*@stop\)\@!' || + \ line =~# '{{\%(.*}}\)\@!' || line =~# '{!!\%(.*!!}\)\@!' return increase + elseif line =~# '\)\@!' + return indent(lnum-1) == -1 ? increase : indent(lnum) + increase else return indent endif diff --git a/indent/go.vim b/indent/go.vim index 102d349..fd973e4 100644 --- a/indent/go.vim +++ b/indent/go.vim @@ -11,7 +11,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1 " - general line splits (line ends in an operator) if exists("b:did_indent") - finish + finish endif let b:did_indent = 1 @@ -23,60 +23,60 @@ setlocal indentexpr=GoIndent(v:lnum) setlocal indentkeys+=<:>,0=},0=) if exists("*GoIndent") - finish + finish endif " use shiftwidth function only if it's available if exists('*shiftwidth') - func s:sw() - return shiftwidth() - endfunc + func s:sw() + return shiftwidth() + endfunc else - func s:sw() - return &sw - endfunc + func s:sw() + return &sw + endfunc endif function! GoIndent(lnum) - let prevlnum = prevnonblank(a:lnum-1) - if prevlnum == 0 - " top of file - return 0 - endif + let prevlnum = prevnonblank(a:lnum-1) + if prevlnum == 0 + " top of file + return 0 + endif - " grab the previous and current line, stripping comments. - let prevl = substitute(getline(prevlnum), '//.*$', '', '') - let thisl = substitute(getline(a:lnum), '//.*$', '', '') - let previ = indent(prevlnum) + " grab the previous and current line, stripping comments. + let prevl = substitute(getline(prevlnum), '//.*$', '', '') + let thisl = substitute(getline(a:lnum), '//.*$', '', '') + let previ = indent(prevlnum) - let ind = previ + let ind = previ - if prevl =~ '[({]\s*$' - " previous line opened a block - let ind += s:sw() - endif - if prevl =~# '^\s*\(case .*\|default\):$' - " previous line is part of a switch statement - let ind += s:sw() - endif - " TODO: handle if the previous line is a label. + if prevl =~ '[({]\s*$' + " previous line opened a block + let ind += s:sw() + endif + if prevl =~# '^\s*\(case .*\|default\):$' + " previous line is part of a switch statement + let ind += s:sw() + endif + " TODO: handle if the previous line is a label. - if thisl =~ '^\s*[)}]' - " this line closed a block - let ind -= s:sw() - endif + if thisl =~ '^\s*[)}]' + " this line closed a block + let ind -= s:sw() + endif - " Colons are tricky. - " We want to outdent if it's part of a switch ("case foo:" or "default:"). - " We ignore trying to deal with jump labels because (a) they're rare, and - " (b) they're hard to disambiguate from a composite literal key. - if thisl =~# '^\s*\(case .*\|default\):$' - let ind -= s:sw() - endif + " Colons are tricky. + " We want to outdent if it's part of a switch ("case foo:" or "default:"). + " We ignore trying to deal with jump labels because (a) they're rare, and + " (b) they're hard to disambiguate from a composite literal key. + if thisl =~# '^\s*\(case .*\|default\):$' + let ind -= s:sw() + endif - return ind + return ind endfunction -" vim:ts=4:sw=4:et +" vim: sw=2 ts=2 et endif diff --git a/indent/gohtmltmpl.vim b/indent/gohtmltmpl.vim index e170855..898e36b 100644 --- a/indent/gohtmltmpl.vim +++ b/indent/gohtmltmpl.vim @@ -45,4 +45,6 @@ function! GetGoHTMLTmplIndent(lnum) return ind endfunction +" vim: sw=2 ts=2 et + endif diff --git a/indent/javascript.vim b/indent/javascript.vim index 24f394c..99ad0d4 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -19,7 +19,7 @@ setlocal nosmartindent setlocal indentexpr=GetJavascriptIndent() setlocal formatexpr=Fixedgq(v:lnum,v:count) setlocal indentkeys=0{,0},0),0],0\,*,:,!^F,o,O,e -setlocal cinoptions+=j1,J1 +setlocal cinoptions+=j1,J1,c1 " Only define the function once. if exists("*GetJavascriptIndent") @@ -45,7 +45,7 @@ endif let s:line_pre = '^\s*\%(\/\*.*\*\/\s*\)*' let s:js_keywords = s:line_pre . '\%(break\|import\|export\|catch\|const\|continue\|debugger\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|let\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)\>\C' -let s:expr_case = s:line_pre . '\%(case\s\+[^\:]*\|default\)\s*:\s*\C' +let s:expr_case = s:line_pre . '\%(\%(case\>.*\)\|default\)\s*:\C' " Regex of syntax group names that are or delimit string or are comments. let s:syng_strcom = '\%(string\|regex\|special\|doc\|comment\|template\)\c' @@ -79,7 +79,7 @@ function s:Onescope(lnum) end let mypos = col('.') call cursor(a:lnum, 1) - if search('\<\%(while\|for\|if\)\>\s*(\C', 'ce', a:lnum) > 0 && + if search('.*\zs\<\%(while\|for\|if\)\>\s*(\C', 'ce', a:lnum) > 0 && \ s:lookForParens('(', ')', 'W', a:lnum) > 0 && \ col('.') == strlen(s:RemoveTrailingComments(getline(a:lnum))) call cursor(a:lnum, mypos) @@ -142,7 +142,7 @@ function s:GetMSL(lnum, in_one_line_scope) " Start on the line we're at and use its indent. let msl = a:lnum let lnum = s:PrevNonBlankNonString(a:lnum - 1) - while lnum > 0 + while lnum > 0 && !s:Match(msl,s:line_pre . '[])}]') " If we have a continuation line, or we're in a string, use line as MSL. " Otherwise, terminate search as we have found our MSL already. let line = getline(lnum) @@ -314,6 +314,7 @@ function GetJavascriptIndent() " 3.1. Setup {{{1 " ---------- " Set up variables for restoring position in file. Could use v:lnum here. + " Avoid use of line('.')/col('.') type functions as the curpos can change let vcol = col('.') " 3.2. Work on the current line {{{1 @@ -336,21 +337,25 @@ function GetJavascriptIndent() if line !~ '^\%(\/\*\|\s*\/\/\)' && s:IsInComment(v:lnum, 1) return cindent(v:lnum) endif - + " single opening bracket will assume you want a c style of indenting - if s:Match(v:lnum, s:line_pre . '{' . s:line_term) && !s:Match(lnum,s:block_regex) && + if line =~ s:line_pre . '{' && !s:Match(lnum,s:block_regex) && \ !s:Match(lnum,s:comma_last) return cindent(v:lnum) endif " cindent each line which has a switch label if (line =~ s:expr_case) - return cindent(v:lnum) + let s:cpo_switch = &cpo + set cpo+=% + let ind = cindent(v:lnum) + let &cpo = s:cpo_switch + return ind endif " If we got a closing bracket on an empty line, find its match and indent " according to it. - let col = s:Match(v:lnum, s:line_pre . '[]})]') + let col = line =~ s:line_pre . '[]})]' if col > 0 let parlnum = v:lnum while col @@ -361,8 +366,8 @@ function GetJavascriptIndent() continue end if parlnum > 0 - let ind = s:InMultiVarStatement(parlnum, 0, 0)|| s:LineHasOpeningBrackets(parlnum) !~ '2' - \ ? indent(parlnum) : indent(s:GetMSL(parlnum, 0)) + let ind = s:InMultiVarStatement(parlnum, 0, 0)|| s:LineHasOpeningBrackets(parlnum) !~ '2' ? + \ indent(parlnum) : indent(s:GetMSL(parlnum, 0)) endif endwhile return ind @@ -371,7 +376,8 @@ function GetJavascriptIndent() " If line starts with an operator... if (line =~ s:operator_first) - if (s:Match(lnum, s:operator_first) || s:Match(lnum, s:line_pre . '[])}]')) + if (s:Match(lnum, s:operator_first) || (s:Match(lnum, s:line_pre . '[])}]') && + \ !(s:Match(v:lnum,s:line_pre . '\.') && s:Match(lnum, ')' . s:line_term)))) " and so does previous line, don't indent return indent(lnum) end @@ -391,13 +397,15 @@ function GetJavascriptIndent() end " If previous line starts with an operator... - elseif (s:Match(lnum, s:operator_first) && !s:Match(lnum,s:continuation_regex))||getline(lnum) =~ ');\=' . s:line_term + elseif (s:Match(lnum, s:operator_first) && !s:Match(lnum,s:continuation_regex)) || + \ getline(lnum) =~ '[]})];\=' . s:line_term let counts = s:LineHasOpeningBrackets(lnum) - if counts[0] == '2' && !s:Match(lnum, s:operator_first) + if counts =~ '2' && !s:Match(lnum, s:operator_first) call cursor(lnum, 1) " Search for the opening tag - let mnum = s:lookForParens('(', ')', 'nbW', 0) - if mnum > 0 && s:Match(mnum, s:operator_first) + let mnum = s:lookForParens('(\|{\|\[', ')\|}\|\]', 'nbW', 0) + if mnum > 0 && (s:Match(mnum, s:operator_first) || + \ (s:Onescope(s:PrevNonBlankNonString(mnum - 1))) && !s:Match(mnum, s:line_pre . '{')) return indent(mnum) - s:sw() end elseif s:Match(lnum, s:operator_first) @@ -413,7 +421,7 @@ function GetJavascriptIndent() " If the line is empty and the previous nonblank line was a multi-line " comment, use that comment's indent. Deduct one char to account for the " space in ' */'. - if line =~ '^\s*$' && getline(prevline) !~ '\%(\%(^\s*\/\/\|\/\*\).*\)\@ 1 - while l:count > 1 - let l:count -= 1 - normal J - endwhile - endif + " Put all the lines on one line and do normal spliting after that + if l:count > 1 + while l:count > 1 + let l:count -= 1 + normal J + endwhile + endif - let l:winview = winsaveview() + let l:winview = winsaveview() + call cursor(a:lnum, l:tw + 1) + let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum) + call cursor(a:lnum, l:tw + 1) + let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum) + + " No need for special treatment, normal gq handles edgecases better + if breakpoint[1] == orig_breakpoint[1] + call winrestview(l:winview) + return 1 + endif + + " Try breaking after string + if breakpoint[1] <= indent(a:lnum) call cursor(a:lnum, l:tw + 1) - let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum) - call cursor(a:lnum, l:tw + 1) - let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum) - - " No need for special treatment, normal gq handles edgecases better - if breakpoint[1] == orig_breakpoint[1] - call winrestview(l:winview) - return 1 - endif - - " Try breaking after string - if breakpoint[1] <= indent(a:lnum) - call cursor(a:lnum, l:tw + 1) - let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum) - endif + let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum) + endif - if breakpoint[1] != 0 - call feedkeys("r\") - else - let l:count = l:count - 1 - endif + if breakpoint[1] != 0 + call feedkeys("r\") + else + let l:count = l:count - 1 + endif - " run gq on new lines - if l:count == 1 - call feedkeys("gqq") - endif + " run gq on new lines + if l:count == 1 + call feedkeys("gqq") + endif - return 0 + return 0 endfunction "}}} " vim: foldmethod=marker:foldlevel=1 diff --git a/indent/proto.vim b/indent/proto.vim new file mode 100644 index 0000000..bf558e7 --- /dev/null +++ b/indent/proto.vim @@ -0,0 +1,21 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'protobuf') == -1 + +" Vim indent file +" Language: Protobuf +" Maintainer: Johannes Zellner +" Last Change: Fri, 15 Mar 2002 07:53:54 CET + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" Protobuf is like indenting C +setlocal cindent +setlocal expandtab +setlocal shiftwidth=2 + +let b:undo_indent = "setl cin<" + +endif diff --git a/syntax/go.vim b/syntax/go.vim index 8fb5d13..0a49059 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -70,7 +70,7 @@ if !exists("g:go_highlight_methods") endif if !exists("g:go_highlight_fields") - let g:go_highlight_fields = 0 + let g:go_highlight_fields = 0 endif if !exists("g:go_highlight_structs") @@ -338,35 +338,35 @@ hi def link goInterfaceDef Function " Build Constraints if g:go_highlight_build_constraints != 0 - syn match goBuildKeyword display contained "+build" - " Highlight the known values of GOOS, GOARCH, and other +build options. - syn keyword goBuildDirectives contained - \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 - \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 - \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc - \ s390 s390x sparc sparc64 cgo ignore race + syn match goBuildKeyword display contained "+build" + " Highlight the known values of GOOS, GOARCH, and other +build options. + syn keyword goBuildDirectives contained + \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 + \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 + \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc + \ s390 s390x sparc sparc64 cgo ignore race - " Other words in the build directive are build tags not listed above, so - " avoid highlighting them as comments by using a matchgroup just for the - " start of the comment. - " The rs=s+2 option lets the \s*+build portion be part of the inner region - " instead of the matchgroup so it will be highlighted as a goBuildKeyword. - syn region goBuildComment matchgroup=goBuildCommentStart - \ start="//\s*+build\s"rs=s+2 end="$" - \ contains=goBuildKeyword,goBuildDirectives - hi def link goBuildCommentStart Comment - hi def link goBuildDirectives Type - hi def link goBuildKeyword PreProc + " Other words in the build directive are build tags not listed above, so + " avoid highlighting them as comments by using a matchgroup just for the + " start of the comment. + " The rs=s+2 option lets the \s*+build portion be part of the inner region + " instead of the matchgroup so it will be highlighted as a goBuildKeyword. + syn region goBuildComment matchgroup=goBuildCommentStart + \ start="//\s*+build\s"rs=s+2 end="$" + \ contains=goBuildKeyword,goBuildDirectives + hi def link goBuildCommentStart Comment + hi def link goBuildDirectives Type + hi def link goBuildKeyword PreProc - " One or more line comments that are followed immediately by a "package" - " declaration are treated like package documentation, so these must be - " matched as comments to avoid looking like working build constraints. - " The he, me, and re options let the "package" itself be highlighted by - " the usual rules. - syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/ - \ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7 - \ contains=@goCommentGroup,@Spell - hi def link goPackageComment Comment + " One or more line comments that are followed immediately by a "package" + " declaration are treated like package documentation, so these must be + " matched as comments to avoid looking like working build constraints. + " The he, me, and re options let the "package" itself be highlighted by + " the usual rules. + syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/ + \ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7 + \ contains=@goCommentGroup,@Spell + hi def link goPackageComment Comment endif @@ -379,4 +379,6 @@ syn sync minlines=500 let b:current_syntax = "go" +" vim: sw=2 ts=2 et + endif diff --git a/syntax/godefstack.vim b/syntax/godefstack.vim index 7093652..0fad956 100644 --- a/syntax/godefstack.vim +++ b/syntax/godefstack.vim @@ -1,7 +1,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1 if exists("b:current_syntax") - finish + finish endif syn match godefStackComment '^".*' @@ -19,4 +19,6 @@ hi def link godefStackCurrentPosition Special hi def link godefStackFilename Directory hi def link godefStackEntryLocationNumber LineNr +" vim: sw=2 ts=2 et + endif diff --git a/syntax/gohtmltmpl.vim b/syntax/gohtmltmpl.vim index b5e3ff7..00432a0 100644 --- a/syntax/gohtmltmpl.vim +++ b/syntax/gohtmltmpl.vim @@ -1,11 +1,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1 if exists("b:current_syntax") - finish + finish endif if !exists("main_syntax") - let main_syntax = 'html' + let main_syntax = 'html' endif runtime! syntax/gotexttmpl.vim @@ -14,6 +14,6 @@ unlet b:current_syntax let b:current_syntax = "gohtmltmpl" -" vim:ts=4:sw=4:et +" vim: sw=2 ts=2 et endif diff --git a/syntax/gotexttmpl.vim b/syntax/gotexttmpl.vim index 1e73398..0b8987c 100644 --- a/syntax/gotexttmpl.vim +++ b/syntax/gotexttmpl.vim @@ -8,7 +8,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") - finish + finish endif syn case match @@ -84,6 +84,6 @@ hi def link goTplComment Comment let b:current_syntax = "gotexttmpl" -" vim:ts=4:sw=4:et +" vim: sw=2 ts=2 et endif diff --git a/syntax/javascript.vim b/syntax/javascript.vim index d413632..6bbeab9 100644 --- a/syntax/javascript.vim +++ b/syntax/javascript.vim @@ -26,29 +26,28 @@ syntax sync fromstart " syntax case ignore syntax case match -syntax match jsNoise /[:,\;\.]\{1}/ -syntax match jsFuncCall /\k\+\%(\s*(\)\@=/ -syntax match jsParensError /\%()\|}\|\]\)/ +syntax match jsNoise /[:,\;\.]\{1}/ +syntax match jsFuncCall /\k\+\%(\s*(\)\@=/ +syntax match jsParensError /[)}\]]/ " Program Keywords -syntax keyword jsStorageClass const var let +syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray syntax keyword jsOperator delete instanceof typeof void new in of syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/ -syntax match jsSpreadOperator /\.\.\./ skipwhite skipempty nextgroup=@jsExpression syntax keyword jsBooleanTrue true syntax keyword jsBooleanFalse false " Modules syntax keyword jsModuleKeywords contained import -syntax keyword jsModuleKeywords contained export skipwhite skipempty nextgroup=@jsExpression +syntax keyword jsModuleKeywords contained export skipwhite skipempty nextgroup=jsExportBlock,jsModuleDefault syntax keyword jsModuleOperators contained from syntax keyword jsModuleOperators contained as -syntax region jsModuleGroup contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise +syntax region jsModuleGroup contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise,jsComment syntax match jsModuleAsterisk contained /*/ -syntax keyword jsModuleDefault contained default skipwhite skipempty nextgroup=@jsExpression -syntax region jsImportContainer start=/\ / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsComment,jsString,jsTemplateString,jsNoise,jsModuleGroup,jsModuleAsterisk -syntax match jsExportContainer /\ / contains=jsModuleKeywords skipwhite skipempty nextgroup=jsExportBlock,jsModuleDefault -syntax region jsExportBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise +syntax keyword jsModuleDefault contained default skipwhite kipempty nextgroup=@jsExpression +syntax region jsImportContainer start=/\ / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsComment,jsString,jsTemplateString,jsNoise,jsModuleGroup,jsModuleAsterisk +syntax region jsExportContainer start=/\ / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsStorageClass,jsModuleDefault,@jsExpression +syntax region jsExportBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise,jsComment " Strings, Templates, Numbers syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend @@ -76,7 +75,7 @@ else endif syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod -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,jsFlowParenRegion 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 @@ -84,7 +83,7 @@ syntax match jsObjectSeparator contained /,/ syntax region jsObjectValue contained start=/:/ end=/\%(,\|}\)\@=/ contains=@jsExpression extend 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 jsObjectGetSet contained /\%(get\|set\|static\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName +syntax match jsObjectMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName syntax region jsObjectStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue syntax region jsObjectStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue @@ -108,6 +107,7 @@ syntax keyword jsFinally contained finally skipwhite skipempty nextgro syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch syntax keyword jsException throw syntax keyword jsAsyncKeyword async await +syntax match jsSwitchColon contained /:/ skipwhite skipempty nextgroup=jsBlock " 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 @@ -131,27 +131,30 @@ syntax keyword jsDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECT syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize "" Code blocks -syntax region jsBracket matchgroup=jsBrackets start="\[" end="\]" contains=@jsExpression 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=jsBlock extend fold -syntax region jsParenRepeat contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsBlock extend fold -syntax region jsParenSwitch contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold -syntax region jsParenCatch contained matchgroup=jsParens start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold -syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodDefinitions,jsOperator,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 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 jsSwitchBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll,jsLabel extend fold -syntax region jsObject matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectGetSet,jsGenerator,jsComment,jsSpreadOperator,jsObjectStringKey extend fold -syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression +syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression 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=jsBlock extend fold +syntax region jsParenRepeat contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsBlock extend fold +syntax region jsParenSwitch contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold +syntax region jsParenCatch contained matchgroup=jsParens start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold +syntax region jsFuncArgs contained matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsRestExpression,jsFlow skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend fold +syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodType,jsOperator,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsNoise,jsFlowClassProperty extend fold +syntax region jsFuncBlock contained matchgroup=jsFuncBraces 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 jsSwitchBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll,jsLabel,jsSwitchColon 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 jsObject matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression extend fold +syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression +syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression +syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/ +syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup=jsFuncArgs -syntax match jsFuncArgDestructuring contained /\({\|}\|=\|:\|\[\|\]\)/ extend -syntax region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest,jsComment,jsString,jsNumber,jsFuncArgDestructuring,jsArrowFunction,jsParen,jsArrowFuncArgs skipwhite skipempty nextgroup=jsFuncBlock extend +syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend syntax match jsFuncArgCommas contained ',' -syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ contains=jsFuncArgRestDots -syntax match jsFuncArgRestDots contained /\.\.\./ syntax keyword jsArguments contained arguments " Matches a single keyword argument with no parens @@ -164,8 +167,8 @@ exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFunc syntax keyword jsClassKeywords contained extends class syntax match jsClassNoise contained /\./ -syntax match jsClassMethodDefinitions contained /\%(get\|set\|static\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsFuncName,jsClassProperty -syntax match jsClassDefinition /\\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise skipwhite skipempty nextgroup=jsClassBlock +syntax match jsClassMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsFuncName,jsClassProperty +syntax match jsClassDefinition /\\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise skipwhite skipempty nextgroup=jsClassBlock,jsFlowClass 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 @@ -175,41 +178,34 @@ syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\ syntax region jsClassStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs syntax region jsClassStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs +" Destructuring +syntax match jsDestructuringPropertyValue contained /\<[0-9a-zA-Z_$]*\>/ +syntax match jsDestructuringProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValue +syntax match jsDestructuringAssignment contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment +syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend +syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend +syntax match jsDestructuringNoise contained /[,\[\]]/ +syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold + " Comments syntax keyword jsCommentTodo contained TODO FIXME XXX TBD -syntax region jsComment start=+\/\/+ end=+$+ contains=jsCommentTodo,@Spell extend keepend -syntax region jsComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ contains=jsCommentTodo,@Spell fold extend keepend -syntax region jsComment start="/\*" end="\*/" contains=jsCommentTodo,jsCvsTag,@Spell fold extend keepend -syntax region jsEnvComment start="\%^#!" end="$" display -syntax region jsCvsTag contained start="\$\cid:" end="\$" oneline +syntax region jsComment start=/\/\// end=/$/ contains=jsCommentTodo,@Spell extend keepend +syntax region jsComment start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell fold extend keepend +syntax region jsEnvComment start=/\%^#!/ end=/$/ display -"" JSDoc / JSDoc Toolkit -if !exists("javascript_ignore_javaScriptdoc") - "" syntax coloring for javadoc comments (HTML) - syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold +if exists("javascript_plugin_jsdoc") + runtime extras/jsdoc.vim + " NGDoc requires JSDoc + if exists("javascript_plugin_ngdoc") + runtime extras/ngdoc.vim + endif +endif - " tags containing a param - syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam - " tags containing type and param - syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType - " tags containing type but no param - syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam - " tags containing references - syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag - " other tags (no extra syntax) - syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>" +if exists("javascript_plugin_flow") + runtime extras/flow.vim +endif - syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam - syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam - 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 match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" - syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+" - syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags -endif "" JSDoc end - -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,jsSpreadOperator +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 syntax cluster jsAll contains=@jsExpression,jsExportContainer,jsImportContainer,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsStatement,jsException,jsTry,jsAsyncKeyword " Define the default highlighting. @@ -222,18 +218,9 @@ if version >= 508 || !exists("did_javascript_syn_inits") else command -nargs=+ HiLink hi def link endif - HiLink jsFuncArgRest Special HiLink jsComment Comment HiLink jsEnvComment PreProc HiLink jsCommentTodo Todo - HiLink jsCvsTag Function - HiLink jsDocTags Special - HiLink jsDocSeeTag Function - HiLink jsDocType Type - HiLink jsDocTypeBrackets jsDocType - HiLink jsDocTypeRecord jsDocType - HiLink jsDocTypeNoParam Type - HiLink jsDocParam Label HiLink jsString String HiLink jsObjectKeyString String HiLink jsTemplateString String @@ -306,11 +293,20 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsModuleDefault Include HiLink jsDecorator Special HiLink jsDecoratorFunction Special - HiLink jsFuncArgRestDots Noise - HiLink jsFuncArgDestructuring Noise + HiLink jsFuncArgOperator jsFuncArgs HiLink jsModuleAsterisk Noise HiLink jsClassProperty jsObjectKey HiLink jsSpreadOperator Operator + HiLink jsRestOperator Operator + HiLink jsRestExpression jsFuncArgs + HiLink jsSwitchColon Noise + HiLink jsClassMethodType Type + HiLink jsObjectMethodType Type + + HiLink jsDestructuringBraces Noise + HiLink jsDestructuringProperty jsFuncArgs + HiLink jsDestructuringAssignment jsObjectKey + HiLink jsDestructuringNoise Noise HiLink jsDomErrNo Constant HiLink jsDomNodeConsts Constant @@ -323,9 +319,6 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsCssStyles Label - HiLink jsClassMethodDefinitions Type - HiLink jsObjectGetSet Type - delcommand HiLink endif diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 0f23fc1..63ac6b4 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -458,9 +458,9 @@ syn match rubyKeywordAsMethod "\%(\%(\.\@1