mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c69562f864 | ||
|
|
40c54bc12b |
@@ -79,7 +79,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||||
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, ftplugin, ftdetect)
|
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, ftplugin, ftdetect)
|
||||||
- [powershell](https://github.com/Persistent13/vim-ps1) (syntax, indent, 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)
|
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [puppet](https://github.com/voxpupuli/vim-puppet) (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)
|
- [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)
|
- [systemd](https://github.com/kurayama/systemd-vim-syntax) (syntax, ftdetect)
|
||||||
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
|
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
|
||||||
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
|
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
|
||||||
- [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect)
|
- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin, ftdetect)
|
||||||
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
|
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
|
||||||
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
|
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
|
||||||
- [twig](https://github.com/evidens/vim-twig) (syntax, ftplugin)
|
- [twig](https://github.com/evidens/vim-twig) (syntax, ftplugin)
|
||||||
|
|||||||
@@ -28,8 +28,11 @@ endif
|
|||||||
|
|
||||||
hi link rustNiceOperator Operator
|
hi link rustNiceOperator Operator
|
||||||
|
|
||||||
if !exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
|
if !(exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0)
|
||||||
hi! link Conceal Operator
|
hi! link Conceal Operator
|
||||||
|
|
||||||
|
" And keep it after a colorscheme change
|
||||||
|
au ColorScheme <buffer> hi! link Conceal Operator
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ function! s:RmDir(path)
|
|||||||
echoerr 'Attempted to delete protected path: ' . a:path
|
echoerr 'Attempted to delete protected path: ' . a:path
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
silent exe "!rm -rf " . shellescape(a:path)
|
return system("rm -rf " . shellescape(a:path))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd.
|
" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd.
|
||||||
|
|||||||
@@ -29,9 +29,13 @@ function! rustfmt#Format()
|
|||||||
|
|
||||||
let command = g:rustfmt_command . " --write-mode=overwrite "
|
let command = g:rustfmt_command . " --write-mode=overwrite "
|
||||||
|
|
||||||
let out = systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname))
|
if exists("*systemlist")
|
||||||
|
let out = systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname))
|
||||||
|
else
|
||||||
|
let out = split(system(command . g:rustfmt_options . " " . shellescape(l:tmpname)), '\r\?\n')
|
||||||
|
endif
|
||||||
|
|
||||||
if v:shell_error == 0
|
if v:shell_error == 0 || v:shell_error == 3
|
||||||
" remove undo point caused via BufWritePre
|
" remove undo point caused via BufWritePre
|
||||||
try | silent undojoin | catch | endtry
|
try | silent undojoin | catch | endtry
|
||||||
|
|
||||||
|
|||||||
2
build
2
build
@@ -170,7 +170,7 @@ PACKS="
|
|||||||
systemd:kurayama/systemd-vim-syntax
|
systemd:kurayama/systemd-vim-syntax
|
||||||
textile:timcharper/textile.vim
|
textile:timcharper/textile.vim
|
||||||
thrift:solarnz/thrift.vim
|
thrift:solarnz/thrift.vim
|
||||||
tmux:tejr/vim-tmux
|
tmux:keith/tmux.vim
|
||||||
tomdoc:wellbredgrapefruit/tomdoc.vim
|
tomdoc:wellbredgrapefruit/tomdoc.vim
|
||||||
toml:cespare/vim-toml
|
toml:cespare/vim-toml
|
||||||
twig:evidens/vim-twig
|
twig:evidens/vim-twig
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ endif
|
|||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo-=C
|
set cpo-=C
|
||||||
if filereadable("makefile") || filereadable("Makefile")
|
if filereadable("makefile") || filereadable("Makefile")
|
||||||
CompilerSet makeprg=make
|
CompilerSet makeprg=make
|
||||||
else
|
else
|
||||||
CompilerSet makeprg=go\ build
|
CompilerSet makeprg=go\ build
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Define the patterns that will be recognized by QuickFix when parsing the
|
" 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
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
" vim:ts=4:sw=4:et
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -157,14 +157,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
|||||||
let s:current_fileformats = ''
|
let s:current_fileformats = ''
|
||||||
let s:current_fileencodings = ''
|
let s:current_fileencodings = ''
|
||||||
function! s:gofiletype_pre(type)
|
function! s:gofiletype_pre(type)
|
||||||
let s:current_fileformats = &g:fileformats
|
let s:current_fileformats = &g:fileformats
|
||||||
let s:current_fileencodings = &g:fileencodings
|
let s:current_fileencodings = &g:fileencodings
|
||||||
set fileencodings=utf-8 fileformats=unix
|
set fileencodings=utf-8 fileformats=unix
|
||||||
let &l:filetype = a:type
|
let &l:filetype = a:type
|
||||||
endfunction
|
endfunction
|
||||||
function! s:gofiletype_post()
|
function! s:gofiletype_post()
|
||||||
let &g:fileformats = s:current_fileformats
|
let &g:fileformats = s:current_fileformats
|
||||||
let &g:fileencodings = s:current_fileencodings
|
let &g:fileencodings = s:current_fileencodings
|
||||||
endfunction
|
endfunction
|
||||||
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
|
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
|
||||||
au BufRead *.go call s:gofiletype_pre("go")
|
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 Puppetfile call s:setf('ruby')
|
||||||
au BufNewFile,BufRead *.rabl call s:setf('ruby')
|
au BufNewFile,BufRead *.rabl call s:setf('ruby')
|
||||||
au BufNewFile,BufRead [rR]outefile 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 [tT]horfile,*.thor call s:setf('ruby')
|
||||||
au BufNewFile,BufRead [vV]agrantfile call s:setf('ruby')
|
au BufNewFile,BufRead [vV]agrantfile call s:setf('ruby')
|
||||||
endif
|
endif
|
||||||
@@ -507,8 +507,7 @@ au BufNewFile,BufRead *.thrift setlocal filetype=thrift
|
|||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux
|
autocmd BufNewFile,BufRead {.,}tmux*.conf* setfiletype tmux
|
||||||
autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal commentstring=#\ %s
|
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
|
|||||||
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
|
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
|
||||||
\."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'"
|
\."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'"
|
||||||
|
|
||||||
if maparg('im','n') == ''
|
if maparg('im','x') == '' && maparg('im','o') == '' && maparg('am','x') == '' && maparg('am','o') == ''
|
||||||
onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
|
onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
|
||||||
onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
|
onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
|
||||||
xnoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
|
xnoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
|
||||||
@@ -196,7 +196,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
|
|||||||
\."| sil! exe 'xunmap <buffer> im' | sil! exe 'xunmap <buffer> am'"
|
\."| sil! exe 'xunmap <buffer> im' | sil! exe 'xunmap <buffer> am'"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if maparg('iM','n') == ''
|
if maparg('iM','x') == '' && maparg('iM','o') == '' && maparg('aM','x') == '' && maparg('aM','o') == ''
|
||||||
onoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
|
onoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
|
||||||
onoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
|
onoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
|
||||||
xnoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
|
xnoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
|||||||
" Description: Vim syntax file for Rust
|
" Description: Vim syntax file for Rust
|
||||||
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||||
" Maintainer: Kevin Ballard <kevin@sb.org>
|
" Maintainer: Kevin Ballard <kevin@sb.org>
|
||||||
" Last Change: January 29, 2015
|
" Last Change: June 08, 2016
|
||||||
|
|
||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
finish
|
finish
|
||||||
@@ -14,6 +14,9 @@ let b:did_ftplugin = 1
|
|||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
|
augroup rust.vim
|
||||||
|
autocmd!
|
||||||
|
|
||||||
" Variables {{{1
|
" Variables {{{1
|
||||||
|
|
||||||
" The rust source code at present seems to typically omit a leader on /*!
|
" 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")
|
if exists("b:delimitMate_excluded_regions")
|
||||||
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
|
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
|
||||||
endif
|
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
|
endif
|
||||||
|
|
||||||
if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
|
if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
|
||||||
@@ -161,10 +190,13 @@ let b:undo_ftplugin = "
|
|||||||
\|ounmap <buffer> ]]
|
\|ounmap <buffer> ]]
|
||||||
\|set matchpairs-=<:>
|
\|set matchpairs-=<:>
|
||||||
\|unlet b:match_skip
|
\|unlet b:match_skip
|
||||||
|
\|augroup! rust.vim
|
||||||
\"
|
\"
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
|
augroup END
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ let b:did_ftplugin = 1
|
|||||||
let b:undo_ftplugin = "setl isk<"
|
let b:undo_ftplugin = "setl isk<"
|
||||||
|
|
||||||
setlocal iskeyword+=-
|
setlocal iskeyword+=-
|
||||||
|
setlocal commentstring=/%s
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
5
ftplugin/tmux.vim
Normal file
5
ftplugin/tmux.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
|
||||||
|
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -7,13 +7,20 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
|
|||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! indent/html.vim
|
runtime! indent/html.vim
|
||||||
|
let s:htmlindent = &indentexpr
|
||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
|
|
||||||
|
runtime! indent/php.vim
|
||||||
|
let s:phpindent = &indentexpr
|
||||||
|
unlet! b:did_indent
|
||||||
|
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
setlocal indentexpr=GetBladeIndent()
|
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.
|
" Only define the function once.
|
||||||
if exists("*GetBladeIndent")
|
if exists("*GetBladeIndent")
|
||||||
@@ -30,13 +37,19 @@ function! GetBladeIndent()
|
|||||||
let cline = substitute(substitute(getline(v:lnum), '\s\+$', '', ''), '^\s\+', '', '')
|
let cline = substitute(substitute(getline(v:lnum), '\s\+$', '', ''), '^\s\+', '', '')
|
||||||
let indent = indent(lnum)
|
let indent = indent(lnum)
|
||||||
let cindent = indent(v: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
|
let indent = indent - &sw
|
||||||
else
|
else
|
||||||
if exists("*GetBladeIndentCustom")
|
if exists("*GetBladeIndentCustom")
|
||||||
let hindent = GetBladeIndentCustom()
|
let hindent = GetBladeIndentCustom()
|
||||||
|
elseif searchpair('@include\s*(', '', ')', 'bWr') ||
|
||||||
|
\ searchpair('{!!', '', '!!}', 'bWr') ||
|
||||||
|
\ searchpair('{{', '', '}}', 'bWr') ||
|
||||||
|
\ searchpair('<?', '', '?>', 'bWr')
|
||||||
|
execute 'let hindent = ' . s:phpindent
|
||||||
else
|
else
|
||||||
let hindent = HtmlIndent()
|
execute 'let hindent = ' . s:htmlindent
|
||||||
endif
|
endif
|
||||||
if hindent > -1
|
if hindent > -1
|
||||||
let indent = hindent
|
let indent = hindent
|
||||||
@@ -47,10 +60,13 @@ function! GetBladeIndent()
|
|||||||
let indent = cindent <= indent ? -1 : increase
|
let indent = cindent <= indent ? -1 : increase
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if line =~# '@\%(section\)\%(.*\s*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)'
|
if line =~# '@\%(section\)\%(.*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)'
|
||||||
return indent
|
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
|
return increase
|
||||||
|
elseif line =~# '<?\%(.*?>\)\@!'
|
||||||
|
return indent(lnum-1) == -1 ? increase : indent(lnum) + increase
|
||||||
else
|
else
|
||||||
return indent
|
return indent
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
|||||||
" - general line splits (line ends in an operator)
|
" - general line splits (line ends in an operator)
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
@@ -23,60 +23,60 @@ setlocal indentexpr=GoIndent(v:lnum)
|
|||||||
setlocal indentkeys+=<:>,0=},0=)
|
setlocal indentkeys+=<:>,0=},0=)
|
||||||
|
|
||||||
if exists("*GoIndent")
|
if exists("*GoIndent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" use shiftwidth function only if it's available
|
" use shiftwidth function only if it's available
|
||||||
if exists('*shiftwidth')
|
if exists('*shiftwidth')
|
||||||
func s:sw()
|
func s:sw()
|
||||||
return shiftwidth()
|
return shiftwidth()
|
||||||
endfunc
|
endfunc
|
||||||
else
|
else
|
||||||
func s:sw()
|
func s:sw()
|
||||||
return &sw
|
return &sw
|
||||||
endfunc
|
endfunc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! GoIndent(lnum)
|
function! GoIndent(lnum)
|
||||||
let prevlnum = prevnonblank(a:lnum-1)
|
let prevlnum = prevnonblank(a:lnum-1)
|
||||||
if prevlnum == 0
|
if prevlnum == 0
|
||||||
" top of file
|
" top of file
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" grab the previous and current line, stripping comments.
|
" grab the previous and current line, stripping comments.
|
||||||
let prevl = substitute(getline(prevlnum), '//.*$', '', '')
|
let prevl = substitute(getline(prevlnum), '//.*$', '', '')
|
||||||
let thisl = substitute(getline(a:lnum), '//.*$', '', '')
|
let thisl = substitute(getline(a:lnum), '//.*$', '', '')
|
||||||
let previ = indent(prevlnum)
|
let previ = indent(prevlnum)
|
||||||
|
|
||||||
let ind = previ
|
let ind = previ
|
||||||
|
|
||||||
if prevl =~ '[({]\s*$'
|
if prevl =~ '[({]\s*$'
|
||||||
" previous line opened a block
|
" previous line opened a block
|
||||||
let ind += s:sw()
|
let ind += s:sw()
|
||||||
endif
|
endif
|
||||||
if prevl =~# '^\s*\(case .*\|default\):$'
|
if prevl =~# '^\s*\(case .*\|default\):$'
|
||||||
" previous line is part of a switch statement
|
" previous line is part of a switch statement
|
||||||
let ind += s:sw()
|
let ind += s:sw()
|
||||||
endif
|
endif
|
||||||
" TODO: handle if the previous line is a label.
|
" TODO: handle if the previous line is a label.
|
||||||
|
|
||||||
if thisl =~ '^\s*[)}]'
|
if thisl =~ '^\s*[)}]'
|
||||||
" this line closed a block
|
" this line closed a block
|
||||||
let ind -= s:sw()
|
let ind -= s:sw()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Colons are tricky.
|
" Colons are tricky.
|
||||||
" We want to outdent if it's part of a switch ("case foo:" or "default:").
|
" 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
|
" 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.
|
" (b) they're hard to disambiguate from a composite literal key.
|
||||||
if thisl =~# '^\s*\(case .*\|default\):$'
|
if thisl =~# '^\s*\(case .*\|default\):$'
|
||||||
let ind -= s:sw()
|
let ind -= s:sw()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" vim:ts=4:sw=4:et
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -45,4 +45,6 @@ function! GetGoHTMLTmplIndent(lnum)
|
|||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ setlocal nosmartindent
|
|||||||
" Now, set up our indentation expression and keys that trigger it.
|
" Now, set up our indentation expression and keys that trigger it.
|
||||||
setlocal indentexpr=GetJavascriptIndent()
|
setlocal indentexpr=GetJavascriptIndent()
|
||||||
setlocal formatexpr=Fixedgq(v:lnum,v:count)
|
setlocal formatexpr=Fixedgq(v:lnum,v:count)
|
||||||
setlocal indentkeys=0{,0},0),0],0\,:,!^F,o,O,e
|
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.
|
" Only define the function once.
|
||||||
if exists("*GetJavascriptIndent")
|
if exists("*GetJavascriptIndent")
|
||||||
@@ -44,23 +44,28 @@ endif
|
|||||||
" ============
|
" ============
|
||||||
|
|
||||||
let s:line_pre = '^\s*\%(\/\*.*\*\/\s*\)*'
|
let s:line_pre = '^\s*\%(\/\*.*\*\/\s*\)*'
|
||||||
let s:js_keywords = s:line_pre . '\%(break\|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: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.
|
" Regex of syntax group names that are or delimit string or are comments.
|
||||||
let s:syng_strcom = '\%(string\|regex\|comment\|template\)\c'
|
let s:syng_strcom = '\%(string\|regex\|special\|doc\|comment\|template\)\c'
|
||||||
|
|
||||||
" Regex of syntax group names that are strings.
|
" Regex of syntax group names that are strings.
|
||||||
let s:syng_string = 'regex\c'
|
let s:syng_string = 'regex\c'
|
||||||
|
|
||||||
" Regex of syntax group names that are strings or documentation.
|
" Regex of syntax group names that are strings or documentation.
|
||||||
let s:syng_multiline = '\%(comment\|doc\)\c'
|
let s:syng_comment = '\%(comment\|doc\)\c'
|
||||||
|
|
||||||
" Regex of syntax group names that are line comment.
|
|
||||||
let s:syng_linecom = 'linecomment\c'
|
|
||||||
|
|
||||||
" Expression used to check whether we should skip a match with searchpair().
|
" Expression used to check whether we should skip a match with searchpair().
|
||||||
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
|
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
|
||||||
|
|
||||||
|
func s:lookForParens(start,end,flags,stop)
|
||||||
|
try
|
||||||
|
return searchpair(a:start,'',a:end,a:flags,s:skip_expr,a:stop,300)
|
||||||
|
catch /E118/
|
||||||
|
return searchpair(a:start,'',a:end,a:flags,0,a:stop)
|
||||||
|
endtry
|
||||||
|
endfunc
|
||||||
|
|
||||||
let s:line_term = '\s*\%(\%(\/\/.*\)\=\|\%(\/\*.*\*\/\s*\)*\)$'
|
let s:line_term = '\s*\%(\%(\/\/.*\)\=\|\%(\/\*.*\*\/\s*\)*\)$'
|
||||||
|
|
||||||
" Regex that defines continuation lines, not including (, {, or [.
|
" Regex that defines continuation lines, not including (, {, or [.
|
||||||
@@ -74,8 +79,8 @@ function s:Onescope(lnum)
|
|||||||
end
|
end
|
||||||
let mypos = col('.')
|
let mypos = col('.')
|
||||||
call cursor(a:lnum, 1)
|
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 &&
|
||||||
\ searchpair('(', '', ')', 'W', s:skip_expr, a:lnum) > 0 &&
|
\ s:lookForParens('(', ')', 'W', a:lnum) > 0 &&
|
||||||
\ col('.') == strlen(s:RemoveTrailingComments(getline(a:lnum)))
|
\ col('.') == strlen(s:RemoveTrailingComments(getline(a:lnum)))
|
||||||
call cursor(a:lnum, mypos)
|
call cursor(a:lnum, mypos)
|
||||||
return 1
|
return 1
|
||||||
@@ -88,7 +93,7 @@ endfunction
|
|||||||
" Regex that defines blocks.
|
" Regex that defines blocks.
|
||||||
let s:block_regex = '[{([]' . s:line_term
|
let s:block_regex = '[{([]' . s:line_term
|
||||||
|
|
||||||
let s:operator_first = s:line_pre . '\%([.,:?]\|\([-/+*]\)\%(\1\|\*\|\/\)\@!\|||\|&&\)'
|
let s:operator_first = s:line_pre . '\%([,:?]\|\([-/.+*]\)\%(\1\|\*\|\/\)\@!\|||\|&&\)'
|
||||||
|
|
||||||
let s:var_stmt = s:line_pre . '\%(const\|let\|var\)\s\+\C'
|
let s:var_stmt = s:line_pre . '\%(const\|let\|var\)\s\+\C'
|
||||||
|
|
||||||
@@ -108,32 +113,23 @@ function s:IsInString(lnum, col)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a multi-line comment.
|
" Check if the character at lnum:col is inside a multi-line comment.
|
||||||
function s:IsInMultilineComment(lnum, col)
|
function s:IsInComment(lnum, col)
|
||||||
return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_comment
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Check if the character at lnum:col is a line comment.
|
|
||||||
function s:IsLineComment(lnum, col)
|
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
|
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
|
||||||
function s:PrevNonBlankNonString(lnum)
|
function s:PrevNonBlankNonString(lnum)
|
||||||
let in_block = 0
|
|
||||||
let lnum = prevnonblank(a:lnum)
|
let lnum = prevnonblank(a:lnum)
|
||||||
while lnum > 0
|
while lnum > 0
|
||||||
" Go in and out of blocks comments as necessary.
|
|
||||||
" If the line isn't empty (with opt. comment) or in a string, end search.
|
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
if s:IsInMultilineComment(lnum, matchend(line, '^\s*/\*') - 1) && line !~ s:line_pre . '$'
|
let com = match(line, '\%(\/\*.*\)\@<!\*\/') + 1
|
||||||
if in_block
|
if s:IsInComment(lnum, com)
|
||||||
let in_block = 0
|
call cursor(lnum, com)
|
||||||
else
|
let parlnum = search('\%(\/\/.*\)\@<!\/\*', 'nbW')
|
||||||
break
|
if parlnum > 0
|
||||||
endif
|
let lnum = parlnum
|
||||||
elseif !in_block && s:IsInMultilineComment(lnum, match(line, '\*/\s*$') + 1) && line !~ s:line_pre . '$'
|
end
|
||||||
let in_block = 1
|
elseif line !~ '^' . s:line_term && !s:IsInStringOrComment(lnum,1)
|
||||||
elseif !in_block && line !~ s:line_pre . '\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line)))
|
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
let lnum = prevnonblank(lnum - 1)
|
let lnum = prevnonblank(lnum - 1)
|
||||||
@@ -146,25 +142,22 @@ function s:GetMSL(lnum, in_one_line_scope)
|
|||||||
" Start on the line we're at and use its indent.
|
" Start on the line we're at and use its indent.
|
||||||
let msl = a:lnum
|
let msl = a:lnum
|
||||||
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
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.
|
" 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.
|
" Otherwise, terminate search as we have found our MSL already.
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
let col = match(line, s:continuation_regex) + 1
|
|
||||||
let coal = match(line, s:comma_last) + 1
|
|
||||||
let line2 = getline(msl)
|
let line2 = getline(msl)
|
||||||
let col2 = matchend(line2, ')')
|
if ((s:Match(lnum,s:continuation_regex) || s:Match(lnum, s:comma_last)) &&
|
||||||
if ((col > 0 && !s:IsInStringOrComment(lnum, col) || coal > 0 && !s:IsInStringOrComment(lnum,coal)) &&
|
|
||||||
\ !s:Match(lnum, s:expr_case)) || s:IsInString(lnum, strlen(line))
|
\ !s:Match(lnum, s:expr_case)) || s:IsInString(lnum, strlen(line))
|
||||||
let msl = lnum
|
let msl = lnum
|
||||||
|
if s:Match(lnum, s:line_pre . '[]})]') && !a:in_one_line_scope
|
||||||
" if there are more closing brackets, continue from the line which has the matching opening bracket
|
call cursor(lnum,1)
|
||||||
elseif col2 > 0 && !s:IsInStringOrComment(msl, col2) && s:LineHasOpeningBrackets(msl)[0] == '2' && !a:in_one_line_scope
|
let parlnum = s:lookForParens('(\|{\|\[', ')\|}\|\]', 'nbW', 0)
|
||||||
call cursor(msl, 1)
|
if parlnum > 0
|
||||||
if searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
let lnum = parlnum
|
||||||
let lnum = line('.')
|
continue
|
||||||
let msl = lnum
|
end
|
||||||
endif
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -193,18 +186,22 @@ endfunction
|
|||||||
" Find if the string is inside var statement (but not the first string)
|
" Find if the string is inside var statement (but not the first string)
|
||||||
function s:InMultiVarStatement(lnum, cont, prev)
|
function s:InMultiVarStatement(lnum, cont, prev)
|
||||||
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
||||||
|
let cont = a:cont
|
||||||
|
let prev = a:prev
|
||||||
|
|
||||||
" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name')
|
" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name')
|
||||||
|
|
||||||
" loop through previous expressions to find a var statement
|
" loop through previous expressions to find a var statement
|
||||||
while lnum > 0 && (s:Match(lnum, s:comma_last) ||(a:cont && getline(lnum) =~ s:line_pre . '}') ||
|
while lnum > 0 && (s:Match(lnum, s:comma_last) ||(cont && getline(lnum) =~ s:line_pre . '[]})]') ||
|
||||||
\ s:Match(lnum,s:continuation_regex)) || (a:prev && (s:Match(a:prev, s:comma_last) ||
|
\ s:Match(lnum,s:continuation_regex)) || (prev && (s:Match(prev, s:comma_last) ||
|
||||||
\ s:Match(a:prev,s:continuation_regex)))
|
\ s:Match(prev,s:continuation_regex)))
|
||||||
" if the line is a js keyword
|
" if the line is a js keyword
|
||||||
if a:cont
|
if cont
|
||||||
|
let cont = 0
|
||||||
call cursor(lnum,1)
|
call cursor(lnum,1)
|
||||||
if searchpair('{', '', '}', 'bW', s:skip_expr) > 0
|
let parlnum = s:lookForParens('(\|{\|\[', ')\|}\|\]', 'nbW', 0)
|
||||||
let lnum = line('.')
|
if parlnum > 0
|
||||||
|
let lnum = parlnum
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if s:Match(lnum, s:js_keywords)
|
if s:Match(lnum, s:js_keywords)
|
||||||
@@ -221,33 +218,13 @@ function s:InMultiVarStatement(lnum, cont, prev)
|
|||||||
end
|
end
|
||||||
endif
|
endif
|
||||||
let lnum = s:PrevNonBlankNonString(lnum - 1)
|
let lnum = s:PrevNonBlankNonString(lnum - 1)
|
||||||
|
let prev = prev && lnum > 0 ? prev : 0
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" beginning of program, not a var
|
" beginning of program, not a var
|
||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find line above with beginning of the var statement or returns 0 if it's not"{{{2
|
|
||||||
" this statement
|
|
||||||
" function s:GetVarIndent(lnum)
|
|
||||||
" let lvar = s:InMultiVarStatement(a:lnum, 0,0)
|
|
||||||
" let prev_lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
|
||||||
|
|
||||||
" if lvar
|
|
||||||
" let line = s:RemoveTrailingComments(getline(prev_lnum))
|
|
||||||
|
|
||||||
" " if the previous line doesn't end in a comma, return to regular indent
|
|
||||||
" if (line !~ s:comma_last)
|
|
||||||
" return indent(prev_lnum) - s:sw()
|
|
||||||
" else
|
|
||||||
" return indent(lvar) + s:sw()
|
|
||||||
" endif
|
|
||||||
" endif
|
|
||||||
|
|
||||||
" return -1
|
|
||||||
" endfunction"}}}
|
|
||||||
|
|
||||||
|
|
||||||
" Check if line 'lnum' has more opening brackets than closing ones.
|
" Check if line 'lnum' has more opening brackets than closing ones.
|
||||||
function s:LineHasOpeningBrackets(lnum)
|
function s:LineHasOpeningBrackets(lnum)
|
||||||
let open_0 = 0
|
let open_0 = 0
|
||||||
@@ -337,6 +314,7 @@ function GetJavascriptIndent()
|
|||||||
" 3.1. Setup {{{1
|
" 3.1. Setup {{{1
|
||||||
" ----------
|
" ----------
|
||||||
" Set up variables for restoring position in file. Could use v:lnum here.
|
" 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('.')
|
let vcol = col('.')
|
||||||
|
|
||||||
" 3.2. Work on the current line {{{1
|
" 3.2. Work on the current line {{{1
|
||||||
@@ -347,75 +325,92 @@ function GetJavascriptIndent()
|
|||||||
let line = getline(v:lnum)
|
let line = getline(v:lnum)
|
||||||
" previous nonblank line number
|
" previous nonblank line number
|
||||||
let prevline = prevnonblank(v:lnum - 1)
|
let prevline = prevnonblank(v:lnum - 1)
|
||||||
|
" previous line of code
|
||||||
|
let lnum = s:PrevNonBlankNonString(v:lnum - 1)
|
||||||
|
|
||||||
" to not change multiline string values
|
" to not change multiline string values
|
||||||
if synIDattr(synID(v:lnum, 1, 1), 'name') =~? 'string\|template' && line !~ s:line_pre . '[''"`]'
|
if line !~ '^[''"`]' && synIDattr(synID(v:lnum, 1, 1), 'name') =~? 'string\|template'
|
||||||
return indent(v:lnum)
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If we are in a multi-line comment, cindent does the right thing.
|
" If we are in a multi-line comment, cindent does the right thing.
|
||||||
if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1) &&
|
if line !~ '^\%(\/\*\|\s*\/\/\)' && s:IsInComment(v:lnum, 1)
|
||||||
\ s:IsInMultilineComment(v:lnum, match(line, '\s*$')) && line !~ '^\/\*'
|
|
||||||
return cindent(v:lnum)
|
return cindent(v:lnum)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" single opening bracket will assume you want a c style of indenting
|
" single opening bracket will assume you want a c style of indenting
|
||||||
if s:Match(v:lnum, s:line_pre . '{' . s:line_term)
|
if line =~ s:line_pre . '{' && !s:Match(lnum,s:block_regex) &&
|
||||||
|
\ !s:Match(lnum,s:comma_last)
|
||||||
return cindent(v:lnum)
|
return cindent(v:lnum)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" cindent each line which has a switch label
|
" cindent each line which has a switch label
|
||||||
if (line =~ s:expr_case)
|
if (line =~ s:expr_case)
|
||||||
return cindent(v:lnum)
|
let s:cpo_switch = &cpo
|
||||||
endif
|
set cpo+=%
|
||||||
|
let ind = cindent(v:lnum)
|
||||||
" If we got a closing bracket on an empty line, find its match and indent
|
let &cpo = s:cpo_switch
|
||||||
" according to it. For parentheses we indent to its column - 1, for the
|
|
||||||
" others we indent to the containing line's MSL's level. Return -1 if fail.
|
|
||||||
let col = matchend(line, s:line_pre . '[]})]')
|
|
||||||
if col > 0 && !s:IsInStringOrComment(v:lnum, col)
|
|
||||||
call cursor(v:lnum, col)
|
|
||||||
|
|
||||||
|
|
||||||
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
|
|
||||||
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
|
|
||||||
let ind = s:InMultiVarStatement(line('.'), 0, 0) ? indent(line('.')) : indent(s:GetMSL(line('.'), 0))
|
|
||||||
endif
|
|
||||||
return ind
|
return ind
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" If we got a closing bracket on an empty line, find its match and indent
|
||||||
|
" according to it.
|
||||||
|
let col = line =~ s:line_pre . '[]})]'
|
||||||
|
if col > 0
|
||||||
|
let parlnum = v:lnum
|
||||||
|
while col
|
||||||
|
call cursor(parlnum, 1)
|
||||||
|
let parlnum = s:lookForParens('(\|{\|\[', ')\|}\|\]', 'nbW', 0)
|
||||||
|
let col = s:Match(parlnum, s:line_pre . '[]})]')
|
||||||
|
if col
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
if parlnum > 0
|
||||||
|
let ind = s:InMultiVarStatement(parlnum, 0, 0)|| s:LineHasOpeningBrackets(parlnum) !~ '2' ?
|
||||||
|
\ indent(parlnum) : indent(s:GetMSL(parlnum, 0))
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
return ind
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
" If line starts with an operator...
|
" If line starts with an operator...
|
||||||
if (line =~ s:operator_first)
|
if (line =~ s:operator_first)
|
||||||
if (s:Match(prevline, s:operator_first))
|
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
|
" and so does previous line, don't indent
|
||||||
return indent(prevline)
|
return indent(lnum)
|
||||||
end
|
end
|
||||||
let counts = s:LineHasOpeningBrackets(prevline)
|
let counts = s:LineHasOpeningBrackets(lnum)
|
||||||
if counts[0] == '2' || counts[1] == '2' || counts[2] == '2'
|
if counts =~ '2'
|
||||||
call cursor(prevline, 1)
|
call cursor(lnum, 1)
|
||||||
" Search for the opening tag
|
" Search for the opening tag
|
||||||
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
|
let parlnum = s:lookForParens('(\|{\|\[', ')\|}\|\]', 'nbW', 0)
|
||||||
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 && s:Match(line('.'), s:operator_first)
|
if parlnum > 0
|
||||||
return indent(line('.'))
|
return !s:Match(parlnum, s:operator_first) &&
|
||||||
|
\ synIDattr(synID(v:lnum, 1, 1), 'name') !~? 'jsbracket\|jsparen\|jsobject' ?
|
||||||
|
\ indent(lnum) + s:sw() : indent(parlnum)
|
||||||
end
|
end
|
||||||
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
|
elseif synIDattr(synID(v:lnum, 1, 1), 'name') !~? 'jsbracket\|jsparen\|jsobject'
|
||||||
" otherwise, indent 1 level
|
" otherwise, if not in an key/val;array item;param, indent 1 level
|
||||||
return indent(prevline) + s:sw()
|
return indent(lnum) + s:sw()
|
||||||
end
|
end
|
||||||
|
|
||||||
" If previous line starts with an operator...
|
" If previous line starts with an operator...
|
||||||
elseif (s:Match(prevline, s:operator_first) && !s:Match(prevline,s:continuation_regex))||getline(prevline) =~ ');\=' . s:line_term
|
elseif (s:Match(lnum, s:operator_first) && !s:Match(lnum,s:continuation_regex)) ||
|
||||||
let counts = s:LineHasOpeningBrackets(prevline)
|
\ getline(lnum) =~ '[]})];\=' . s:line_term
|
||||||
if counts[0] == '2' && !s:Match(prevline, s:operator_first)
|
let counts = s:LineHasOpeningBrackets(lnum)
|
||||||
call cursor(prevline, 1)
|
if counts =~ '2' && !s:Match(lnum, s:operator_first)
|
||||||
|
call cursor(lnum, 1)
|
||||||
" Search for the opening tag
|
" Search for the opening tag
|
||||||
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
|
let mnum = s:lookForParens('(\|{\|\[', ')\|}\|\]', 'nbW', 0)
|
||||||
if mnum > 0 && s:Match(mnum, s:operator_first)
|
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()
|
return indent(mnum) - s:sw()
|
||||||
end
|
end
|
||||||
elseif s:Match(prevline, s:operator_first)
|
elseif s:Match(lnum, s:operator_first)
|
||||||
if counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
|
if counts !~ '1'
|
||||||
return indent(prevline) - s:sw()
|
return indent(lnum) - s:sw()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -426,12 +421,12 @@ function GetJavascriptIndent()
|
|||||||
" If the line is empty and the previous nonblank line was a multi-line
|
" 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
|
" comment, use that comment's indent. Deduct one char to account for the
|
||||||
" space in ' */'.
|
" space in ' */'.
|
||||||
if line =~ '^\s*$' && s:IsInMultilineComment(prevline, 1)
|
if line =~ '^\s*$' && getline(prevline) =~ '\%(\%(^\s*\/\/\|\/\*\).*\)\@<!\*\/' &&
|
||||||
|
\ s:IsInComment(prevline, 1)
|
||||||
return indent(prevline) - 1
|
return indent(prevline) - 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Find a non-blank, non-multi-line string line above the current line.
|
" Find a non-blank, non-multi-line string line above the current line.
|
||||||
let lnum = s:PrevNonBlankNonString(v:lnum - 1)
|
|
||||||
|
|
||||||
" If the line is empty and inside a string, use the previous line.
|
" If the line is empty and inside a string, use the previous line.
|
||||||
if line =~ '^\s*$' && lnum != prevline
|
if line =~ '^\s*$' && lnum != prevline
|
||||||
@@ -443,10 +438,10 @@ function GetJavascriptIndent()
|
|||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
" If the previous line ended with a block opening, add a level of indent.
|
" If the previous line ended with a block opening, add a level of indent.
|
||||||
if s:Match(lnum, s:block_regex)
|
if s:Match(lnum, s:block_regex)
|
||||||
return s:InMultiVarStatement(lnum, 0, 0) ? indent(lnum) + s:sw() : indent(s:GetMSL(lnum, 0)) + s:sw()
|
return s:InMultiVarStatement(lnum, 0, 0) || s:LineHasOpeningBrackets(lnum) !~ '2' ?
|
||||||
|
\ indent(lnum) + s:sw() : indent(s:GetMSL(lnum, 0)) + s:sw()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Set up variables for current line.
|
" Set up variables for current line.
|
||||||
@@ -456,28 +451,17 @@ function GetJavascriptIndent()
|
|||||||
" add indent depending on the bracket type.
|
" add indent depending on the bracket type.
|
||||||
if s:Match(lnum, '[[({})\]]')
|
if s:Match(lnum, '[[({})\]]')
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
let counts = s:LineHasOpeningBrackets(lnum)
|
||||||
if counts[0] == '2'
|
if counts =~ '2'
|
||||||
call cursor(lnum, 1)
|
call cursor(lnum,matchend(s:RemoveTrailingComments(line), '.*\zs[])}]'))
|
||||||
" Search for the opening tag
|
while s:lookForParens('(\|{\|\[', ')\|}\|\]', 'bW', 0) == lnum
|
||||||
if searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
call cursor(lnum, matchend(s:RemoveTrailingComments(strpart(line,0,col('.'))), '.*\zs[])}]'))
|
||||||
return indent(s:GetMSL(line('.'), 0))
|
endwhile
|
||||||
|
let cur = line('.')
|
||||||
|
if cur < lnum && !s:InMultiVarStatement(cur,0,0)
|
||||||
|
return indent(s:GetMSL(cur, 0))
|
||||||
end
|
end
|
||||||
elseif counts[1] == '2' && !s:Match(lnum, s:line_pre . '}')
|
elseif counts =~ '1' || s:Onescope(lnum)
|
||||||
call cursor(lnum, 1)
|
|
||||||
" Search for the opening tag
|
|
||||||
if searchpair('{', '', '}', 'bW', s:skip_expr) > 0
|
|
||||||
return indent(s:GetMSL(line('.'), 0))
|
|
||||||
end
|
|
||||||
elseif counts[2] == '2' && !s:Match(lnum, s:line_pre . ']')
|
|
||||||
call cursor(lnum, 1)
|
|
||||||
" Search for the opening tag
|
|
||||||
if searchpair('\[', '', '\]', 'bW', s:skip_expr) > 0
|
|
||||||
return indent(s:GetMSL(line('.'), 0))
|
|
||||||
end
|
|
||||||
elseif counts[1] == '1' || counts[2] == '1' || counts[0] == '1' || s:Onescope(lnum)
|
|
||||||
return ind + s:sw()
|
return ind + s:sw()
|
||||||
else
|
|
||||||
call cursor(v:lnum, vcol)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -517,64 +501,64 @@ let &cpo = s:cpo_save
|
|||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
" gq{{{2
|
" gq{{{2
|
||||||
function! Fixedgq(lnum, count)
|
function! Fixedgq(lnum, count)
|
||||||
let l:tw = &tw ? &tw : 80;
|
let l:tw = &tw ? &tw : 80;
|
||||||
|
|
||||||
let l:count = a:count
|
let l:count = a:count
|
||||||
let l:first_char = indent(a:lnum) + 1
|
let l:first_char = indent(a:lnum) + 1
|
||||||
|
|
||||||
if mode() == 'i' " gq was not pressed, but tw was set
|
if mode() == 'i' " gq was not pressed, but tw was set
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" This gq is only meant to do code with strings, not comments
|
" This gq is only meant to do code with strings, not comments
|
||||||
if s:IsLineComment(a:lnum, l:first_char) || s:IsInMultilineComment(a:lnum, l:first_char)
|
if s:IsInComment(a:lnum, l:first_char)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq
|
if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Put all the lines on one line and do normal spliting after that
|
" Put all the lines on one line and do normal spliting after that
|
||||||
if l:count > 1
|
if l:count > 1
|
||||||
while l:count > 1
|
while l:count > 1
|
||||||
let l:count -= 1
|
let l:count -= 1
|
||||||
normal J
|
normal J
|
||||||
endwhile
|
endwhile
|
||||||
endif
|
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)
|
call cursor(a:lnum, l:tw + 1)
|
||||||
let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum)
|
let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum)
|
||||||
call cursor(a:lnum, l:tw + 1)
|
endif
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
if breakpoint[1] != 0
|
if breakpoint[1] != 0
|
||||||
call feedkeys("r\<CR>")
|
call feedkeys("r\<CR>")
|
||||||
else
|
else
|
||||||
let l:count = l:count - 1
|
let l:count = l:count - 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" run gq on new lines
|
" run gq on new lines
|
||||||
if l:count == 1
|
if l:count == 1
|
||||||
call feedkeys("gqq")
|
call feedkeys("gqq")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
"}}}
|
"}}}
|
||||||
" vim: foldmethod=marker:foldlevel=1
|
" vim: foldmethod=marker:foldlevel=1
|
||||||
|
|||||||
21
indent/proto.vim
Normal file
21
indent/proto.vim
Normal file
@@ -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
|
||||||
@@ -69,6 +69,10 @@ if !exists("g:go_highlight_methods")
|
|||||||
let g:go_highlight_methods = 0
|
let g:go_highlight_methods = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists("g:go_highlight_fields")
|
||||||
|
let g:go_highlight_fields = 0
|
||||||
|
endif
|
||||||
|
|
||||||
if !exists("g:go_highlight_structs")
|
if !exists("g:go_highlight_structs")
|
||||||
let g:go_highlight_structs = 0
|
let g:go_highlight_structs = 0
|
||||||
endif
|
endif
|
||||||
@@ -310,6 +314,12 @@ if g:go_highlight_methods != 0
|
|||||||
endif
|
endif
|
||||||
hi def link goMethod Type
|
hi def link goMethod Type
|
||||||
|
|
||||||
|
" Fields;
|
||||||
|
if g:go_highlight_fields != 0
|
||||||
|
syn match goField /\(\.\)\@<=\a\+\([\ \n\r\:\)]\)\@=/
|
||||||
|
endif
|
||||||
|
hi def link goField Type
|
||||||
|
|
||||||
" Structs;
|
" Structs;
|
||||||
if g:go_highlight_structs != 0
|
if g:go_highlight_structs != 0
|
||||||
syn match goStruct /\(.\)\@<=\w\+\({\)\@=/
|
syn match goStruct /\(.\)\@<=\w\+\({\)\@=/
|
||||||
@@ -328,35 +338,35 @@ hi def link goInterfaceDef Function
|
|||||||
|
|
||||||
" Build Constraints
|
" Build Constraints
|
||||||
if g:go_highlight_build_constraints != 0
|
if g:go_highlight_build_constraints != 0
|
||||||
syn match goBuildKeyword display contained "+build"
|
syn match goBuildKeyword display contained "+build"
|
||||||
" Highlight the known values of GOOS, GOARCH, and other +build options.
|
" Highlight the known values of GOOS, GOARCH, and other +build options.
|
||||||
syn keyword goBuildDirectives contained
|
syn keyword goBuildDirectives contained
|
||||||
\ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9
|
\ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9
|
||||||
\ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64
|
\ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64
|
||||||
\ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc
|
\ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc
|
||||||
\ s390 s390x sparc sparc64 cgo ignore race
|
\ s390 s390x sparc sparc64 cgo ignore race
|
||||||
|
|
||||||
" Other words in the build directive are build tags not listed above, so
|
" 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
|
" avoid highlighting them as comments by using a matchgroup just for the
|
||||||
" start of the comment.
|
" start of the comment.
|
||||||
" The rs=s+2 option lets the \s*+build portion be part of the inner region
|
" 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.
|
" instead of the matchgroup so it will be highlighted as a goBuildKeyword.
|
||||||
syn region goBuildComment matchgroup=goBuildCommentStart
|
syn region goBuildComment matchgroup=goBuildCommentStart
|
||||||
\ start="//\s*+build\s"rs=s+2 end="$"
|
\ start="//\s*+build\s"rs=s+2 end="$"
|
||||||
\ contains=goBuildKeyword,goBuildDirectives
|
\ contains=goBuildKeyword,goBuildDirectives
|
||||||
hi def link goBuildCommentStart Comment
|
hi def link goBuildCommentStart Comment
|
||||||
hi def link goBuildDirectives Type
|
hi def link goBuildDirectives Type
|
||||||
hi def link goBuildKeyword PreProc
|
hi def link goBuildKeyword PreProc
|
||||||
|
|
||||||
" One or more line comments that are followed immediately by a "package"
|
" One or more line comments that are followed immediately by a "package"
|
||||||
" declaration are treated like package documentation, so these must be
|
" declaration are treated like package documentation, so these must be
|
||||||
" matched as comments to avoid looking like working build constraints.
|
" matched as comments to avoid looking like working build constraints.
|
||||||
" The he, me, and re options let the "package" itself be highlighted by
|
" The he, me, and re options let the "package" itself be highlighted by
|
||||||
" the usual rules.
|
" the usual rules.
|
||||||
syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/
|
syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/
|
||||||
\ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7
|
\ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7
|
||||||
\ contains=@goCommentGroup,@Spell
|
\ contains=@goCommentGroup,@Spell
|
||||||
hi def link goPackageComment Comment
|
hi def link goPackageComment Comment
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@@ -369,4 +379,6 @@ syn sync minlines=500
|
|||||||
|
|
||||||
let b:current_syntax = "go"
|
let b:current_syntax = "go"
|
||||||
|
|
||||||
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syn match godefStackComment '^".*'
|
syn match godefStackComment '^".*'
|
||||||
@@ -19,4 +19,6 @@ hi def link godefStackCurrentPosition Special
|
|||||||
hi def link godefStackFilename Directory
|
hi def link godefStackFilename Directory
|
||||||
hi def link godefStackEntryLocationNumber LineNr
|
hi def link godefStackEntryLocationNumber LineNr
|
||||||
|
|
||||||
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("main_syntax")
|
if !exists("main_syntax")
|
||||||
let main_syntax = 'html'
|
let main_syntax = 'html'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! syntax/gotexttmpl.vim
|
runtime! syntax/gotexttmpl.vim
|
||||||
@@ -14,6 +14,6 @@ unlet b:current_syntax
|
|||||||
|
|
||||||
let b:current_syntax = "gohtmltmpl"
|
let b:current_syntax = "gohtmltmpl"
|
||||||
|
|
||||||
" vim:ts=4:sw=4:et
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
|||||||
|
|
||||||
" Quit when a (custom) syntax file was already loaded
|
" Quit when a (custom) syntax file was already loaded
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syn case match
|
syn case match
|
||||||
@@ -84,6 +84,6 @@ hi def link goTplComment Comment
|
|||||||
|
|
||||||
let b:current_syntax = "gotexttmpl"
|
let b:current_syntax = "gotexttmpl"
|
||||||
|
|
||||||
" vim:ts=4:sw=4:et
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -18,213 +18,195 @@ if !exists('g:javascript_conceal')
|
|||||||
let g:javascript_conceal = 0
|
let g:javascript_conceal = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"" dollar sign is permittd anywhere in an identifier
|
" Dollar sign is permittd anywhere in an identifier
|
||||||
setlocal iskeyword+=$
|
setlocal iskeyword+=$
|
||||||
|
|
||||||
syntax sync fromstart
|
syntax sync fromstart
|
||||||
|
" TODO: Figure out what type of casing I need
|
||||||
|
" syntax case ignore
|
||||||
|
syntax case match
|
||||||
|
|
||||||
syntax match jsNoise /[:,\;\.]\{1}/
|
syntax match jsNoise /[:,\;\.]\{1}/
|
||||||
|
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
|
||||||
|
syntax match jsParensError /[)}\]]/
|
||||||
|
|
||||||
"" Program Keywords
|
" 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
|
syntax keyword jsOperator delete instanceof typeof void new in of
|
||||||
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/
|
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/
|
||||||
syntax keyword jsBooleanTrue true
|
syntax keyword jsBooleanTrue true
|
||||||
syntax keyword jsBooleanFalse false
|
syntax keyword jsBooleanFalse false
|
||||||
syntax keyword jsModules import export contained
|
|
||||||
syntax keyword jsModuleWords default from as contained
|
|
||||||
syntax keyword jsOf of contained
|
|
||||||
syntax keyword jsArgsObj arguments
|
|
||||||
|
|
||||||
syntax region jsImportContainer start="^\s\?import \?" end=";\|$" contains=jsModules,jsModuleWords,jsLineComment,jsComment,jsStringS,jsStringD,jsTemplateString,jsNoise,jsBlock
|
" Modules
|
||||||
|
syntax keyword jsModuleKeywords contained import
|
||||||
|
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,jsComment
|
||||||
|
syntax match jsModuleAsterisk contained /*/
|
||||||
|
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
|
||||||
|
|
||||||
syntax region jsExportContainer start="^\s\?export \?" end="$" contains=jsModules,jsModuleWords,jsComment,jsTemplateString,jsStringD,jsStringS,jsRegexpString,jsNumber,jsFloat,jsThis,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsDotNotation,jsBracket,jsParen,jsFuncCall,jsUndefined,jsNan,jsKeyword,jsStorageClass,jsPrototype,jsBuiltins,jsNoise,jsArgsObj,jsBlock,jsClassDefinition
|
" Strings, Templates, Numbers
|
||||||
|
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend
|
||||||
"" JavaScript comments
|
syntax region jsString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend
|
||||||
syntax keyword jsCommentTodo TODO FIXME XXX TBD contained
|
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateVar,jsSpecial extend
|
||||||
syntax region jsLineComment start=+\/\/+ end=+$+ keepend contains=jsCommentTodo,@Spell extend
|
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup=jsTemplateString
|
||||||
syntax region jsEnvComment start="\%^#!" end="$" display
|
|
||||||
syntax region jsLineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend contains=jsCommentTodo,@Spell fold
|
|
||||||
syntax region jsCvsTag start="\$\cid:" end="\$" oneline contained
|
|
||||||
syntax region jsComment start="/\*" end="\*/" contains=jsCommentTodo,jsCvsTag,@Spell fold extend
|
|
||||||
|
|
||||||
"" JSDoc / JSDoc Toolkit
|
|
||||||
if !exists("javascript_ignore_javaScriptdoc")
|
|
||||||
syntax case ignore
|
|
||||||
|
|
||||||
"" syntax coloring for javadoc comments (HTML)
|
|
||||||
"syntax include @javaHtml <sfile>:p:h/html.vim
|
|
||||||
"unlet b:current_syntax
|
|
||||||
|
|
||||||
syntax region jsBlockComment 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\)\>" nextgroup=jsDocParam skipwhite
|
|
||||||
" tags containing type and param
|
|
||||||
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" nextgroup=jsDocType skipwhite
|
|
||||||
" tags containing type but no param
|
|
||||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" nextgroup=jsDocTypeNoParam skipwhite
|
|
||||||
" tags containing references
|
|
||||||
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" nextgroup=jsDocSeeTag skipwhite
|
|
||||||
" 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 matchgroup=jsDocTypeBrackets start="{" end="}" oneline contained nextgroup=jsDocParam skipwhite contains=jsDocTypeRecord
|
|
||||||
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
|
||||||
syntax region jsDocTypeRecord start=/{/ end=/}/ contained extend contains=jsDocTypeRecord
|
|
||||||
syntax region jsDocTypeRecord start=/\[/ end=/\]/ contained extend contains=jsDocTypeRecord
|
|
||||||
syntax region jsDocTypeNoParam start="{" end="}" oneline contained
|
|
||||||
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
|
||||||
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
|
||||||
|
|
||||||
syntax case match
|
|
||||||
endif "" JSDoc end
|
|
||||||
|
|
||||||
syntax case match
|
|
||||||
|
|
||||||
"" Syntax in the JavaScript code
|
|
||||||
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
|
|
||||||
syntax match jsSpecial "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)" contained
|
|
||||||
syntax region jsTemplateVar matchgroup=jsTemplateBraces start=+${+ end=+}+ contained contains=@jsExpression
|
|
||||||
syntax region jsStringD start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@htmlPreproc,@Spell
|
|
||||||
syntax region jsStringS start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@htmlPreproc,@Spell
|
|
||||||
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateVar,jsSpecial,@htmlPreproc
|
|
||||||
syntax region jsTaggedTemplate start=/\k\+\%([\n\s]\+\)\?`/ end=+`+ contains=jsTemplateString keepend
|
|
||||||
syntax region jsRegexpCharClass start=+\[+ skip=+\\.+ end=+\]+ contained
|
|
||||||
syntax match jsRegexpBoundary "\v%(\<@![\^$]|\\[bB])" contained
|
|
||||||
syntax match jsRegexpBackRef "\v\\[1-9][0-9]*" contained
|
|
||||||
syntax match jsRegexpQuantifier "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??" contained
|
|
||||||
syntax match jsRegexpOr "\v\<@!\|" contained
|
|
||||||
syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained
|
|
||||||
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
|
|
||||||
syntax region jsRegexpGroup start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contained contains=jsRegexpCharClass,@jsRegexpSpecial keepend
|
|
||||||
if v:version > 703 || v:version == 603 && has("patch1088")
|
|
||||||
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend
|
|
||||||
else
|
|
||||||
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend
|
|
||||||
endif
|
|
||||||
syntax match jsNumber /\<-\=\d\+\(L\|[eE][+-]\=\d\+\)\=\>\|\<0[xX]\x\+\>/
|
syntax match jsNumber /\<-\=\d\+\(L\|[eE][+-]\=\d\+\)\=\>\|\<0[xX]\x\+\>/
|
||||||
syntax keyword jsNumber Infinity
|
syntax keyword jsNumber Infinity
|
||||||
syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
||||||
syntax match jsObjectKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey contained
|
|
||||||
syntax match jsFunctionKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/ contained
|
|
||||||
syntax match jsDecorator "@" display contains=jsDecoratorFunction nextgroup=jsDecoratorFunction skipwhite
|
|
||||||
syntax match jsDecoratorFunction "[a-zA-Z_][a-zA-Z0-9_.]*" display contained nextgroup=jsFunc skipwhite
|
|
||||||
|
|
||||||
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
|
" Regular Expressions
|
||||||
exe 'syntax keyword jsReturn return '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '')
|
syntax match jsSpecial contained "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)"
|
||||||
exe 'syntax keyword jsUndefined undefined '.(exists('g:javascript_conceal_undefined') ? 'conceal cchar='.g:javascript_conceal_undefined : '')
|
syntax region jsTemplateVar contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression
|
||||||
exe 'syntax keyword jsNan NaN '.(exists('g:javascript_conceal_NaN') ? 'conceal cchar='.g:javascript_conceal_NaN : '')
|
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+
|
||||||
exe 'syntax keyword jsPrototype prototype '.(exists('g:javascript_conceal_prototype') ? 'conceal cchar='.g:javascript_conceal_prototype : '')
|
syntax match jsRegexpBoundary contained "\v%(\<@![\^$]|\\[bB])"
|
||||||
exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal_this') ? 'conceal cchar='.g:javascript_conceal_this : '')
|
syntax match jsRegexpBackRef contained "\v\\[1-9][0-9]*"
|
||||||
exe 'syntax keyword jsStatic static '.(exists('g:javascript_conceal_static') ? 'conceal cchar='.g:javascript_conceal_static : '')
|
syntax match jsRegexpQuantifier contained "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??"
|
||||||
exe 'syntax keyword jsSuper super '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
|
syntax match jsRegexpOr contained "\v\<@!\|"
|
||||||
|
syntax match jsRegexpMod contained "\v\(@<=\?[:=!>]"
|
||||||
|
syntax region jsRegexpGroup contained start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contains=jsRegexpCharClass,@jsRegexpSpecial keepend
|
||||||
|
if v:version > 703 || v:version == 603 && has("patch1088")
|
||||||
|
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
|
||||||
|
else
|
||||||
|
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
|
||||||
|
endif
|
||||||
|
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
|
||||||
|
|
||||||
"" Statement Keywords
|
syntax match jsObjectKey contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue,jsFlowParenRegion
|
||||||
syntax keyword jsStatement break continue with
|
syntax region jsObjectKeyString contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
||||||
syntax keyword jsConditional if else switch
|
syntax region jsObjectKeyString contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
||||||
syntax keyword jsRepeat do while for
|
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
|
||||||
syntax keyword jsLabel case default
|
syntax match jsObjectSeparator contained /,/
|
||||||
syntax keyword jsKeyword yield
|
syntax region jsObjectValue contained start=/:/ end=/\%(,\|}\)\@=/ contains=@jsExpression extend
|
||||||
syntax keyword jsException try catch throw finally
|
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
syntax keyword jsAsyncKeyword async await
|
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/
|
||||||
|
syntax match jsObjectMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName
|
||||||
|
syntax 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
|
||||||
|
|
||||||
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
|
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
|
||||||
|
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '')
|
||||||
|
exe 'syntax keyword jsUndefined undefined '.(exists('g:javascript_conceal_undefined') ? 'conceal cchar='.g:javascript_conceal_undefined : '')
|
||||||
|
exe 'syntax keyword jsNan NaN '.(exists('g:javascript_conceal_NaN') ? 'conceal cchar='.g:javascript_conceal_NaN : '')
|
||||||
|
exe 'syntax keyword jsPrototype prototype '.(exists('g:javascript_conceal_prototype') ? 'conceal cchar='.g:javascript_conceal_prototype : '')
|
||||||
|
exe 'syntax keyword jsThis this contained '.(exists('g:javascript_conceal_this') ? 'conceal cchar='.g:javascript_conceal_this : '')
|
||||||
|
exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
|
||||||
|
|
||||||
|
" Statement Keywords
|
||||||
|
syntax keyword jsStatement contained break continue with yield debugger
|
||||||
|
syntax keyword jsConditional if else skipwhite skipempty nextgroup=jsParenIfElse,jsBlock
|
||||||
|
syntax keyword jsConditional switch skipwhite skipempty nextgroup=jsParenSwitch
|
||||||
|
syntax keyword jsRepeat while for skipwhite skipempty nextgroup=jsParenRepeat
|
||||||
|
syntax keyword jsRepeat do skipwhite skipempty nextgroup=jsBlock
|
||||||
|
syntax keyword jsLabel contained case default
|
||||||
|
syntax keyword jsTry try skipwhite skipempty nextgroup=jsTryCatchBlock
|
||||||
|
syntax keyword jsFinally contained finally skipwhite skipempty nextgroup=jsBlock
|
||||||
|
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
|
||||||
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
|
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
|
||||||
|
|
||||||
syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval
|
syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval
|
||||||
|
" DISCUSS: How imporant is this, really? Perhaps it should be linked to an error because I assume the keywords are reserved?
|
||||||
|
syntax keyword jsFutureKeys abstract enum int short boolean interface byte long char final native synchronized float package throws goto private transient implements protected volatile double public
|
||||||
|
|
||||||
syntax keyword jsFutureKeys abstract enum int short boolean interface byte long char final native synchronized float package throws goto private transient debugger implements protected volatile double public
|
" DISCUSS: Should we really be matching stuff like this?
|
||||||
|
|
||||||
"" DOM/HTML/CSS specified things
|
|
||||||
|
|
||||||
" DOM2 Objects
|
" DOM2 Objects
|
||||||
syntax keyword jsGlobalObjects DOMImplementation DocumentFragment Document Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction
|
syntax keyword jsGlobalObjects DOMImplementation DocumentFragment Document Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction
|
||||||
syntax keyword jsExceptions DOMException
|
syntax keyword jsExceptions DOMException
|
||||||
|
|
||||||
|
" DISCUSS: Should we really be matching stuff like this?
|
||||||
" DOM2 CONSTANT
|
" DOM2 CONSTANT
|
||||||
syntax keyword jsDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
|
syntax keyword jsDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
|
||||||
syntax keyword jsDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
|
syntax keyword jsDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
|
||||||
|
|
||||||
|
" DISCUSS: Should we really be special matching on these props?
|
||||||
" HTML events and internal variables
|
" HTML events and internal variables
|
||||||
syntax case ignore
|
|
||||||
syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
|
syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
|
||||||
syntax case match
|
|
||||||
|
|
||||||
" Follow stuff should be highligh within a special context
|
|
||||||
" While it can't be handled with context depended with Regex based highlight
|
|
||||||
" So, turn it off by default
|
|
||||||
if exists("javascript_enable_domhtmlcss")
|
|
||||||
|
|
||||||
" DOM2 things
|
|
||||||
syntax match jsDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/
|
|
||||||
syntax match jsDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementById\|getElementsByClassName\|getElementsByTagName\|querySelector\|querySelectorAll\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=jsParen skipwhite
|
|
||||||
" HTML things
|
|
||||||
syntax match jsHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/
|
|
||||||
syntax match jsHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=jsParen skipwhite
|
|
||||||
|
|
||||||
" CSS Styles in JavaScript
|
|
||||||
syntax keyword jsCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition
|
|
||||||
syntax keyword jsCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition
|
|
||||||
syntax keyword jsCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode
|
|
||||||
syntax keyword jsCssStyles contained bottom height left position right top width zIndex
|
|
||||||
syntax keyword jsCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout
|
|
||||||
syntax keyword jsCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop
|
|
||||||
syntax keyword jsCssStyles contained listStyle listStyleImage listStylePosition listStyleType
|
|
||||||
syntax keyword jsCssStyles contained background backgroundAttachment backgroundColor backgroundImage backgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat
|
|
||||||
syntax keyword jsCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType
|
|
||||||
syntax keyword jsCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText
|
|
||||||
syntax keyword jsCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor
|
|
||||||
|
|
||||||
" Highlight ways
|
|
||||||
syntax match jsDotNotation "\." nextgroup=jsPrototype,jsDomElemAttrs,jsDomElemFuncs,jsHtmlElemAttrs,jsHtmlElemFuncs
|
|
||||||
syntax match jsDotNotation "\.style\." nextgroup=jsCssStyles
|
|
||||||
|
|
||||||
endif "DOM/HTML/CSS
|
|
||||||
|
|
||||||
"" end DOM/HTML/CSS specified things
|
|
||||||
|
|
||||||
"" Code blocks
|
"" Code blocks
|
||||||
syntax cluster jsExpression contains=jsComment,jsLineComment,jsBlockComment,jsTaggedTemplate,jsTemplateString,jsStringD,jsStringS,jsRegexpString,jsNumber,jsFloat,jsThis,jsStatic,jsSuper,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsDotNotation,jsBracket,jsParen,jsBlock,jsFuncCall,jsUndefined,jsNan,jsKeyword,jsStorageClass,jsPrototype,jsBuiltins,jsNoise,jsCommonJS,jsImportContainer,jsExportContainer,jsArgsObj,jsDecorator,jsAsyncKeyword,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs
|
syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression extend fold
|
||||||
syntax cluster jsAll contains=@jsExpression,jsLabel,jsConditional,jsRepeat,jsReturn,jsStatement,jsTernaryIf,jsException
|
syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll extend fold
|
||||||
syntax region jsBracket matchgroup=jsBrackets start="\[" end="\]" contains=@jsAll,jsParensErrB,jsParensErrC,jsBracket,jsParen,jsBlock,@htmlPreproc fold
|
syntax region jsParenIfElse contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsBlock extend fold
|
||||||
syntax region jsParen matchgroup=jsParens start="(" end=")" contains=@jsAll,jsOf,jsParensErrA,jsParensErrC,jsParen,jsBracket,jsBlock,@htmlPreproc fold extend
|
syntax region jsParenRepeat contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsBlock extend fold
|
||||||
syntax region jsClassBlock matchgroup=jsClassBraces start="{" end="}" contains=jsFuncName,jsClassMethodDefinitions,jsOperator,jsArrowFunction,jsArrowFuncArgs,jsComment,jsBlockComment,jsLineComment,jsGenerator contained fold
|
syntax region jsParenSwitch contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold
|
||||||
syntax region jsFuncBlock matchgroup=jsFuncBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,@htmlPreproc,jsClassDefinition fold extend
|
syntax region jsParenCatch contained matchgroup=jsParens start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold
|
||||||
syntax region jsBlock matchgroup=jsBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,jsObjectKey,@htmlPreproc,jsClassDefinition extend
|
syntax region jsFuncArgs contained matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsRestExpression,jsFlow skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend fold
|
||||||
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=+?+ end=+:+ contains=@jsExpression,jsTernaryIf
|
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
|
||||||
|
|
||||||
"" catch errors caused by wrong parenthesis
|
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs
|
||||||
syntax match jsParensError ")\|}\|\]"
|
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
syntax match jsParensErrA contained "\]"
|
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
|
||||||
syntax match jsParensErrB contained ")"
|
syntax match jsFuncArgCommas contained ','
|
||||||
syntax match jsParensErrC contained "}"
|
syntax keyword jsArguments contained arguments
|
||||||
|
|
||||||
syntax match jsFuncArgDestructuring contained /\({\|}\|=\|:\|\[\|\]\)/ extend
|
|
||||||
exe 'syntax match jsFunction /\<function\>/ nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
|
|
||||||
exe 'syntax match jsArrowFunction /=>/ skipwhite nextgroup=jsFuncBlock contains=jsFuncBraces '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
|
|
||||||
|
|
||||||
syntax match jsGenerator contained /\*/ nextgroup=jsFuncName,jsFuncArgs skipwhite skipempty
|
|
||||||
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=jsFuncArgs skipwhite skipempty
|
|
||||||
" These versions of jsFuncName is for use in object declarations with no key
|
|
||||||
" syntax match jsFuncName contained /\%(^[\r\n\t ]*\)\@<=[*\r\n\t ]*[a-zA-Z_$][0-9a-zA-Z_$]*[\r\n\t ]*(\@=/ nextgroup=jsFuncArgs skipwhite skipempty containedin=jsBlock contains=jsGenerator
|
|
||||||
" syntax match jsFuncName contained /\%(,[\r\n\t ]*\)\@<=[*\r\n\t ]*[a-zA-Z_$][0-9a-zA-Z_$]*[\r\n\t ]*(\@=/ nextgroup=jsFuncArgs skipwhite skipempty containedin=jsBlock contains=jsGenerator
|
|
||||||
syntax region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest,jsComment,jsLineComment,jsStringS,jsStringD,jsNumber,jsFuncArgDestructuring,jsArrowFunction,jsParen,jsArrowFuncArgs nextgroup=jsFuncBlock keepend skipwhite skipempty
|
|
||||||
syntax match jsFuncArgCommas contained ','
|
|
||||||
syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ contains=jsFuncArgRestDots
|
|
||||||
syntax match jsFuncArgRestDots contained /\.\.\./
|
|
||||||
|
|
||||||
" Matches a single keyword argument with no parens
|
" Matches a single keyword argument with no parens
|
||||||
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs nextgroup=jsArrowFunction extend
|
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
|
||||||
" Matches a series of arguments surrounded in parens
|
" Matches a series of arguments surrounded in parens
|
||||||
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ skipempty skipwhite contains=jsFuncArgs nextgroup=jsArrowFunction extend
|
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
|
||||||
|
|
||||||
syntax keyword jsClassKeywords extends class contained
|
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
|
||||||
syntax match jsClassNoise /\./ contained
|
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock contains=jsFuncBraces '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
|
||||||
syntax keyword jsClassMethodDefinitions get set static contained nextgroup=jsFuncName skipwhite skipempty
|
|
||||||
syntax match jsClassDefinition /\<class\>\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise nextgroup=jsClassBlock skipwhite skipempty
|
syntax keyword jsClassKeywords contained extends class
|
||||||
|
syntax match jsClassNoise contained /\./
|
||||||
|
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
|
||||||
|
syntax region jsClassValue contained start=/=/ end=/\%(;\|}\|\n\)\@=/ contains=@jsExpression
|
||||||
|
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
|
||||||
|
syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*(\)\@=/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
|
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=/\/\*/ 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.
|
" Define the default highlighting.
|
||||||
" For version 5.7 and earlier: only when not done already
|
" For version 5.7 and earlier: only when not done already
|
||||||
@@ -236,25 +218,16 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
|||||||
else
|
else
|
||||||
command -nargs=+ HiLink hi def link <args>
|
command -nargs=+ HiLink hi def link <args>
|
||||||
endif
|
endif
|
||||||
HiLink jsFuncArgRest Special
|
|
||||||
HiLink jsComment Comment
|
HiLink jsComment Comment
|
||||||
HiLink jsLineComment Comment
|
|
||||||
HiLink jsEnvComment PreProc
|
HiLink jsEnvComment PreProc
|
||||||
HiLink jsBlockComment Comment
|
|
||||||
HiLink jsCommentTodo Todo
|
HiLink jsCommentTodo Todo
|
||||||
HiLink jsCvsTag Function
|
HiLink jsString String
|
||||||
HiLink jsDocTags Special
|
HiLink jsObjectKeyString String
|
||||||
HiLink jsDocSeeTag Function
|
|
||||||
HiLink jsDocType Type
|
|
||||||
HiLink jsDocTypeBrackets jsDocType
|
|
||||||
HiLink jsDocTypeRecord jsDocType
|
|
||||||
HiLink jsDocTypeNoParam Type
|
|
||||||
HiLink jsDocParam Label
|
|
||||||
HiLink jsStringS String
|
|
||||||
HiLink jsStringD String
|
|
||||||
HiLink jsTemplateString String
|
HiLink jsTemplateString String
|
||||||
|
HiLink jsObjectStringKey String
|
||||||
|
HiLink jsClassStringKey String
|
||||||
HiLink jsTaggedTemplate StorageClass
|
HiLink jsTaggedTemplate StorageClass
|
||||||
HiLink jsTernaryIfOperator Conditional
|
HiLink jsTernaryIfOperator Operator
|
||||||
HiLink jsRegexpString String
|
HiLink jsRegexpString String
|
||||||
HiLink jsRegexpBoundary SpecialChar
|
HiLink jsRegexpBoundary SpecialChar
|
||||||
HiLink jsRegexpQuantifier SpecialChar
|
HiLink jsRegexpQuantifier SpecialChar
|
||||||
@@ -272,25 +245,25 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
|||||||
HiLink jsRepeat Repeat
|
HiLink jsRepeat Repeat
|
||||||
HiLink jsStatement Statement
|
HiLink jsStatement Statement
|
||||||
HiLink jsException Exception
|
HiLink jsException Exception
|
||||||
HiLink jsKeyword Keyword
|
HiLink jsTry Exception
|
||||||
|
HiLink jsFinally Exception
|
||||||
|
HiLink jsCatch Exception
|
||||||
HiLink jsAsyncKeyword Keyword
|
HiLink jsAsyncKeyword Keyword
|
||||||
HiLink jsArrowFunction Type
|
HiLink jsArrowFunction Type
|
||||||
HiLink jsFunction Type
|
HiLink jsFunction Type
|
||||||
HiLink jsGenerator jsFunction
|
HiLink jsGenerator jsFunction
|
||||||
HiLink jsArrowFuncArgs jsFuncArgs
|
HiLink jsArrowFuncArgs jsFuncArgs
|
||||||
HiLink jsFuncName Function
|
HiLink jsFuncName Function
|
||||||
HiLink jsArgsObj Special
|
HiLink jsClassFuncName jsFuncName
|
||||||
|
HiLink jsObjectFuncName Function
|
||||||
|
HiLink jsArguments Special
|
||||||
HiLink jsError Error
|
HiLink jsError Error
|
||||||
HiLink jsParensError Error
|
HiLink jsParensError Error
|
||||||
HiLink jsParensErrA Error
|
|
||||||
HiLink jsParensErrB Error
|
|
||||||
HiLink jsParensErrC Error
|
|
||||||
HiLink jsOperator Operator
|
HiLink jsOperator Operator
|
||||||
HiLink jsOf Operator
|
HiLink jsOf Operator
|
||||||
HiLink jsStorageClass StorageClass
|
HiLink jsStorageClass StorageClass
|
||||||
HiLink jsClassKeywords Structure
|
HiLink jsClassKeywords Structure
|
||||||
HiLink jsThis Special
|
HiLink jsThis Special
|
||||||
HiLink jsStatic Special
|
|
||||||
HiLink jsSuper Special
|
HiLink jsSuper Special
|
||||||
HiLink jsNan Number
|
HiLink jsNan Number
|
||||||
HiLink jsNull Type
|
HiLink jsNull Type
|
||||||
@@ -307,18 +280,33 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
|||||||
HiLink jsFuncParens Noise
|
HiLink jsFuncParens Noise
|
||||||
HiLink jsClassBraces Noise
|
HiLink jsClassBraces Noise
|
||||||
HiLink jsClassNoise Noise
|
HiLink jsClassNoise Noise
|
||||||
|
HiLink jsObjectBraces Noise
|
||||||
|
HiLink jsObjectSeparator Noise
|
||||||
HiLink jsSpecial Special
|
HiLink jsSpecial Special
|
||||||
HiLink jsTemplateVar Special
|
HiLink jsTemplateVar Special
|
||||||
HiLink jsTemplateBraces jsBraces
|
HiLink jsTemplateBraces jsBraces
|
||||||
HiLink jsGlobalObjects Special
|
HiLink jsGlobalObjects Special
|
||||||
HiLink jsExceptions Special
|
HiLink jsExceptions Special
|
||||||
HiLink jsFutureKeys Special
|
|
||||||
HiLink jsBuiltins Special
|
HiLink jsBuiltins Special
|
||||||
HiLink jsModules Include
|
HiLink jsModuleKeywords Include
|
||||||
HiLink jsModuleWords Include
|
HiLink jsModuleOperators Include
|
||||||
|
HiLink jsModuleDefault Include
|
||||||
HiLink jsDecorator Special
|
HiLink jsDecorator Special
|
||||||
HiLink jsFuncArgRestDots Noise
|
HiLink jsDecoratorFunction Special
|
||||||
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 jsDomErrNo Constant
|
||||||
HiLink jsDomNodeConsts Constant
|
HiLink jsDomNodeConsts Constant
|
||||||
@@ -331,14 +319,12 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
|||||||
|
|
||||||
HiLink jsCssStyles Label
|
HiLink jsCssStyles Label
|
||||||
|
|
||||||
HiLink jsClassMethodDefinitions Type
|
|
||||||
|
|
||||||
delcommand HiLink
|
delcommand HiLink
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Define the htmlJavaScript for HTML syntax html.vim
|
" Define the htmlJavaScript for HTML syntax html.vim
|
||||||
syntax cluster htmlJavaScript contains=@jsAll,jsBracket,jsParen,jsBlock
|
syntax cluster htmlJavaScript contains=@jsAll
|
||||||
syntax cluster javaScriptExpression contains=@jsAll,jsBracket,jsParen,jsBlock,@htmlPreproc
|
syntax cluster javaScriptExpression contains=@jsAll
|
||||||
|
|
||||||
" Vim's default html.vim highlights all javascript as 'Special'
|
" Vim's default html.vim highlights all javascript as 'Special'
|
||||||
hi! def link javaScript NONE
|
hi! def link javaScript NONE
|
||||||
|
|||||||
@@ -68,17 +68,11 @@ set cpo&vim
|
|||||||
syn match p6Identifier display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
|
syn match p6Identifier display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
|
||||||
|
|
||||||
let s:keywords = {
|
let s:keywords = {
|
||||||
\ "p6DeclareRoutine": [
|
|
||||||
\ "macro sub submethod method multi proto only category unit",
|
|
||||||
\ ],
|
|
||||||
\ "p6Module": [
|
|
||||||
\ "module class role package enum grammar slang subset",
|
|
||||||
\ ],
|
|
||||||
\ "p6Include": [
|
\ "p6Include": [
|
||||||
\ "use require",
|
\ "use require unit",
|
||||||
\ ],
|
\ ],
|
||||||
\ "p6Conditional": [
|
\ "p6Conditional": [
|
||||||
\ "if else elsif unless",
|
\ "if else elsif unless with orwith without",
|
||||||
\ ],
|
\ ],
|
||||||
\ "p6VarStorage": [
|
\ "p6VarStorage": [
|
||||||
\ "let my our state temp has constant",
|
\ "let my our state temp has constant",
|
||||||
@@ -144,7 +138,7 @@ let s:alpha_metaops_or = join(s:temp, "\\|")
|
|||||||
" than matches/regions, which would prevent these words from matching as
|
" than matches/regions, which would prevent these words from matching as
|
||||||
" autoquoted strings before "=>" or "p5=>".
|
" autoquoted strings before "=>" or "p5=>".
|
||||||
syn match p6KeywordStart display "\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!\)\@=[A-Za-z_\xC0-\xFF0-9]\@1<!\%([A-Za-z_\xC0-\xFF][-']\)\@2<!"
|
syn match p6KeywordStart display "\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!\)\@=[A-Za-z_\xC0-\xFF0-9]\@1<!\%([A-Za-z_\xC0-\xFF][-']\)\@2<!"
|
||||||
\ nextgroup=p6Attention,p6DeclareRoutine,p6Module,p6Variable,p6Include,p6Conditional,p6VarStorage,p6Repeat,p6FlowControl,p6ClosureTrait,p6Exception,p6Number,p6Pragma,p6Type,p6Operator,p6Identifier
|
\ nextgroup=p6Attention,p6Variable,p6Include,p6Conditional,p6VarStorage,p6Repeat,p6FlowControl,p6ClosureTrait,p6Exception,p6Number,p6Pragma,p6Type,p6Operator,p6Identifier
|
||||||
|
|
||||||
for [group, words] in items(s:keywords)
|
for [group, words] in items(s:keywords)
|
||||||
let s:words_space = join(words, " ")
|
let s:words_space = join(words, " ")
|
||||||
@@ -159,6 +153,10 @@ let s:words = join(s:temp, "\\|")
|
|||||||
exec "syn match p6Type display \"\\%(". s:words . "\\)\\%([A-Za-z_\\xC0-\\xFF0-9]\\|[-'][A-Za-z_\\xC0-\\xFF]\\)\\@!\" contained"
|
exec "syn match p6Type display \"\\%(". s:words . "\\)\\%([A-Za-z_\\xC0-\\xFF0-9]\\|[-'][A-Za-z_\\xC0-\\xFF]\\)\\@!\" contained"
|
||||||
unlet s:keywords s:types s:words_space s:temp s:words
|
unlet s:keywords s:types s:words_space s:temp s:words
|
||||||
|
|
||||||
|
syn match p6PreDeclare display "[.^]\@1<!\<\%(multi\|proto\|only\)\>" nextgroup=p6Declare,p6Identifier skipwhite skipempty
|
||||||
|
syn match p6Declare display "[.^]\@1<!\<\%(macro\|sub\|submethod\|method\|category\|module\|class\|role\|package\|enum\|grammar\|slang\|subset\)\>" nextgroup=p6Identifier skipwhite skipempty
|
||||||
|
syn match p6DeclareRegex display "[.^]\@1<!\<\%(regex\|rule\|token\)\>" nextgroup=p6RegexName skipwhite skipempty
|
||||||
|
|
||||||
syn match p6TypeConstraint display "\%([.^]\|^\s*\)\@<!\a\@=\%(does\|as\|but\|trusts\|of\|returns\|handles\|where\|augment\|supersede\)\>"
|
syn match p6TypeConstraint display "\%([.^]\|^\s*\)\@<!\a\@=\%(does\|as\|but\|trusts\|of\|returns\|handles\|where\|augment\|supersede\)\>"
|
||||||
syn match p6TypeConstraint display "\%([.^]\|^\s*\)\@<![A-Za-z_\xC0-\xFF0-9]\@1<!\%([A-Za-z_\xC0-\xFF][-']\)\@2<!is\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6Property
|
syn match p6TypeConstraint display "\%([.^]\|^\s*\)\@<![A-Za-z_\xC0-\xFF0-9]\@1<!\%([A-Za-z_\xC0-\xFF][-']\)\@2<!is\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6Property
|
||||||
syn match p6Property display "\a\@=\%(signature\|context\|also\|shape\|prec\|irs\|ofs\|ors\|export\|deep\|binary\|unary\|reparsed\|rw\|parsed\|cached\|readonly\|defequiv\|will\|ref\|copy\|inline\|tighter\|looser\|equiv\|assoc\|required\)" contained
|
syn match p6Property display "\a\@=\%(signature\|context\|also\|shape\|prec\|irs\|ofs\|ors\|export\|deep\|binary\|unary\|reparsed\|rw\|parsed\|cached\|readonly\|defequiv\|will\|ref\|copy\|inline\|tighter\|looser\|equiv\|assoc\|required\)" contained
|
||||||
@@ -188,7 +186,7 @@ syn match p6ReduceOp display "\%(^\|\s\|(\)\@1<=!*\%([RSXZ\[]\)*[&RSXZ]\?\[\+(\?
|
|||||||
syn match p6SetOp display "R\?(\%([-^.+|&]\|[<>][=+]\?\|cont\|elem\))"
|
syn match p6SetOp display "R\?(\%([-^.+|&]\|[<>][=+]\?\|cont\|elem\))"
|
||||||
|
|
||||||
" Reverse, cross, and zip metaoperators
|
" Reverse, cross, and zip metaoperators
|
||||||
exec "syn match p6RSXZOp display \"[RSXZ]:\\@!\\%(\\a\\@=\\%(". s:alpha_metaops_or . "\\)\\>\\|[[:alnum:]]\\@!\\%([.,]\\|[^[,.[:space:]]\\)\\+\\|\\s\\@=\\|$\\)\""
|
exec "syn match p6RSXZOp display \"[RSXZ]:\\@!\\%(\\a\\@=\\%(". s:alpha_metaops_or . "\\)\\>\\|[[:alnum:]]\\@!\\%([.,]\\|[^[,.[:alnum:][:space:]]\\)\\+\\|\\s\\@=\\|$\\)\""
|
||||||
|
|
||||||
syn match p6BlockLabel display "^\s*\zs\h\w*\s*::\@!\_s\@="
|
syn match p6BlockLabel display "^\s*\zs\h\w*\s*::\@!\_s\@="
|
||||||
|
|
||||||
@@ -362,12 +360,12 @@ syn region p6Adverb
|
|||||||
" * Followed by [-=] (e.g. <--, <=, <==, <->)
|
" * Followed by [-=] (e.g. <--, <=, <==, <->)
|
||||||
syn region p6StringAngle
|
syn region p6StringAngle
|
||||||
\ matchgroup=p6Quote
|
\ matchgroup=p6Quote
|
||||||
\ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!"
|
\ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
|
||||||
\ start="\%(\s\|[<+~=!]\)\@<!<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!"
|
\ start="\%(\s\|[<+~=!]\)\@<!<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
|
||||||
\ start="[<+~=!]\@1<!<\%(\s\|<\|=>\|[-=]\{1,2}\)\@!"
|
\ start="[<+~=!]\@1<!<\%(\s\|<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
|
||||||
\ start="\%(^\s*\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!"
|
\ start="\%(^\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
|
||||||
\ start="[<+~=!]\@1<!<\%(\s*$\)\@="
|
\ start="[<+~=!]\@1<!<\%(\s*$\)\@="
|
||||||
\ start="\%((\s*\|=\s\+\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!"
|
\ start="\%((\s*\|=\s\+\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
|
||||||
\ start="<\%(\s*>\)\@="
|
\ start="<\%(\s*>\)\@="
|
||||||
\ skip="\\\@1<!\\>"
|
\ skip="\\\@1<!\\>"
|
||||||
\ end=">"
|
\ end=">"
|
||||||
@@ -450,11 +448,12 @@ syn region p6StringDQ
|
|||||||
|
|
||||||
" Q// and friends
|
" Q// and friends
|
||||||
|
|
||||||
syn match p6QuoteQStart display "\%(:\|\%(sub\|role\)\s\)\@5<![Qq]\@=" nextgroup=p6QuoteQ,p6QuoteQ_q,p6QuoteQ_qww,p6QuoteQ_qq,p6QuoteQ_qto,p6QuoteQ_qqto,p6Identifier
|
syn match p6QuoteQStart display "\%(:\|\%(sub\|role\)\s\)\@5<![Qq]\@=" nextgroup=p6QuoteQ,p6QuoteQ_q,p6QuoteQ_qww,p6QuoteQ_qq,p6QuoteQ_to,p6QuoteQ_qto,p6QuoteQ_qqto,p6Identifier
|
||||||
syn match p6QuoteQ display "Q\%(qq\|ww\|[abcfhpsqvwx]\)\?[A-Za-z(]\@!" nextgroup=p6PairsQ skipwhite skipempty contained
|
syn match p6QuoteQ display "Q\%(qq\|ww\|[abcfhpsqvwx]\)\?[A-Za-z(]\@!" nextgroup=p6PairsQ skipwhite skipempty contained
|
||||||
syn match p6QuoteQ_q display "q[abcfhpsvwx]\?[A-Za-z(]\@!" nextgroup=p6PairsQ_q skipwhite skipempty contained
|
syn match p6QuoteQ_q display "q[abcfhpsvwx]\?[A-Za-z(]\@!" nextgroup=p6PairsQ_q skipwhite skipempty contained
|
||||||
syn match p6QuoteQ_qww display "qww[A-Za-z(]\@!" nextgroup=p6PairsQ_qww skipwhite skipempty contained
|
syn match p6QuoteQ_qww display "qww[A-Za-z(]\@!" nextgroup=p6PairsQ_qww skipwhite skipempty contained
|
||||||
syn match p6QuoteQ_qq display "qq[pwx]\?[A-Za-z(]\@!" nextgroup=p6PairsQ_qq skipwhite skipempty contained
|
syn match p6QuoteQ_qq display "qq[pwx]\?[A-Za-z(]\@!" nextgroup=p6PairsQ_qq skipwhite skipempty contained
|
||||||
|
syn match p6QuoteQ_to display "Qto[A-Za-z(]\@!" nextgroup=p6StringQ_to skipwhite skipempty contained
|
||||||
syn match p6QuoteQ_qto display "qto[A-Za-z(]\@!" nextgroup=p6StringQ_qto skipwhite skipempty contained
|
syn match p6QuoteQ_qto display "qto[A-Za-z(]\@!" nextgroup=p6StringQ_qto skipwhite skipempty contained
|
||||||
syn match p6QuoteQ_qqto display "qqto[A-Za-z(]\@!" nextgroup=p6StringQ_qqto skipwhite skipempty contained
|
syn match p6QuoteQ_qqto display "qqto[A-Za-z(]\@!" nextgroup=p6StringQ_qqto skipwhite skipempty contained
|
||||||
syn match p6QuoteQ_qto display "q\_s*\%(\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*:\%(to\|heredoc\)\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*(\@!\)\@=" nextgroup=p6PairsQ_qto skipwhite skipempty contained
|
syn match p6QuoteQ_qto display "q\_s*\%(\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*:\%(to\|heredoc\)\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*(\@!\)\@=" nextgroup=p6PairsQ_qto skipwhite skipempty contained
|
||||||
@@ -494,10 +493,11 @@ let s:bracketing_delims = [
|
|||||||
let s:all_delims = s:plain_delims + s:bracketing_delims
|
let s:all_delims = s:plain_delims + s:bracketing_delims
|
||||||
|
|
||||||
for [name, start_delim, end_delim, end_group, skip] in s:all_delims
|
for [name, start_delim, end_delim, end_group, skip] in s:all_delims
|
||||||
exec "syn region p6StringQ matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=".end_group." contained"
|
exec "syn region p6StringQ matchgroup=p6Quote start=\"".start_delim."\" end=\"".end_delim."\" contained"
|
||||||
exec "syn region p6StringQ_q matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_q,".end_group." contained"
|
exec "syn region p6StringQ_q matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_q,".end_group." contained"
|
||||||
exec "syn region p6StringQ_qww matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_q,p6StringSQ,p6StringDQ".end_group." contained"
|
exec "syn region p6StringQ_qww matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_q,p6StringSQ,p6StringDQ".end_group." contained"
|
||||||
exec "syn region p6StringQ_qq matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_qq,".end_group." contained"
|
exec "syn region p6StringQ_qq matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_qq,".end_group." contained"
|
||||||
|
exec "syn region p6StringQ_to matchgroup=p6Quote start=\"".start_delim."\\z([^".end_delim."]\\+\\)".end_delim."\" end=\"^\\s*\\z1$\" contained"
|
||||||
exec "syn region p6StringQ_qto matchgroup=p6Quote start=\"".start_delim."\\z([^".end_delim."]\\+\\)".end_delim."\" skip=\"".skip."\" end=\"^\\s*\\z1$\" contains=@p6Interp_q,".end_group." contained"
|
exec "syn region p6StringQ_qto matchgroup=p6Quote start=\"".start_delim."\\z([^".end_delim."]\\+\\)".end_delim."\" skip=\"".skip."\" end=\"^\\s*\\z1$\" contains=@p6Interp_q,".end_group." contained"
|
||||||
exec "syn region p6StringQ_qqto matchgroup=p6Quote start=\"".start_delim."\\z(\[^".end_delim."]\\+\\)".end_delim."\" skip=\"".skip."\" end=\"^\\s*\\z1$\" contains=@p6Interp_qq,".end_group." contained"
|
exec "syn region p6StringQ_qqto matchgroup=p6Quote start=\"".start_delim."\\z(\[^".end_delim."]\\+\\)".end_delim."\" skip=\"".skip."\" end=\"^\\s*\\z1$\" contains=@p6Interp_qq,".end_group." contained"
|
||||||
|
|
||||||
@@ -513,7 +513,6 @@ syn match p6Key display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Z
|
|||||||
|
|
||||||
" Regexes and grammars
|
" Regexes and grammars
|
||||||
|
|
||||||
syn match p6DeclareRegex display "\%(regex\|rule\|token\)" nextgroup=p6RegexName skipwhite skipempty
|
|
||||||
syn match p6RegexName display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\?" nextgroup=p6RegexBlockCrap skipwhite skipempty contained
|
syn match p6RegexName display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\?" nextgroup=p6RegexBlockCrap skipwhite skipempty contained
|
||||||
syn match p6RegexBlockCrap "[^{]*" nextgroup=p6RegexBlock skipwhite skipempty transparent contained
|
syn match p6RegexBlockCrap "[^{]*" nextgroup=p6RegexBlock skipwhite skipempty transparent contained
|
||||||
|
|
||||||
@@ -724,7 +723,7 @@ syn match p6PackageScope display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\
|
|||||||
" Perl 6 regex regions
|
" Perl 6 regex regions
|
||||||
|
|
||||||
syn match p6MatchStart_m display "\.\@1<!\<\%(mm\?\|rx\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_m
|
syn match p6MatchStart_m display "\.\@1<!\<\%(mm\?\|rx\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_m
|
||||||
syn match p6MatchStart_s display "\.\@1<!\<s\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_s
|
syn match p6MatchStart_s display "\.\@1<!\<[sS]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_s
|
||||||
syn match p6MatchStart_tr display "\.\@1<!\<tr\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_tr
|
syn match p6MatchStart_tr display "\.\@1<!\<tr\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_tr
|
||||||
syn match p6MatchAdverbs_m "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6Match
|
syn match p6MatchAdverbs_m "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6Match
|
||||||
syn match p6MatchAdverbs_s "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6Substitution
|
syn match p6MatchAdverbs_s "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6Substitution
|
||||||
@@ -1100,10 +1099,10 @@ syn region p6BracketComment
|
|||||||
syn match p6Shebang display "\%^#!.*"
|
syn match p6Shebang display "\%^#!.*"
|
||||||
|
|
||||||
" => and p5=> autoquoting
|
" => and p5=> autoquoting
|
||||||
syn match p6StringP5Auto display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\s\+p5=>"
|
syn match p6StringP5Auto display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\s\+p5=>"
|
||||||
syn match p6StringAuto display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\%(p5\)\@2<![RSXZ]\@1<!=>"
|
syn match p6StringAuto display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\%(p5\)\@2<![RSXZ]\@1<!=>"
|
||||||
syn match p6StringAuto display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\s\+=>"
|
syn match p6StringAuto display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\s\+=>"
|
||||||
syn match p6StringAuto display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)p5\ze=>"
|
syn match p6StringAuto display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)p5\ze=>"
|
||||||
|
|
||||||
" Pod
|
" Pod
|
||||||
|
|
||||||
@@ -1759,6 +1758,7 @@ if version >= 508 || !exists("did_perl6_syntax_inits")
|
|||||||
HiLink p6StringQ_q p6String
|
HiLink p6StringQ_q p6String
|
||||||
HiLink p6StringQ_qww p6String
|
HiLink p6StringQ_qww p6String
|
||||||
HiLink p6StringQ_qq p6String
|
HiLink p6StringQ_qq p6String
|
||||||
|
HiLink p6StringQ_to p6String
|
||||||
HiLink p6StringQ_qto p6String
|
HiLink p6StringQ_qto p6String
|
||||||
HiLink p6StringQ_qqto p6String
|
HiLink p6StringQ_qqto p6String
|
||||||
HiLink p6RxStringSQ p6String
|
HiLink p6RxStringSQ p6String
|
||||||
@@ -1796,6 +1796,7 @@ if version >= 508 || !exists("did_perl6_syntax_inits")
|
|||||||
HiLink p6QuoteQ_q p6Quote
|
HiLink p6QuoteQ_q p6Quote
|
||||||
HiLink p6QuoteQ_qww p6Quote
|
HiLink p6QuoteQ_qww p6Quote
|
||||||
HiLink p6QuoteQ_qq p6Quote
|
HiLink p6QuoteQ_qq p6Quote
|
||||||
|
HiLink p6QuoteQ_to p6Quote
|
||||||
HiLink p6QuoteQ_qto p6Quote
|
HiLink p6QuoteQ_qto p6Quote
|
||||||
HiLink p6QuoteQ_qqto p6Quote
|
HiLink p6QuoteQ_qqto p6Quote
|
||||||
HiLink p6QuoteQ_PIR p6Quote
|
HiLink p6QuoteQ_PIR p6Quote
|
||||||
@@ -1875,8 +1876,8 @@ if version >= 508 || !exists("did_perl6_syntax_inits")
|
|||||||
HiLink p6String String
|
HiLink p6String String
|
||||||
HiLink p6Repeat Repeat
|
HiLink p6Repeat Repeat
|
||||||
HiLink p6Pragma Keyword
|
HiLink p6Pragma Keyword
|
||||||
HiLink p6Module Keyword
|
HiLink p6PreDeclare Keyword
|
||||||
HiLink p6DeclareRoutine Keyword
|
HiLink p6Declare Keyword
|
||||||
HiLink p6DeclareRegex Keyword
|
HiLink p6DeclareRegex Keyword
|
||||||
HiLink p6VarStorage Special
|
HiLink p6VarStorage Special
|
||||||
HiLink p6FlowControl Special
|
HiLink p6FlowControl Special
|
||||||
|
|||||||
@@ -458,9 +458,9 @@ syn match rubyKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%([_[:lower:]][_[:aln
|
|||||||
syn match rubyKeywordAsMethod "\(defined?\|exit!\)\@!\<[_[:lower:]][_[:alnum:]]*[?!]" transparent contains=NONE
|
syn match rubyKeywordAsMethod "\(defined?\|exit!\)\@!\<[_[:lower:]][_[:alnum:]]*[?!]" transparent contains=NONE
|
||||||
|
|
||||||
" More Symbols {{{1
|
" 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 "[]})\"':]\@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
|
syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="hs=s+1,he=e-1
|
||||||
|
|
||||||
" __END__ Directive {{{1
|
" __END__ Directive {{{1
|
||||||
|
|||||||
138
syntax/tmux.vim
138
syntax/tmux.vim
@@ -33,15 +33,16 @@ syn keyword tmuxAction any current none
|
|||||||
syn keyword tmuxBoolean off on
|
syn keyword tmuxBoolean off on
|
||||||
|
|
||||||
syn keyword tmuxCmds
|
syn keyword tmuxCmds
|
||||||
\ attach[-session]
|
\ attach
|
||||||
\ bind[-key]
|
\ attach-session
|
||||||
|
\ bind
|
||||||
|
\ bind-key
|
||||||
\ break-pane
|
\ break-pane
|
||||||
\ breakp
|
\ breakp
|
||||||
\ capture-pane
|
\ capture-pane
|
||||||
\ capturep
|
\ capturep
|
||||||
\ choose-buffer
|
\ choose-buffer
|
||||||
\ choose-client
|
\ choose-client
|
||||||
\ choose-list
|
|
||||||
\ choose-session
|
\ choose-session
|
||||||
\ choose-tree
|
\ choose-tree
|
||||||
\ choose-window
|
\ choose-window
|
||||||
@@ -49,124 +50,149 @@ syn keyword tmuxCmds
|
|||||||
\ clearhist
|
\ clearhist
|
||||||
\ clock-mode
|
\ clock-mode
|
||||||
\ command-prompt
|
\ command-prompt
|
||||||
\ confirm[-before]
|
\ confirm
|
||||||
|
\ confirm-before
|
||||||
\ copy-mode
|
\ copy-mode
|
||||||
\ delete-buffer
|
\ delete-buffer
|
||||||
\ deleteb
|
\ deleteb
|
||||||
\ detach[-client]
|
\ detach
|
||||||
\ display[-message]
|
\ detach-client
|
||||||
|
\ display
|
||||||
|
\ display-message
|
||||||
\ display-panes
|
\ display-panes
|
||||||
\ displayp
|
\ displayp
|
||||||
\ find-window
|
\ find-window
|
||||||
\ findw
|
\ findw
|
||||||
\ has[-session]
|
\ has
|
||||||
\ if[-shell]
|
\ has-session
|
||||||
|
\ if
|
||||||
|
\ if-shell
|
||||||
|
\ info
|
||||||
\ join-pane
|
\ join-pane
|
||||||
\ joinp
|
\ joinp
|
||||||
\ kill-pane
|
\ kill-pane
|
||||||
\ killp
|
|
||||||
\ kill-server
|
\ kill-server
|
||||||
\ kill-session
|
\ kill-session
|
||||||
\ kill-window
|
\ kill-window
|
||||||
|
\ killp
|
||||||
\ killw
|
\ killw
|
||||||
|
\ last
|
||||||
\ last-pane
|
\ last-pane
|
||||||
|
\ last-window
|
||||||
\ lastp
|
\ lastp
|
||||||
\ last[-window]
|
|
||||||
\ link-window
|
\ link-window
|
||||||
\ linkw
|
\ linkw
|
||||||
\ list-buffers
|
\ list-buffers
|
||||||
\ lsb
|
|
||||||
\ list-clients
|
\ list-clients
|
||||||
\ lsc
|
|
||||||
\ list-commands
|
\ list-commands
|
||||||
\ lscm
|
|
||||||
\ list-keys
|
\ list-keys
|
||||||
\ lsk
|
|
||||||
\ list-panes
|
\ list-panes
|
||||||
\ lsp
|
|
||||||
\ list-sessions
|
\ list-sessions
|
||||||
\ ls
|
|
||||||
\ list-windows
|
\ list-windows
|
||||||
\ lsw
|
|
||||||
\ load-buffer
|
\ load-buffer
|
||||||
\ loadb
|
\ loadb
|
||||||
|
\ lock
|
||||||
\ lock-client
|
\ lock-client
|
||||||
\ lockc
|
\ lock-server
|
||||||
\ lock[-server]
|
|
||||||
\ lock-session
|
\ lock-session
|
||||||
|
\ lockc
|
||||||
\ locks
|
\ locks
|
||||||
|
\ ls
|
||||||
|
\ lsb
|
||||||
|
\ lsc
|
||||||
|
\ lscm
|
||||||
|
\ lsk
|
||||||
|
\ lsp
|
||||||
|
\ lsw
|
||||||
\ move-pane
|
\ move-pane
|
||||||
\ movep
|
|
||||||
\ move-window
|
\ move-window
|
||||||
|
\ movep
|
||||||
\ movew
|
\ movew
|
||||||
\ new[-session]
|
\ new
|
||||||
|
\ new-session
|
||||||
|
\ new-window
|
||||||
|
\ neww
|
||||||
|
\ next
|
||||||
\ next-layout
|
\ next-layout
|
||||||
|
\ next-window
|
||||||
\ nextl
|
\ nextl
|
||||||
\ next[-window]
|
|
||||||
\ paste-buffer
|
\ paste-buffer
|
||||||
\ pasteb
|
\ pasteb
|
||||||
|
\ path
|
||||||
\ pipe-pane
|
\ pipe-pane
|
||||||
\ pipep
|
\ pipep
|
||||||
|
\ prev
|
||||||
\ previous-layout
|
\ previous-layout
|
||||||
|
\ previous-window
|
||||||
\ prevl
|
\ prevl
|
||||||
\ prev[ious-window]
|
\ refresh
|
||||||
\ refresh[-client]
|
\ refresh-client
|
||||||
\ rename[-session]
|
\ rename
|
||||||
|
\ rename-session
|
||||||
\ rename-window
|
\ rename-window
|
||||||
\ renamew
|
\ renamew
|
||||||
\ resize-pane
|
\ resize-pane
|
||||||
\ resizep
|
\ resizep
|
||||||
\ respawn-pane
|
\ respawn-pane
|
||||||
\ respawnp
|
|
||||||
\ respawn-window
|
\ respawn-window
|
||||||
|
\ respawnp
|
||||||
\ respawnw
|
\ respawnw
|
||||||
\ rotate-window
|
\ rotate-window
|
||||||
\ rotatew
|
\ rotatew
|
||||||
\ run[-shell]
|
\ run
|
||||||
|
\ run-shell
|
||||||
\ save-buffer
|
\ save-buffer
|
||||||
\ saveb
|
\ saveb
|
||||||
\ select-layout
|
\ select-layout
|
||||||
\ selectl
|
|
||||||
\ select-pane
|
\ select-pane
|
||||||
\ selectp
|
|
||||||
\ select-window
|
\ select-window
|
||||||
|
\ selectl
|
||||||
|
\ selectp
|
||||||
\ selectw
|
\ selectw
|
||||||
\ send[-keys]
|
\ send
|
||||||
|
\ send-keys
|
||||||
\ send-prefix
|
\ send-prefix
|
||||||
\ server-info
|
\ server-info
|
||||||
\ info
|
\ set
|
||||||
\ set-buffer
|
\ set-buffer
|
||||||
\ setb
|
|
||||||
\ set-environment
|
\ set-environment
|
||||||
\ setenv
|
\ set-hook
|
||||||
\ set[-option]
|
\ set-option
|
||||||
\ set-window-option
|
\ set-window-option
|
||||||
|
\ setb
|
||||||
|
\ setenv
|
||||||
\ setw
|
\ setw
|
||||||
|
\ show
|
||||||
\ show-buffer
|
\ show-buffer
|
||||||
\ showb
|
|
||||||
\ show-environment
|
\ show-environment
|
||||||
\ showenv
|
\ show-hooks
|
||||||
\ show-messages
|
\ show-messages
|
||||||
\ showmsgs
|
\ show-options
|
||||||
\ show[-options]
|
|
||||||
\ show-window-options
|
\ show-window-options
|
||||||
|
\ showb
|
||||||
|
\ showenv
|
||||||
|
\ showmsgs
|
||||||
\ showw
|
\ showw
|
||||||
\ source[-file]
|
\ source
|
||||||
|
\ source-file
|
||||||
\ split-window
|
\ split-window
|
||||||
\ splitw
|
\ splitw
|
||||||
\ start[-server]
|
\ start
|
||||||
|
\ start-server
|
||||||
\ suspend-client
|
\ suspend-client
|
||||||
\ suspendc
|
\ suspendc
|
||||||
\ swap-pane
|
\ swap-pane
|
||||||
\ swapp
|
|
||||||
\ swap-window
|
\ swap-window
|
||||||
|
\ swapp
|
||||||
\ swapw
|
\ swapw
|
||||||
\ switch-client
|
\ switch-client
|
||||||
\ switchc
|
\ switchc
|
||||||
\ unbind[-key]
|
\ unbind
|
||||||
|
\ unbind-key
|
||||||
\ unlink-window
|
\ unlink-window
|
||||||
\ unlinkw
|
\ unlinkw
|
||||||
\ wait[-for]
|
\ wait
|
||||||
|
\ wait-for
|
||||||
|
|
||||||
syn keyword tmuxOptsSet
|
syn keyword tmuxOptsSet
|
||||||
\ assume-paste-time
|
\ assume-paste-time
|
||||||
@@ -186,19 +212,14 @@ syn keyword tmuxOptsSet
|
|||||||
\ escape-time
|
\ escape-time
|
||||||
\ exit-unattached
|
\ exit-unattached
|
||||||
\ focus-events
|
\ focus-events
|
||||||
|
\ history-file
|
||||||
\ history-limit
|
\ history-limit
|
||||||
\ lock-after-time
|
\ lock-after-time
|
||||||
\ lock-command
|
\ lock-command
|
||||||
\ lock-server
|
|
||||||
\ message-command-style
|
\ message-command-style
|
||||||
\ message-limit
|
\ message-limit
|
||||||
\ message-style
|
\ message-style
|
||||||
\ mouse-resize-pane
|
\ mouse
|
||||||
\ mouse-select-pane
|
|
||||||
\ mouse-select-window
|
|
||||||
\ mouse-utf8
|
|
||||||
\ pane-active-border-style
|
|
||||||
\ pane-border-style
|
|
||||||
\ prefix
|
\ prefix
|
||||||
\ prefix2
|
\ prefix2
|
||||||
\ quiet
|
\ quiet
|
||||||
@@ -218,8 +239,8 @@ syn keyword tmuxOptsSet
|
|||||||
\ status-position
|
\ status-position
|
||||||
\ status-right
|
\ status-right
|
||||||
\ status-right-length
|
\ status-right-length
|
||||||
\ status-utf8
|
\ status-right-style
|
||||||
\ staus-right-style
|
\ status-style
|
||||||
\ terminal-overrides
|
\ terminal-overrides
|
||||||
\ update-environment
|
\ update-environment
|
||||||
\ visual-activity
|
\ visual-activity
|
||||||
@@ -232,8 +253,7 @@ syn keyword tmuxOptsSetw
|
|||||||
\ allow-rename
|
\ allow-rename
|
||||||
\ alternate-screen
|
\ alternate-screen
|
||||||
\ automatic-rename
|
\ automatic-rename
|
||||||
\ c0-change-interval
|
\ automatic-rename-format
|
||||||
\ c0-change-trigger
|
|
||||||
\ clock-mode-colour
|
\ clock-mode-colour
|
||||||
\ clock-mode-style
|
\ clock-mode-style
|
||||||
\ force-height
|
\ force-height
|
||||||
@@ -241,16 +261,17 @@ syn keyword tmuxOptsSetw
|
|||||||
\ main-pane-height
|
\ main-pane-height
|
||||||
\ main-pane-width
|
\ main-pane-width
|
||||||
\ mode-keys
|
\ mode-keys
|
||||||
\ mode-mouse
|
|
||||||
\ mode-style
|
\ mode-style
|
||||||
\ monitor-activity
|
\ monitor-activity
|
||||||
\ monitor-silence
|
\ monitor-silence
|
||||||
\ other-pane-height
|
\ other-pane-height
|
||||||
\ other-pane-width
|
\ other-pane-width
|
||||||
|
\ pane-active-border-style
|
||||||
\ pane-base-index
|
\ pane-base-index
|
||||||
|
\ pane-border-style
|
||||||
\ remain-on-exit
|
\ remain-on-exit
|
||||||
\ synchronize-panes
|
\ synchronize-panes
|
||||||
\ utf8
|
\ window-active-style
|
||||||
\ window-status-activity-style
|
\ window-status-activity-style
|
||||||
\ window-status-bell-style
|
\ window-status-bell-style
|
||||||
\ window-status-current-format
|
\ window-status-current-format
|
||||||
@@ -259,6 +280,7 @@ syn keyword tmuxOptsSetw
|
|||||||
\ window-status-last-style
|
\ window-status-last-style
|
||||||
\ window-status-separator
|
\ window-status-separator
|
||||||
\ window-status-style
|
\ window-status-style
|
||||||
|
\ window-style
|
||||||
\ wrap-search
|
\ wrap-search
|
||||||
\ xterm-keys
|
\ xterm-keys
|
||||||
|
|
||||||
@@ -270,7 +292,9 @@ syn match tmuxOptions /\s-\a\+/ display
|
|||||||
syn match tmuxVariable /\w\+=/ display
|
syn match tmuxVariable /\w\+=/ display
|
||||||
syn match tmuxVariableExpansion /\${\=\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
|
||||||
syn region tmuxString start=/'/ end=/'/ display oneline
|
syn region tmuxString start=/'/ end=/'/ display oneline
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ syntax keyword typescriptBranch break continue yield await
|
|||||||
syntax keyword typescriptLabel case default async
|
syntax keyword typescriptLabel case default async
|
||||||
syntax keyword typescriptStatement return with
|
syntax keyword typescriptStatement return with
|
||||||
|
|
||||||
syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity Math Number NaN Object Packages RegExp String netscape
|
syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity Math Number NaN Object Packages RegExp String Symbol netscape
|
||||||
|
|
||||||
syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ syntax keyword typescriptReserved constructor declare as interface module abstra
|
|||||||
syn match typescriptParameters "([a-zA-Z0-9_?.$][\w?.$]*)\s*:\s*([a-zA-Z0-9_?.$][\w?.$]*)" contained skipwhite
|
syn match typescriptParameters "([a-zA-Z0-9_?.$][\w?.$]*)\s*:\s*([a-zA-Z0-9_?.$][\w?.$]*)" contained skipwhite
|
||||||
"}}}
|
"}}}
|
||||||
" DOM2 Objects"{{{
|
" DOM2 Objects"{{{
|
||||||
syntax keyword typescriptType DOMImplementation DocumentFragment Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction void any string boolean number
|
syntax keyword typescriptType DOMImplementation DocumentFragment Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction void any string boolean number symbol
|
||||||
syntax keyword typescriptExceptions DOMException
|
syntax keyword typescriptExceptions DOMException
|
||||||
"}}}
|
"}}}
|
||||||
" DOM2 CONSTANT"{{{
|
" DOM2 CONSTANT"{{{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:current_syntax = "vimgo"
|
let b:current_syntax = "vimgo"
|
||||||
@@ -12,4 +12,6 @@ syn region goTitle start="\%1l" end=":"
|
|||||||
hi def link goInterface Type
|
hi def link goInterface Type
|
||||||
hi def link goTitle Label
|
hi def link goTitle Label
|
||||||
|
|
||||||
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user