diff options
| -rw-r--r-- | README.md | 4 | ||||
| -rwxr-xr-x | build | 2 | ||||
| -rw-r--r-- | compiler/go.vim | 6 | ||||
| -rw-r--r-- | ftdetect/polyglot.vim | 17 | ||||
| -rw-r--r-- | ftplugin/rust.vim | 36 | ||||
| -rw-r--r-- | ftplugin/tmux.vim | 5 | ||||
| -rw-r--r-- | indent/blade.vim | 26 | ||||
| -rw-r--r-- | indent/go.vim | 80 | ||||
| -rw-r--r-- | indent/gohtmltmpl.vim | 2 | ||||
| -rw-r--r-- | indent/javascript.vim | 149 | ||||
| -rw-r--r-- | indent/proto.vim | 21 | ||||
| -rw-r--r-- | syntax/go.vim | 62 | ||||
| -rw-r--r-- | syntax/godefstack.vim | 4 | ||||
| -rw-r--r-- | syntax/gohtmltmpl.vim | 6 | ||||
| -rw-r--r-- | syntax/gotexttmpl.vim | 4 | ||||
| -rw-r--r-- | syntax/javascript.vim | 151 | ||||
| -rw-r--r-- | syntax/ruby.vim | 4 | ||||
| -rw-r--r-- | syntax/tmux.vim | 138 | ||||
| -rw-r--r-- | syntax/vimgo.vim | 4 | 
19 files changed, 409 insertions, 312 deletions
| @@ -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) @@ -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 59fca658..5c30dd2f 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 abadf073..4659caaf 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 e7c604ec..2023656e 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 <me@chrismorgan.info>  " Maintainer:   Kevin Ballard <kevin@sb.org> -" 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 <buffer> +		\ if expand('<afile>') ==# '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 <buffer> +		\ if expand('<afile>') ==# '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 <buffer> ]]  		\|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 00000000..fa2ae587 --- /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 4c89ed61..e5bf510c 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,*<Return>,<>>,!^F,=@else,=@end,=@empty,=@show +setlocal indentkeys=o,O,*<Return>,<>>,!^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 =~# '\%(<?.*\)\@<!?>\|\%({{.*\)\@<!}}\|\%({!!.*\)\@<!!!}'          let indent = indent - &sw      else          if exists("*GetBladeIndentCustom")              let hindent = GetBladeIndentCustom() +        elseif searchpair('@include\s*(', '', ')', 'bWr') || +                    \ searchpair('{!!', '', '!!}', 'bWr') || +                    \ searchpair('{{', '', '}}', 'bWr') || +                    \ searchpair('<?', '', '?>', '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 102d3495..fd973e45 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 e1708552..898e36b0 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 24f394c1..99ad0d44 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\,*<Return>,:,!^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*\/\/\|\/\*\).*\)\@<!\*\/' && +  if line =~ '^\s*$' && getline(prevline) =~ '\%(\%(^\s*\/\/\|\/\*\).*\)\@<!\*\/' &&          \ s:IsInComment(prevline, 1)      return indent(prevline) - 1    endif @@ -430,16 +438,6 @@ function GetJavascriptIndent()      return 0    endif -" foo('foo', -"   bar('bar', function() { -"     hi(); -"   }) -" ); - -" function (a, b, c, d, -"     e, f, g) { -"       console.log('inner'); -" }    " If the previous line ended with a block opening, add a level of indent.    if s:Match(lnum, s:block_regex)      return s:InMultiVarStatement(lnum, 0, 0) || s:LineHasOpeningBrackets(lnum) !~ '2' ? @@ -451,15 +449,16 @@ function GetJavascriptIndent()    let ind = indent(lnum)    " If the previous line contained an opening bracket, and we are still in it,    " add indent depending on the bracket type. -  if s:Match(lnum, '\%([[({]\)\|\%([^\t \])}][})\]]\)') +  if s:Match(lnum, '[[({})\]]')      let counts = s:LineHasOpeningBrackets(lnum)      if counts =~ '2' -      call cursor(lnum,matchend(s:RemoveTrailingComments(line), '.\+\zs[])}]')) +      call cursor(lnum,matchend(s:RemoveTrailingComments(line), '.*\zs[])}]'))        while s:lookForParens('(\|{\|\[', ')\|}\|\]', 'bW', 0) == lnum          call cursor(lnum, matchend(s:RemoveTrailingComments(strpart(line,0,col('.'))), '.*\zs[])}]'))        endwhile -      if line('.') < lnum && !s:InMultiVarStatement(line('.'),0,0) -        return indent(s:GetMSL(line('.'), 0)) +      let cur = line('.') +      if cur < lnum && !s:InMultiVarStatement(cur,0,0) +        return indent(s:GetMSL(cur, 0))        end      elseif counts =~ '1' || s:Onescope(lnum)        return ind + s:sw() @@ -502,64 +501,64 @@ let &cpo = s:cpo_save  unlet s:cpo_save  " gq{{{2  function! Fixedgq(lnum, count) -    let l:tw = &tw ? &tw : 80; +  let l:tw = &tw ? &tw : 80; -    let l:count = a:count -    let l:first_char = indent(a:lnum) + 1 +  let l:count = a:count +  let l:first_char = indent(a:lnum) + 1 -    if mode() == 'i' " gq was not pressed, but tw was set -        return 1 -    endif +  if mode() == 'i' " gq was not pressed, but tw was set +    return 1 +  endif -    " This gq is only meant to do code with strings, not comments -    if s:IsInComment(a:lnum, l:first_char) -        return 1 -    endif +  " This gq is only meant to do code with strings, not comments +  if s:IsInComment(a:lnum, l:first_char) +    return 1 +  endif -    if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq -        return 1 -    endif +  if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq +    return 1 +  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 +  " 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) +  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 +  " 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 +  " 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 -    if breakpoint[1] != 0 -        call feedkeys("r\<CR>") -    else -        let l:count = l:count - 1 -    endif +  if breakpoint[1] != 0 +    call feedkeys("r\<CR>") +  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 00000000..bf558e76 --- /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 <johannes@zellner.org> +" 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 8fb5d137..0a49059d 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 - -    " 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 +  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 + +  " 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 70936528..0fad9561 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 b5e3ff76..00432a0f 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 1e733988..0b8987c0 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 d413632a..6bbeab93 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=/\<import\> / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsComment,jsString,jsTemplateString,jsNoise,jsModuleGroup,jsModuleAsterisk -syntax match  jsExportContainer   /\<export\> / 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=/\<import\> / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsComment,jsString,jsTemplateString,jsNoise,jsModuleGroup,jsModuleAsterisk +syntax region  jsExportContainer start=/\<export\> / 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        /\<class\>\%( [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        /\<class\>\%( [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 - -"" 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 - -  " 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\)\>" - -  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 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 + +if exists("javascript_plugin_jsdoc") +  runtime extras/jsdoc.vim +  " NGDoc requires JSDoc +  if exists("javascript_plugin_ngdoc") +    runtime extras/ngdoc.vim +  endif +endif + +if exists("javascript_plugin_flow") +  runtime extras/flow.vim +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  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 <args>    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 0f23fc17..63ac6b46 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -458,9 +458,9 @@ syn match rubyKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%([_[:lower:]][_[:aln  syn match rubyKeywordAsMethod "\(defined?\|exit!\)\@!\<[_[:lower:]][_[:alnum:]]*[?!]"			       transparent contains=NONE  " More Symbols {{{1 -syn match  rubySymbol		"\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1 +syn match  rubySymbol		"\%([{(,]\_s*\)\zs\l\w*[!?]\=::\@!"he=e-1  syn match  rubySymbol		"[]})\"':]\@1<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1 -syn match  rubySymbol		"\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1 +syn match  rubySymbol		"\%([{(,]\_s*\)\zs[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1  syn match  rubySymbol		"[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="hs=s+1,he=e-1  " __END__ Directive {{{1 diff --git a/syntax/tmux.vim b/syntax/tmux.vim index 0ceffd21..6c627fd5 100644 --- a/syntax/tmux.vim +++ b/syntax/tmux.vim @@ -33,15 +33,16 @@ syn keyword tmuxAction	any current none  syn keyword tmuxBoolean	off on  syn keyword tmuxCmds -	\ attach[-session] -	\ bind[-key] +	\ attach +	\ attach-session +	\ bind +	\ bind-key  	\ break-pane  	\ breakp  	\ capture-pane  	\ capturep  	\ choose-buffer  	\ choose-client -	\ choose-list  	\ choose-session  	\ choose-tree  	\ choose-window @@ -49,124 +50,149 @@ syn keyword tmuxCmds  	\ clearhist  	\ clock-mode  	\ command-prompt -	\ confirm[-before] +	\ confirm +	\ confirm-before  	\ copy-mode  	\ delete-buffer  	\ deleteb -	\ detach[-client] -	\ display[-message] +	\ detach +	\ detach-client +	\ display +	\ display-message  	\ display-panes  	\ displayp  	\ find-window  	\ findw -	\ has[-session] -	\ if[-shell] +	\ has +	\ has-session +	\ if +	\ if-shell +	\ info  	\ join-pane  	\ joinp  	\ kill-pane -	\ killp  	\ kill-server  	\ kill-session  	\ kill-window +	\ killp  	\ killw +	\ last  	\ last-pane +	\ last-window  	\ lastp -	\ last[-window]  	\ link-window  	\ linkw  	\ list-buffers -	\ lsb  	\ list-clients -	\ lsc  	\ list-commands -	\ lscm  	\ list-keys -	\ lsk  	\ list-panes -	\ lsp  	\ list-sessions -	\ ls  	\ list-windows -	\ lsw  	\ load-buffer  	\ loadb +	\ lock  	\ lock-client -	\ lockc -	\ lock[-server] +	\ lock-server  	\ lock-session +	\ lockc  	\ locks +	\ ls +	\ lsb +	\ lsc +	\ lscm +	\ lsk +	\ lsp +	\ lsw  	\ move-pane -	\ movep  	\ move-window +	\ movep  	\ movew -	\ new[-session] +	\ new +	\ new-session +	\ new-window +	\ neww +	\ next  	\ next-layout +	\ next-window  	\ nextl -	\ next[-window]  	\ paste-buffer  	\ pasteb +	\ path  	\ pipe-pane  	\ pipep +	\ prev  	\ previous-layout +	\ previous-window  	\ prevl -	\ prev[ious-window] -	\ refresh[-client] -	\ rename[-session] +	\ refresh +	\ refresh-client +	\ rename +	\ rename-session  	\ rename-window  	\ renamew  	\ resize-pane  	\ resizep  	\ respawn-pane -	\ respawnp  	\ respawn-window +	\ respawnp  	\ respawnw  	\ rotate-window  	\ rotatew -	\ run[-shell] +	\ run +	\ run-shell  	\ save-buffer  	\ saveb  	\ select-layout -	\ selectl  	\ select-pane -	\ selectp  	\ select-window +	\ selectl +	\ selectp  	\ selectw -	\ send[-keys] +	\ send +	\ send-keys  	\ send-prefix  	\ server-info -	\ info +	\ set  	\ set-buffer -	\ setb  	\ set-environment -	\ setenv -	\ set[-option] +	\ set-hook +	\ set-option  	\ set-window-option +	\ setb +	\ setenv  	\ setw +	\ show  	\ show-buffer -	\ showb  	\ show-environment -	\ showenv +	\ show-hooks  	\ show-messages -	\ showmsgs -	\ show[-options] +	\ show-options  	\ show-window-options +	\ showb +	\ showenv +	\ showmsgs  	\ showw -	\ source[-file] +	\ source +	\ source-file  	\ split-window  	\ splitw -	\ start[-server] +	\ start +	\ start-server  	\ suspend-client  	\ suspendc  	\ swap-pane -	\ swapp  	\ swap-window +	\ swapp  	\ swapw  	\ switch-client  	\ switchc -	\ unbind[-key] +	\ unbind +	\ unbind-key  	\ unlink-window  	\ unlinkw -	\ wait[-for] +	\ wait +	\ wait-for  syn keyword tmuxOptsSet  	\ assume-paste-time @@ -186,19 +212,14 @@ syn keyword tmuxOptsSet  	\ escape-time  	\ exit-unattached  	\ focus-events +	\ history-file  	\ history-limit  	\ lock-after-time  	\ lock-command -	\ lock-server  	\ message-command-style  	\ message-limit  	\ message-style -	\ mouse-resize-pane -	\ mouse-select-pane -	\ mouse-select-window -	\ mouse-utf8 -	\ pane-active-border-style -	\ pane-border-style +	\ mouse  	\ prefix  	\ prefix2  	\ quiet @@ -218,8 +239,8 @@ syn keyword tmuxOptsSet  	\ status-position  	\ status-right  	\ status-right-length -	\ status-utf8 -	\ staus-right-style +	\ status-right-style +	\ status-style  	\ terminal-overrides  	\ update-environment  	\ visual-activity @@ -232,8 +253,7 @@ syn keyword tmuxOptsSetw  	\ allow-rename  	\ alternate-screen  	\ automatic-rename -	\ c0-change-interval -	\ c0-change-trigger +	\ automatic-rename-format  	\ clock-mode-colour  	\ clock-mode-style  	\ force-height @@ -241,16 +261,17 @@ syn keyword tmuxOptsSetw  	\ main-pane-height  	\ main-pane-width  	\ mode-keys -	\ mode-mouse  	\ mode-style  	\ monitor-activity  	\ monitor-silence  	\ other-pane-height  	\ other-pane-width +	\ pane-active-border-style  	\ pane-base-index +	\ pane-border-style  	\ remain-on-exit  	\ synchronize-panes -	\ utf8 +	\ window-active-style  	\ window-status-activity-style  	\ window-status-bell-style  	\ window-status-current-format @@ -259,6 +280,7 @@ syn keyword tmuxOptsSetw  	\ window-status-last-style  	\ window-status-separator  	\ window-status-style +	\ window-style  	\ wrap-search  	\ xterm-keys @@ -270,7 +292,9 @@ syn match tmuxOptions		/\s-\a\+/		display  syn match tmuxVariable		/\w\+=/			display  syn match tmuxVariableExpansion	/\${\=\w\+}\=/		display -syn region tmuxComment	start=/#/ end=/$/ contains=tmuxTodo display oneline +" Comments can span multiple lines, when the newline is escaped +" (with a single) backslash at the end. +syn region tmuxComment  start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo  syn region tmuxString	start=/"/ end=/"/ display oneline  syn region tmuxString	start=/'/ end=/'/ display oneline diff --git a/syntax/vimgo.vim b/syntax/vimgo.vim index 4dec0b43..811cd683 100644 --- a/syntax/vimgo.vim +++ b/syntax/vimgo.vim @@ -1,7 +1,7 @@  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1  if exists("b:current_syntax") -    finish +  finish  endif  let b:current_syntax = "vimgo" @@ -12,4 +12,6 @@ syn region  goTitle start="\%1l" end=":"  hi def link goInterface Type  hi def link goTitle Label +" vim: sw=2 ts=2 et +  endif | 
