mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 19:43:52 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3019afa721 | ||
|
|
cb574b283f | ||
|
|
b9ce3df4cd | ||
|
|
f028cfae59 | ||
|
|
041ab2d237 | ||
|
|
acd25ccf95 | ||
|
|
7dd62806a0 | ||
|
|
6a823fb3af |
@@ -25,6 +25,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
|
|
||||||
## Language packs
|
## Language packs
|
||||||
|
|
||||||
|
- [applescript](https://github.com/vim-scripts/applescript.vim) (syntax)
|
||||||
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin, ftdetect)
|
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect)
|
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect)
|
||||||
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin, ftdetect)
|
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin, ftdetect)
|
||||||
@@ -56,8 +57,8 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax, ftdetect)
|
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax, ftdetect)
|
||||||
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
|
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
|
||||||
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax, ftdetect)
|
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax, ftdetect)
|
||||||
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftplugin, ftdetect)
|
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftplugin, ftdetect, extras)
|
||||||
- [json](https://github.com/sheerun/vim-json) (syntax, indent, ftdetect)
|
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect)
|
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect)
|
||||||
- [jsx](https://github.com/mxw/vim-jsx) (ftdetect, after)
|
- [jsx](https://github.com/mxw/vim-jsx) (ftdetect, after)
|
||||||
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
|
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
|
||||||
@@ -65,6 +66,8 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
||||||
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin, ftdetect)
|
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin, ftdetect)
|
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin, ftdetect)
|
||||||
|
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||||
|
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
|
||||||
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin, ftdetect)
|
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, ftdetect)
|
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, ftdetect)
|
||||||
- [nginx](https://github.com/othree/nginx-contrib-vim) (syntax, indent, ftdetect)
|
- [nginx](https://github.com/othree/nginx-contrib-vim) (syntax, indent, ftdetect)
|
||||||
|
|||||||
9
build
9
build
@@ -6,6 +6,7 @@ DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/inden
|
|||||||
DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
|
DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
|
||||||
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
|
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
|
||||||
DIRS_SYNTAX="syntax ftdetect after/syntax after/ftdetect"
|
DIRS_SYNTAX="syntax ftdetect after/syntax after/ftdetect"
|
||||||
|
DIRS_JAVASCRIPT="${DIRS} extras"
|
||||||
|
|
||||||
OUTPUT=""
|
OUTPUT=""
|
||||||
|
|
||||||
@@ -75,6 +76,7 @@ copy_dir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
concat_ftdetect() {
|
concat_ftdetect() {
|
||||||
|
cat config.vim >> tmp/polyglot.vim
|
||||||
for f in ftdetect/*; do (echo '" '"$f"; cat "${f}"; echo) >> tmp/polyglot.vim; done
|
for f in ftdetect/*; do (echo '" '"$f"; cat "${f}"; echo) >> tmp/polyglot.vim; done
|
||||||
rm -f ftdetect/*
|
rm -f ftdetect/*
|
||||||
mv tmp/polyglot.vim ftdetect/
|
mv tmp/polyglot.vim ftdetect/
|
||||||
@@ -97,6 +99,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
PACKS="
|
PACKS="
|
||||||
|
applescript:vim-scripts/applescript.vim
|
||||||
ansible:pearofducks/ansible-vim
|
ansible:pearofducks/ansible-vim
|
||||||
arduino:sudar/vim-arduino-syntax
|
arduino:sudar/vim-arduino-syntax
|
||||||
blade:jwalton512/vim-blade
|
blade:jwalton512/vim-blade
|
||||||
@@ -128,8 +131,8 @@ PACKS="
|
|||||||
haxe:yaymukund/vim-haxe
|
haxe:yaymukund/vim-haxe
|
||||||
html5:othree/html5.vim
|
html5:othree/html5.vim
|
||||||
jasmine:glanotte/vim-jasmine
|
jasmine:glanotte/vim-jasmine
|
||||||
javascript:pangloss/vim-javascript
|
javascript:pangloss/vim-javascript:_JAVASCRIPT
|
||||||
json:sheerun/vim-json
|
json:elzr/vim-json
|
||||||
jst:briancollins/vim-jst
|
jst:briancollins/vim-jst
|
||||||
jsx:mxw/vim-jsx:_ALL
|
jsx:mxw/vim-jsx:_ALL
|
||||||
julia:dcjones/julia-minimalist-vim
|
julia:dcjones/julia-minimalist-vim
|
||||||
@@ -137,6 +140,8 @@ PACKS="
|
|||||||
latex:LaTeX-Box-Team/LaTeX-Box
|
latex:LaTeX-Box-Team/LaTeX-Box
|
||||||
less:groenewege/vim-less
|
less:groenewege/vim-less
|
||||||
liquid:tpope/vim-liquid
|
liquid:tpope/vim-liquid
|
||||||
|
livescript:gkz/vim-ls
|
||||||
|
lua:tbastos/vim-lua
|
||||||
mako:sophacles/vim-bundle-mako
|
mako:sophacles/vim-bundle-mako
|
||||||
markdown:plasticboy/vim-markdown:_SYNTAX
|
markdown:plasticboy/vim-markdown:_SYNTAX
|
||||||
nginx:othree/nginx-contrib-vim
|
nginx:othree/nginx-contrib-vim
|
||||||
|
|||||||
78
compiler/ls.vim
Normal file
78
compiler/ls.vim
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
|
||||||
|
|
||||||
|
" Language: LiveScript
|
||||||
|
" Maintainer: George Zahariev
|
||||||
|
" URL: http://github.com/gkz/vim-ls
|
||||||
|
" License: WTFPL
|
||||||
|
|
||||||
|
if exists('current_compiler')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let current_compiler = 'ls'
|
||||||
|
" Pattern to check if livescript is the compiler
|
||||||
|
let s:pat = '^' . current_compiler
|
||||||
|
|
||||||
|
" Path to LiveScript compiler
|
||||||
|
if !exists('livescript_compiler')
|
||||||
|
let livescript_compiler = 'lsc'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('livescript_make_options')
|
||||||
|
let livescript_make_options = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Get a `makeprg` for the current filename. This is needed to support filenames
|
||||||
|
" with spaces and quotes, but also not break generic `make`.
|
||||||
|
function! s:GetMakePrg()
|
||||||
|
return g:livescript_compiler . ' -c ' . g:livescript_make_options . ' $* '
|
||||||
|
\ . fnameescape(expand('%'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
|
||||||
|
function! s:SetMakePrg()
|
||||||
|
if &l:makeprg =~ s:pat
|
||||||
|
let &l:makeprg = s:GetMakePrg()
|
||||||
|
elseif &g:makeprg =~ s:pat
|
||||||
|
let &g:makeprg = s:GetMakePrg()
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Set a dummy compiler so we can check whether to set locally or globally.
|
||||||
|
CompilerSet makeprg=ls
|
||||||
|
call s:SetMakePrg()
|
||||||
|
|
||||||
|
CompilerSet errorformat=%EFailed\ at:\ %f,
|
||||||
|
\%ECan't\ find:\ %f,
|
||||||
|
\%CSyntaxError:\ %m\ on\ line\ %l,
|
||||||
|
\%CError:\ Parse\ error\ on\ line\ %l:\ %m,
|
||||||
|
\%C,%C\ %.%#
|
||||||
|
|
||||||
|
" Compile the current file.
|
||||||
|
command! -bang -bar -nargs=* LiveScriptMake make<bang> <args>
|
||||||
|
|
||||||
|
" Set `makeprg` on rename since we embed the filename in the setting.
|
||||||
|
augroup LiveScriptUpdateMakePrg
|
||||||
|
autocmd!
|
||||||
|
|
||||||
|
" Update `makeprg` if livescript is still the compiler, else stop running this
|
||||||
|
" function.
|
||||||
|
function! s:UpdateMakePrg()
|
||||||
|
if !s:SetMakePrg()
|
||||||
|
autocmd! LiveScriptUpdateMakePrg
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Set autocmd locally if compiler was set locally.
|
||||||
|
if &l:makeprg =~ s:pat
|
||||||
|
autocmd BufFilePost,BufWritePost <buffer> call s:UpdateMakePrg()
|
||||||
|
else
|
||||||
|
autocmd BufFilePost,BufWritePost call s:UpdateMakePrg()
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
endif
|
||||||
9
config.vim
Normal file
9
config.vim
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
" Enable jsx syntax by default
|
||||||
|
if !exists('g:jsx_ext_required')
|
||||||
|
let g:jsx_ext_required = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Disable json concealing by default
|
||||||
|
if !exists('g:vim_json_syntax_conceal')
|
||||||
|
let g:vim_json_syntax_conceal = 0
|
||||||
|
endif
|
||||||
230
extras/flow.vim
Normal file
230
extras/flow.vim
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
||||||
|
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
||||||
|
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
||||||
|
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
||||||
|
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
||||||
|
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
||||||
|
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
||||||
|
syntax keyword jsFlowDeclareKeyword contained declare
|
||||||
|
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
||||||
|
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
||||||
|
syntax match jsFlowNoise contained /[:;,<>]/
|
||||||
|
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
||||||
|
syntax keyword jsFlowStorageClass contained const var let
|
||||||
|
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
||||||
|
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsFlow PreProc
|
||||||
|
HiLink jsFlowReturn PreProc
|
||||||
|
HiLink jsFlowArray PreProc
|
||||||
|
HiLink jsFlowDeclareBlock PreProc
|
||||||
|
HiLink jsFlowObject PreProc
|
||||||
|
HiLink jsFlowParenRegion PreProc
|
||||||
|
HiLink jsFlowClass PreProc
|
||||||
|
HiLink jsFlowTypeObject PreProc
|
||||||
|
HiLink jsFlowTypeKey PreProc
|
||||||
|
HiLink jsFlowTypeValue PreProc
|
||||||
|
HiLink jsFlowClassProperty jsClassProperty
|
||||||
|
HiLink jsFlowType Type
|
||||||
|
HiLink jsFlowDeclareKeyword Type
|
||||||
|
HiLink jsFlowNoise Noise
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
||||||
|
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
||||||
|
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
||||||
|
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
||||||
|
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
||||||
|
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
||||||
|
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
||||||
|
syntax keyword jsFlowDeclareKeyword contained declare
|
||||||
|
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
||||||
|
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
||||||
|
syntax match jsFlowNoise contained /[:;,<>]/
|
||||||
|
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
||||||
|
syntax keyword jsFlowStorageClass contained const var let
|
||||||
|
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
||||||
|
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsFlow PreProc
|
||||||
|
HiLink jsFlowReturn PreProc
|
||||||
|
HiLink jsFlowArray PreProc
|
||||||
|
HiLink jsFlowDeclareBlock PreProc
|
||||||
|
HiLink jsFlowObject PreProc
|
||||||
|
HiLink jsFlowParenRegion PreProc
|
||||||
|
HiLink jsFlowClass PreProc
|
||||||
|
HiLink jsFlowTypeObject PreProc
|
||||||
|
HiLink jsFlowTypeKey PreProc
|
||||||
|
HiLink jsFlowTypeValue PreProc
|
||||||
|
HiLink jsFlowClassProperty jsClassProperty
|
||||||
|
HiLink jsFlowType Type
|
||||||
|
HiLink jsFlowDeclareKeyword Type
|
||||||
|
HiLink jsFlowNoise Noise
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
||||||
|
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
||||||
|
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
||||||
|
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
||||||
|
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
||||||
|
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
||||||
|
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
||||||
|
syntax keyword jsFlowDeclareKeyword contained declare
|
||||||
|
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
||||||
|
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
||||||
|
syntax match jsFlowNoise contained /[:;,<>]/
|
||||||
|
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
||||||
|
syntax keyword jsFlowStorageClass contained const var let
|
||||||
|
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
||||||
|
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsFlow PreProc
|
||||||
|
HiLink jsFlowReturn PreProc
|
||||||
|
HiLink jsFlowArray PreProc
|
||||||
|
HiLink jsFlowDeclareBlock PreProc
|
||||||
|
HiLink jsFlowObject PreProc
|
||||||
|
HiLink jsFlowParenRegion PreProc
|
||||||
|
HiLink jsFlowClass PreProc
|
||||||
|
HiLink jsFlowTypeObject PreProc
|
||||||
|
HiLink jsFlowTypeKey PreProc
|
||||||
|
HiLink jsFlowTypeValue PreProc
|
||||||
|
HiLink jsFlowClassProperty jsClassProperty
|
||||||
|
HiLink jsFlowType Type
|
||||||
|
HiLink jsFlowDeclareKeyword Type
|
||||||
|
HiLink jsFlowNoise Noise
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
||||||
|
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
||||||
|
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
||||||
|
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
||||||
|
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
||||||
|
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
||||||
|
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
||||||
|
syntax keyword jsFlowDeclareKeyword contained declare
|
||||||
|
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
||||||
|
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
||||||
|
syntax match jsFlowNoise contained /[:;,<>]/
|
||||||
|
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
||||||
|
syntax keyword jsFlowStorageClass contained const var let
|
||||||
|
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
||||||
|
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsFlow PreProc
|
||||||
|
HiLink jsFlowReturn PreProc
|
||||||
|
HiLink jsFlowArray PreProc
|
||||||
|
HiLink jsFlowDeclareBlock PreProc
|
||||||
|
HiLink jsFlowObject PreProc
|
||||||
|
HiLink jsFlowParenRegion PreProc
|
||||||
|
HiLink jsFlowClass PreProc
|
||||||
|
HiLink jsFlowTypeObject PreProc
|
||||||
|
HiLink jsFlowTypeKey PreProc
|
||||||
|
HiLink jsFlowTypeValue PreProc
|
||||||
|
HiLink jsFlowClassProperty jsClassProperty
|
||||||
|
HiLink jsFlowType Type
|
||||||
|
HiLink jsFlowDeclareKeyword Type
|
||||||
|
HiLink jsFlowNoise Noise
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
||||||
|
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
||||||
|
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
||||||
|
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
||||||
|
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
||||||
|
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
||||||
|
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
||||||
|
syntax keyword jsFlowDeclareKeyword contained declare
|
||||||
|
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
||||||
|
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
||||||
|
syntax match jsFlowNoise contained /[:;,<>]/
|
||||||
|
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
||||||
|
syntax keyword jsFlowStorageClass contained const var let
|
||||||
|
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
||||||
|
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsFlow PreProc
|
||||||
|
HiLink jsFlowReturn PreProc
|
||||||
|
HiLink jsFlowArray PreProc
|
||||||
|
HiLink jsFlowDeclareBlock PreProc
|
||||||
|
HiLink jsFlowObject PreProc
|
||||||
|
HiLink jsFlowParenRegion PreProc
|
||||||
|
HiLink jsFlowClass PreProc
|
||||||
|
HiLink jsFlowTypeObject PreProc
|
||||||
|
HiLink jsFlowTypeKey PreProc
|
||||||
|
HiLink jsFlowTypeValue PreProc
|
||||||
|
HiLink jsFlowClassProperty jsClassProperty
|
||||||
|
HiLink jsFlowType Type
|
||||||
|
HiLink jsFlowDeclareKeyword Type
|
||||||
|
HiLink jsFlowNoise Noise
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
215
extras/jsdoc.vim
Normal file
215
extras/jsdoc.vim
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
"" syntax coloring for javadoc comments (HTML)
|
||||||
|
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
||||||
|
|
||||||
|
" tags containing a param
|
||||||
|
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
||||||
|
" tags containing type and param
|
||||||
|
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
||||||
|
" tags containing type but no param
|
||||||
|
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||||
|
" tags containing references
|
||||||
|
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
||||||
|
" other tags (no extra syntax)
|
||||||
|
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
||||||
|
|
||||||
|
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
||||||
|
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
||||||
|
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
||||||
|
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
||||||
|
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsDocTags Special
|
||||||
|
HiLink jsDocSeeTag Function
|
||||||
|
HiLink jsDocType Type
|
||||||
|
HiLink jsDocTypeBrackets jsDocType
|
||||||
|
HiLink jsDocTypeRecord jsDocType
|
||||||
|
HiLink jsDocTypeNoParam Type
|
||||||
|
HiLink jsDocParam Label
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
"" syntax coloring for javadoc comments (HTML)
|
||||||
|
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
||||||
|
|
||||||
|
" tags containing a param
|
||||||
|
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
||||||
|
" tags containing type and param
|
||||||
|
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
||||||
|
" tags containing type but no param
|
||||||
|
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||||
|
" tags containing references
|
||||||
|
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
||||||
|
" other tags (no extra syntax)
|
||||||
|
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
||||||
|
|
||||||
|
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
||||||
|
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
||||||
|
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
||||||
|
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
||||||
|
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsDocTags Special
|
||||||
|
HiLink jsDocSeeTag Function
|
||||||
|
HiLink jsDocType Type
|
||||||
|
HiLink jsDocTypeBrackets jsDocType
|
||||||
|
HiLink jsDocTypeRecord jsDocType
|
||||||
|
HiLink jsDocTypeNoParam Type
|
||||||
|
HiLink jsDocParam Label
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
"" syntax coloring for javadoc comments (HTML)
|
||||||
|
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
||||||
|
|
||||||
|
" tags containing a param
|
||||||
|
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
||||||
|
" tags containing type and param
|
||||||
|
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
||||||
|
" tags containing type but no param
|
||||||
|
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||||
|
" tags containing references
|
||||||
|
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
||||||
|
" other tags (no extra syntax)
|
||||||
|
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
||||||
|
|
||||||
|
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
||||||
|
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
||||||
|
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
||||||
|
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
||||||
|
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsDocTags Special
|
||||||
|
HiLink jsDocSeeTag Function
|
||||||
|
HiLink jsDocType Type
|
||||||
|
HiLink jsDocTypeBrackets jsDocType
|
||||||
|
HiLink jsDocTypeRecord jsDocType
|
||||||
|
HiLink jsDocTypeNoParam Type
|
||||||
|
HiLink jsDocParam Label
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
"" syntax coloring for javadoc comments (HTML)
|
||||||
|
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
||||||
|
|
||||||
|
" tags containing a param
|
||||||
|
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
||||||
|
" tags containing type and param
|
||||||
|
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
||||||
|
" tags containing type but no param
|
||||||
|
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||||
|
" tags containing references
|
||||||
|
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
||||||
|
" other tags (no extra syntax)
|
||||||
|
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
||||||
|
|
||||||
|
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
||||||
|
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
||||||
|
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
||||||
|
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
||||||
|
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsDocTags Special
|
||||||
|
HiLink jsDocSeeTag Function
|
||||||
|
HiLink jsDocType Type
|
||||||
|
HiLink jsDocTypeBrackets jsDocType
|
||||||
|
HiLink jsDocTypeRecord jsDocType
|
||||||
|
HiLink jsDocTypeNoParam Type
|
||||||
|
HiLink jsDocParam Label
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
"" syntax coloring for javadoc comments (HTML)
|
||||||
|
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
||||||
|
|
||||||
|
" tags containing a param
|
||||||
|
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
||||||
|
" tags containing type and param
|
||||||
|
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
||||||
|
" tags containing type but no param
|
||||||
|
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||||
|
" tags containing references
|
||||||
|
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
||||||
|
" other tags (no extra syntax)
|
||||||
|
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
||||||
|
|
||||||
|
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
||||||
|
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
||||||
|
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
||||||
|
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
||||||
|
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsDocTags Special
|
||||||
|
HiLink jsDocSeeTag Function
|
||||||
|
HiLink jsDocType Type
|
||||||
|
HiLink jsDocTypeBrackets jsDocType
|
||||||
|
HiLink jsDocTypeRecord jsDocType
|
||||||
|
HiLink jsDocTypeNoParam Type
|
||||||
|
HiLink jsDocParam Label
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
35
extras/ngdoc.vim
Normal file
35
extras/ngdoc.vim
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,3 +1,12 @@
|
|||||||
|
" Enable jsx syntax by default
|
||||||
|
if !exists('g:jsx_ext_required')
|
||||||
|
let g:jsx_ext_required = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Disable json concealing by default
|
||||||
|
if !exists('g:vim_json_syntax_conceal')
|
||||||
|
let g:vim_json_syntax_conceal = 0
|
||||||
|
endif
|
||||||
" ftdetect/ansible.vim
|
" ftdetect/ansible.vim
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||||
|
|
||||||
@@ -400,8 +409,9 @@ endif
|
|||||||
" ftdetect/json.vim
|
" ftdetect/json.vim
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead *.json set filetype=json
|
autocmd BufNewFile,BufRead *.json setlocal filetype=json
|
||||||
autocmd BufNewFile,BufRead *.jsonp set filetype=json
|
autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
|
||||||
|
autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -465,6 +475,19 @@ au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liq
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" ftdetect/ls.vim
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
|
||||||
|
|
||||||
|
" Language: LiveScript
|
||||||
|
" Maintainer: George Zahariev
|
||||||
|
" URL: http://github.com/gkz/vim-ls
|
||||||
|
" License: WTFPL
|
||||||
|
"
|
||||||
|
autocmd BufNewFile,BufRead *.ls set filetype=ls
|
||||||
|
autocmd BufNewFile,BufRead *Slakefile set filetype=ls
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
" ftdetect/mako.vim
|
" ftdetect/mako.vim
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
|
||||||
|
|
||||||
|
|||||||
42
ftplugin/json.vim
Normal file
42
ftplugin/json.vim
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: JSON
|
||||||
|
" Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
|
||||||
|
" Last Change: 2014-05-20 added warning toggle
|
||||||
|
|
||||||
|
"uncomment to enable folding of `{...}` and `[...]` blocks
|
||||||
|
"setlocal foldmethod=syntax
|
||||||
|
|
||||||
|
"conceal by default
|
||||||
|
if !exists("g:vim_json_syntax_conceal")
|
||||||
|
let g:vim_json_syntax_conceal = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
"have warnings by default
|
||||||
|
if !exists("g:vim_json_warnings")
|
||||||
|
let g:vim_json_warnings = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
"set concealcursor blank by default
|
||||||
|
"this should turn off the concealing in the current line (where the cursor is at),
|
||||||
|
"on all modes (normal, visual, insert)
|
||||||
|
if !exists("g:vim_json_syntax_concealcursor")
|
||||||
|
let g:vim_json_syntax_concealcursor = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
if has('conceal')
|
||||||
|
if (g:vim_json_syntax_conceal == 1)
|
||||||
|
"level 2 means concealed text gets completely hidden unless a
|
||||||
|
"replacement is defined (none is defined by us)
|
||||||
|
setlocal conceallevel=2
|
||||||
|
let &l:concealcursor = g:vim_json_syntax_concealcursor
|
||||||
|
else
|
||||||
|
"level 0 means text is shown normally = no concealing
|
||||||
|
setlocal conceallevel=0
|
||||||
|
endif
|
||||||
|
"maybe g:vim_json_syntax_conceal could be settable to 0,1,2 to map
|
||||||
|
"directly to vim's conceallevels? unsure if anyone cares
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
208
ftplugin/ls.vim
Normal file
208
ftplugin/ls.vim
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
|
||||||
|
|
||||||
|
" Language: LiveScript
|
||||||
|
" Maintainer: George Zahariev
|
||||||
|
" URL: http://github.com/gkz/vim-ls
|
||||||
|
" License: WTFPL
|
||||||
|
"
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal formatoptions-=t formatoptions+=croql
|
||||||
|
setlocal comments=:#
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
setlocal omnifunc=javascriptcomplete#CompleteJS
|
||||||
|
|
||||||
|
" Enable LiveScriptMake if it won't overwrite any settings.
|
||||||
|
if !len(&l:makeprg)
|
||||||
|
compiler ls
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Check here too in case the compiler above isn't loaded.
|
||||||
|
if !exists('livescript_compiler')
|
||||||
|
let livescript_compiler = 'lsc'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Reset the LiveScriptCompile variables for the current buffer.
|
||||||
|
function! s:LiveScriptCompileResetVars()
|
||||||
|
" Compiled output buffer
|
||||||
|
let b:livescript_compile_buf = -1
|
||||||
|
let b:livescript_compile_pos = []
|
||||||
|
|
||||||
|
" If LiveScriptCompile is watching a buffer
|
||||||
|
let b:livescript_compile_watch = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Clean things up in the source buffer.
|
||||||
|
function! s:LiveScriptCompileClose()
|
||||||
|
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
|
||||||
|
silent! autocmd! LiveScriptCompileAuWatch * <buffer>
|
||||||
|
call s:LiveScriptCompileResetVars()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Update the LiveScriptCompile buffer given some input lines.
|
||||||
|
function! s:LiveScriptCompileUpdate(startline, endline)
|
||||||
|
let input = join(getline(a:startline, a:endline), "\n")
|
||||||
|
|
||||||
|
" Move to the LiveScriptCompile buffer.
|
||||||
|
exec bufwinnr(b:livescript_compile_buf) 'wincmd w'
|
||||||
|
|
||||||
|
" LiveScript doesn't like empty input.
|
||||||
|
if !len(input)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Compile input.
|
||||||
|
let output = system(g:livescript_compiler . ' -scb 2>&1', input)
|
||||||
|
|
||||||
|
" Be sure we're in the LiveScriptCompile buffer before overwriting.
|
||||||
|
if exists('b:livescript_compile_buf')
|
||||||
|
echoerr 'LiveScriptCompile buffers are messed up'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Replace buffer contents with new output and delete the last empty line.
|
||||||
|
setlocal modifiable
|
||||||
|
exec '% delete _'
|
||||||
|
put! =output
|
||||||
|
exec '$ delete _'
|
||||||
|
setlocal nomodifiable
|
||||||
|
|
||||||
|
" Highlight as JavaScript if there is no compile error.
|
||||||
|
if v:shell_error
|
||||||
|
setlocal filetype=
|
||||||
|
else
|
||||||
|
setlocal filetype=javascript
|
||||||
|
endif
|
||||||
|
|
||||||
|
call setpos('.', b:livescript_compile_pos)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Update the LiveScriptCompile buffer with the whole source buffer.
|
||||||
|
function! s:LiveScriptCompileWatchUpdate()
|
||||||
|
call s:LiveScriptCompileUpdate(1, '$')
|
||||||
|
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Peek at compiled LiveScript in a scratch buffer. We handle ranges like this
|
||||||
|
" to prevent the cursor from being moved (and its position saved) before the
|
||||||
|
" function is called.
|
||||||
|
function! s:LiveScriptCompile(startline, endline, args)
|
||||||
|
if !executable(g:livescript_compiler)
|
||||||
|
echoerr "Can't find LiveScript compiler `" . g:livescript_compiler . "`"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If in the LiveScriptCompile buffer, switch back to the source buffer and
|
||||||
|
" continue.
|
||||||
|
if !exists('b:livescript_compile_buf')
|
||||||
|
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Parse arguments.
|
||||||
|
let watch = a:args =~ '\<watch\>'
|
||||||
|
let unwatch = a:args =~ '\<unwatch\>'
|
||||||
|
let size = str2nr(matchstr(a:args, '\<\d\+\>'))
|
||||||
|
|
||||||
|
" Determine default split direction.
|
||||||
|
if exists('g:livescript_compile_vert')
|
||||||
|
let vert = 1
|
||||||
|
else
|
||||||
|
let vert = a:args =~ '\<vert\%[ical]\>'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Remove any watch listeners.
|
||||||
|
silent! autocmd! LiveScriptCompileAuWatch * <buffer>
|
||||||
|
|
||||||
|
" If just unwatching, don't compile.
|
||||||
|
if unwatch
|
||||||
|
let b:livescript_compile_watch = 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if watch
|
||||||
|
let b:livescript_compile_watch = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Build the LiveScriptCompile buffer if it doesn't exist.
|
||||||
|
if bufwinnr(b:livescript_compile_buf) == -1
|
||||||
|
let src_buf = bufnr('%')
|
||||||
|
let src_win = bufwinnr(src_buf)
|
||||||
|
|
||||||
|
" Create the new window and resize it.
|
||||||
|
if vert
|
||||||
|
let width = size ? size : winwidth(src_win) / 2
|
||||||
|
|
||||||
|
belowright vertical new
|
||||||
|
exec 'vertical resize' width
|
||||||
|
else
|
||||||
|
" Try to guess the compiled output's height.
|
||||||
|
let height = size ? size : min([winheight(src_win) / 2,
|
||||||
|
\ a:endline - a:startline + 5])
|
||||||
|
|
||||||
|
belowright new
|
||||||
|
exec 'resize' height
|
||||||
|
endif
|
||||||
|
|
||||||
|
" We're now in the scratch buffer, so set it up.
|
||||||
|
setlocal bufhidden=wipe buftype=nofile
|
||||||
|
setlocal nobuflisted nomodifiable noswapfile nowrap
|
||||||
|
|
||||||
|
autocmd BufWipeout <buffer> call s:LiveScriptCompileClose()
|
||||||
|
" Save the cursor when leaving the LiveScriptCompile buffer.
|
||||||
|
autocmd BufLeave <buffer> let b:livescript_compile_pos = getpos('.')
|
||||||
|
|
||||||
|
nnoremap <buffer> <silent> q :hide<CR>
|
||||||
|
|
||||||
|
let b:livescript_compile_src_buf = src_buf
|
||||||
|
let buf = bufnr('%')
|
||||||
|
|
||||||
|
" Go back to the source buffer and set it up.
|
||||||
|
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
|
||||||
|
let b:livescript_compile_buf = buf
|
||||||
|
endif
|
||||||
|
|
||||||
|
if b:livescript_compile_watch
|
||||||
|
call s:LiveScriptCompileWatchUpdate()
|
||||||
|
|
||||||
|
augroup LiveScriptCompileAuWatch
|
||||||
|
autocmd InsertLeave <buffer> call s:LiveScriptCompileWatchUpdate()
|
||||||
|
autocmd BufWritePost <buffer> call s:LiveScriptCompileWatchUpdate()
|
||||||
|
augroup END
|
||||||
|
else
|
||||||
|
call s:LiveScriptCompileUpdate(a:startline, a:endline)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Complete arguments for the LiveScriptCompile command.
|
||||||
|
function! s:LiveScriptCompileComplete(arg, cmdline, cursor)
|
||||||
|
let args = ['unwatch', 'vertical', 'watch']
|
||||||
|
|
||||||
|
if !len(a:arg)
|
||||||
|
return args
|
||||||
|
endif
|
||||||
|
|
||||||
|
let match = '^' . a:arg
|
||||||
|
|
||||||
|
for arg in args
|
||||||
|
if arg =~ match
|
||||||
|
return [arg]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Don't overwrite the CoffeeCompile variables.
|
||||||
|
if !exists("s:livescript_compile_buf")
|
||||||
|
call s:LiveScriptCompileResetVars()
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Peek at compiled LiveScript.
|
||||||
|
command! -range=% -bar -nargs=* -complete=customlist,s:LiveScriptCompileComplete
|
||||||
|
\ LiveScriptCompile call s:LiveScriptCompile(<line1>, <line2>, <q-args>)
|
||||||
|
" Run some LiveScript.
|
||||||
|
command! -range=% -bar LiveScriptRun <line1>,<line2>:w !lsc -sp
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -44,7 +44,7 @@ let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)
|
|||||||
|
|
||||||
" Check if the character at lnum:col is inside a string.
|
" Check if the character at lnum:col is inside a string.
|
||||||
function s:IsInString(lnum, col)
|
function s:IsInString(lnum, col)
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') == jsonString
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') == "jsonString"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find line above 'lnum' that isn't empty, or in a string.
|
" Find line above 'lnum' that isn't empty, or in a string.
|
||||||
@@ -143,7 +143,11 @@ function GetJSONIndent()
|
|||||||
|
|
||||||
" 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)
|
||||||
|
" if exists('*shiftwidth')
|
||||||
" return indent(lnum) + shiftwidth()
|
" return indent(lnum) + shiftwidth()
|
||||||
|
" else
|
||||||
|
" return indent(lnum) + &sw
|
||||||
|
" endif
|
||||||
" endif
|
" endif
|
||||||
|
|
||||||
" If the previous line contained an opening bracket, and we are still in it,
|
" If the previous line contained an opening bracket, and we are still in it,
|
||||||
@@ -151,7 +155,11 @@ function GetJSONIndent()
|
|||||||
if line =~ '[[({]'
|
if line =~ '[[({]'
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
let counts = s:LineHasOpeningBrackets(lnum)
|
||||||
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
|
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
|
||||||
|
if exists('*shiftwidth')
|
||||||
return ind + shiftwidth()
|
return ind + shiftwidth()
|
||||||
|
else
|
||||||
|
return ind + &sw
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
call cursor(v:lnum, vcol)
|
call cursor(v:lnum, vcol)
|
||||||
end
|
end
|
||||||
|
|||||||
268
indent/ls.vim
Normal file
268
indent/ls.vim
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
|
||||||
|
|
||||||
|
" Language: LiveScript
|
||||||
|
" Maintainer: George Zahariev
|
||||||
|
" URL: http://github.com/gkz/vim-ls
|
||||||
|
" License: WTFPL
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal indentexpr=GetLiveScriptIndent(v:lnum)
|
||||||
|
" Make sure GetLiveScriptIndent is run when these are typed so they can be
|
||||||
|
" indented or outdented.
|
||||||
|
setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*GetLiveScriptIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Keywords to indent after
|
||||||
|
let s:INDENT_AFTER_KEYWORD = '^\%(if\|unless\|else\|for\|while\|until\|'
|
||||||
|
\ . 'loop\|case\|default\|try\|catch\|finally\|'
|
||||||
|
\ . 'class\|do\|new\|let\|with\|function\)\>'
|
||||||
|
|
||||||
|
" Operators to indent after
|
||||||
|
let s:INDENT_AFTER_OPERATOR = '\%([([{:=]\|[-=]>\)$'
|
||||||
|
|
||||||
|
" Keywords and operators that continue a line
|
||||||
|
let s:CONTINUATION = '\<\%(is\|isnt\|and\|or\|do\)\>$'
|
||||||
|
\ . '\|'
|
||||||
|
\ . '\%(-\@<!-\|+\@<!+\|<\|[-~]\@<!>\|\*\|/\@<!/\|%\||\|'
|
||||||
|
\ . '&\|,\|\.\@<!\.\)$'
|
||||||
|
|
||||||
|
" Operators that block continuation indenting
|
||||||
|
let s:CONTINUATION_BLOCK = '[([{:=]$'
|
||||||
|
|
||||||
|
" A continuation dot access
|
||||||
|
let s:DOT_ACCESS = '^\.'
|
||||||
|
|
||||||
|
" Keywords to outdent after
|
||||||
|
let s:OUTDENT_AFTER = '^\%(return\|break\|continue\|throw\)\>'
|
||||||
|
|
||||||
|
" A compound assignment like `... = if ...`
|
||||||
|
let s:COMPOUND_ASSIGNMENT = '[:=]\s*\%(if\|unless\|for\|while\|until\|'
|
||||||
|
\ . 'try\|class\|do\|new\|let\|with\)\>'
|
||||||
|
|
||||||
|
" A postfix condition like `return ... if ...`.
|
||||||
|
let s:POSTFIX_CONDITION = '\S\s\+\zs\<\%(if\|unless\)\>'
|
||||||
|
|
||||||
|
" A single-line else statement like `else ...` but not `else if ...
|
||||||
|
let s:SINGLE_LINE_ELSE = '^else\s\+\%(\<\%(if\|unless\)\>\)\@!'
|
||||||
|
|
||||||
|
" Max lines to look back for a match
|
||||||
|
let s:MAX_LOOKBACK = 50
|
||||||
|
|
||||||
|
" Get the linked syntax name of a character.
|
||||||
|
function! s:SyntaxName(linenum, col)
|
||||||
|
return synIDattr(synIDtrans(synID(a:linenum, a:col, 1)), 'name')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a character is in a comment.
|
||||||
|
function! s:IsComment(linenum, col)
|
||||||
|
return s:SyntaxName(a:linenum, a:col) == 'Comment'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a character is in a string.
|
||||||
|
function! s:IsString(linenum, col)
|
||||||
|
return s:SyntaxName(a:linenum, a:col) == 'Constant'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a character is in a comment or string.
|
||||||
|
function! s:IsCommentOrString(linenum, col)
|
||||||
|
return s:SyntaxName(a:linenum, a:col) =~ 'Comment\|Constant'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a whole line is a comment.
|
||||||
|
function! s:IsCommentLine(linenum)
|
||||||
|
" Check the first non-whitespace character.
|
||||||
|
return s:IsComment(a:linenum, indent(a:linenum) + 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Repeatedly search a line for a regex until one is found outside a string or
|
||||||
|
" comment.
|
||||||
|
function! s:SmartSearch(linenum, regex)
|
||||||
|
" Start at the first column.
|
||||||
|
let col = 0
|
||||||
|
|
||||||
|
" Search until there are no more matches, unless a good match is found.
|
||||||
|
while 1
|
||||||
|
call cursor(a:linenum, col + 1)
|
||||||
|
let [_, col] = searchpos(a:regex, 'cn', a:linenum)
|
||||||
|
|
||||||
|
" No more matches.
|
||||||
|
if !col
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !s:IsCommentOrString(a:linenum, col)
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
" No good match found.
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Skip a match if it's in a comment or string, is a single-line statement that
|
||||||
|
" isn't adjacent, or is a postfix condition.
|
||||||
|
function! s:ShouldSkip(startlinenum, linenum, col)
|
||||||
|
if s:IsCommentOrString(a:linenum, a:col)
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Check for a single-line statement that isn't adjacent.
|
||||||
|
if s:SmartSearch(a:linenum, '\<then\>') && a:startlinenum - a:linenum > 1
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:SmartSearch(a:linenum, s:POSTFIX_CONDITION) &&
|
||||||
|
\ !s:SmartSearch(a:linenum, s:COMPOUND_ASSIGNMENT)
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find the farthest line to look back to, capped to line 1 (zero and negative
|
||||||
|
" numbers cause bad things).
|
||||||
|
function! s:MaxLookback(startlinenum)
|
||||||
|
return max([1, a:startlinenum - s:MAX_LOOKBACK])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the skip expression for searchpair().
|
||||||
|
function! s:SkipExpr(startlinenum)
|
||||||
|
return "s:ShouldSkip(" . a:startlinenum . ", line('.'), col('.'))"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Search for pairs of text.
|
||||||
|
function! s:SearchPair(start, end)
|
||||||
|
" The cursor must be in the first column for regexes to match.
|
||||||
|
call cursor(0, 1)
|
||||||
|
|
||||||
|
let startlinenum = line('.')
|
||||||
|
|
||||||
|
" Don't need the W flag since MaxLookback caps the search to line 1.
|
||||||
|
return searchpair(a:start, '', a:end, 'bcn',
|
||||||
|
\ s:SkipExpr(startlinenum),
|
||||||
|
\ s:MaxLookback(startlinenum))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Try to find a previous matching line.
|
||||||
|
function! s:GetMatch(curline)
|
||||||
|
let firstchar = a:curline[0]
|
||||||
|
|
||||||
|
if firstchar == '}'
|
||||||
|
return s:SearchPair('{', '}')
|
||||||
|
elseif firstchar == ')'
|
||||||
|
return s:SearchPair('(', ')')
|
||||||
|
elseif firstchar == ']'
|
||||||
|
return s:SearchPair('\[', '\]')
|
||||||
|
elseif a:curline =~ '^else\>'
|
||||||
|
return s:SearchPair('\<\%(if\|unless\|case\|when\)\>', '\<else\>')
|
||||||
|
elseif a:curline =~ '^catch\>'
|
||||||
|
return s:SearchPair('\<try\>', '\<catch\>')
|
||||||
|
elseif a:curline =~ '^finally\>'
|
||||||
|
return s:SearchPair('\<try\>', '\<finally\>')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the nearest previous line that isn't a comment.
|
||||||
|
function! s:GetPrevNormalLine(startlinenum)
|
||||||
|
let curlinenum = a:startlinenum
|
||||||
|
|
||||||
|
while curlinenum > 0
|
||||||
|
let curlinenum = prevnonblank(curlinenum - 1)
|
||||||
|
|
||||||
|
if !s:IsCommentLine(curlinenum)
|
||||||
|
return curlinenum
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the contents of a line without leading or trailing whitespace.
|
||||||
|
function! s:GetTrimmedLine(linenum)
|
||||||
|
return substitute(substitute(getline(a:linenum), '^\s\+', '', ''),
|
||||||
|
\ '\s\+$', '', '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:GetLiveScriptIndent(curlinenum)
|
||||||
|
let prevlinenum = s:GetPrevNormalLine(a:curlinenum)
|
||||||
|
|
||||||
|
" Don't do anything if there's no previous line.
|
||||||
|
if !prevlinenum
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let curline = s:GetTrimmedLine(a:curlinenum)
|
||||||
|
|
||||||
|
" Try to find a previous matching statement. This handles outdenting.
|
||||||
|
let matchlinenum = s:GetMatch(curline)
|
||||||
|
|
||||||
|
if matchlinenum
|
||||||
|
return indent(matchlinenum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let prevline = s:GetTrimmedLine(prevlinenum)
|
||||||
|
let previndent = indent(prevlinenum)
|
||||||
|
|
||||||
|
" Always indent after these operators.
|
||||||
|
if prevline =~ s:INDENT_AFTER_OPERATOR
|
||||||
|
return previndent + &shiftwidth
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent after a continuation if it's the first.
|
||||||
|
if prevline =~ s:CONTINUATION
|
||||||
|
let prevprevlinenum = s:GetPrevNormalLine(prevlinenum)
|
||||||
|
let prevprevline = s:GetTrimmedLine(prevprevlinenum)
|
||||||
|
|
||||||
|
if prevprevline !~ s:CONTINUATION && prevprevline !~ s:CONTINUATION_BLOCK
|
||||||
|
return previndent + &shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent after these keywords and compound assignments if they aren't a
|
||||||
|
" single-line statement.
|
||||||
|
if prevline =~ s:INDENT_AFTER_KEYWORD || prevline =~ s:COMPOUND_ASSIGNMENT
|
||||||
|
if !s:SmartSearch(prevlinenum, '\<then\>') && prevline !~ s:SINGLE_LINE_ELSE
|
||||||
|
return previndent + &shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent a dot access if it's the first.
|
||||||
|
if curline =~ s:DOT_ACCESS && prevline !~ s:DOT_ACCESS
|
||||||
|
return previndent + &shiftwidth
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Outdent after these keywords if they don't have a postfix condition and
|
||||||
|
" aren't a single-line statement.
|
||||||
|
if prevline =~ s:OUTDENT_AFTER
|
||||||
|
if !s:SmartSearch(prevlinenum, s:POSTFIX_CONDITION) ||
|
||||||
|
\ s:SmartSearch(prevlinenum, '\<then\>')
|
||||||
|
return previndent - &shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" No indenting or outdenting is needed.
|
||||||
|
return -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Wrap s:GetLiveScriptIndent to keep the cursor position.
|
||||||
|
function! GetLiveScriptIndent(curlinenum)
|
||||||
|
let oldcursor = getpos('.')
|
||||||
|
let indent = s:GetLiveScriptIndent(a:curlinenum)
|
||||||
|
call setpos('.', oldcursor)
|
||||||
|
|
||||||
|
return indent
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
126
indent/lua.vim
Normal file
126
indent/lua.vim
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'lua') == -1
|
||||||
|
|
||||||
|
" Vim indent file
|
||||||
|
" Language: Lua
|
||||||
|
" URL: https://github.com/tbastos/vim-lua
|
||||||
|
|
||||||
|
" Initialization ------------------------------------------{{{1
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal nosmartindent
|
||||||
|
|
||||||
|
setlocal indentexpr=GetLuaIndent()
|
||||||
|
setlocal indentkeys+=0=end,0=until,0=elseif,0=else
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*GetLuaIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Variables -----------------------------------------------{{{1
|
||||||
|
|
||||||
|
let s:open_patt = '\%(\<\%(function\|if\|repeat\|do\)\>\|(\|{\)'
|
||||||
|
let s:middle_patt = '\<\%(else\|elseif\)\>'
|
||||||
|
let s:close_patt = '\%(\<\%(end\|until\)\>\|)\|}\)'
|
||||||
|
|
||||||
|
let s:anon_func_start = '\S\+\s*[({].*\<function\s*(.*)\s*$'
|
||||||
|
let s:anon_func_end = '\<end\%(\s*[)}]\)\+'
|
||||||
|
|
||||||
|
" Expression used to check whether we should skip a match with searchpair().
|
||||||
|
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ 'luaComment\\|luaString'"
|
||||||
|
|
||||||
|
" Auxiliary Functions -------------------------------------{{{1
|
||||||
|
|
||||||
|
function s:IsInCommentOrString(lnum, col)
|
||||||
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ 'luaCommentLong\|luaStringLong'
|
||||||
|
\ && !(getline(a:lnum) =~ '^\s*\%(--\)\?\[=*\[') " opening tag is not considered 'in'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find line above 'lnum' that isn't blank, in a comment or string.
|
||||||
|
function s:PrevLineOfCode(lnum)
|
||||||
|
let lnum = prevnonblank(a:lnum)
|
||||||
|
while s:IsInCommentOrString(lnum, 1)
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
endwhile
|
||||||
|
return lnum
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Gets line contents, excluding trailing comments.
|
||||||
|
function s:GetContents(lnum)
|
||||||
|
return substitute(getline(a:lnum), '\v\m--.*$', '', '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" GetLuaIndent Function -----------------------------------{{{1
|
||||||
|
|
||||||
|
function GetLuaIndent()
|
||||||
|
" if the line is in a long comment or string, don't change the indent
|
||||||
|
if s:IsInCommentOrString(v:lnum, 1)
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let prev_line = s:PrevLineOfCode(v:lnum - 1)
|
||||||
|
if prev_line == 0
|
||||||
|
" this is the first non-empty line
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let contents_cur = s:GetContents(v:lnum)
|
||||||
|
let contents_prev = s:GetContents(prev_line)
|
||||||
|
|
||||||
|
let original_cursor_pos = getpos(".")
|
||||||
|
|
||||||
|
let i = 0
|
||||||
|
|
||||||
|
" check if the previous line opens blocks
|
||||||
|
call cursor(v:lnum, 1)
|
||||||
|
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||||
|
\ 'mrb', s:skip_expr, prev_line)
|
||||||
|
if num_pairs > 0
|
||||||
|
let i += num_pairs
|
||||||
|
endif
|
||||||
|
|
||||||
|
" special case: call(with, {anon = function() -- should indent only once
|
||||||
|
if num_pairs > 1 && contents_prev =~ s:anon_func_start
|
||||||
|
let i = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" check if current line closes blocks
|
||||||
|
call cursor(prev_line, col([prev_line,'$']))
|
||||||
|
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||||
|
\ 'mr', s:skip_expr, v:lnum)
|
||||||
|
if num_pairs > 0
|
||||||
|
let i -= num_pairs
|
||||||
|
endif
|
||||||
|
|
||||||
|
" special case: end}) -- end of call with anon func should unindent once
|
||||||
|
if num_pairs > 1 && contents_cur =~ s:anon_func_end
|
||||||
|
let i = -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if the previous line closed a paren, unindent (except with anon funcs)
|
||||||
|
call cursor(prev_line - 1, col([prev_line - 1, '$']))
|
||||||
|
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
|
||||||
|
if num_pairs > 0 && contents_prev !~ s:anon_func_end
|
||||||
|
let i -= 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if this line closed a paren, indent (except with anon funcs)
|
||||||
|
call cursor(prev_line, col([prev_line, '$']))
|
||||||
|
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
|
||||||
|
if num_pairs > 0 && contents_cur !~ s:anon_func_end
|
||||||
|
let i += 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" restore cursor
|
||||||
|
call setpos(".", original_cursor_pos)
|
||||||
|
|
||||||
|
return indent(prev_line) + (&sw * i)
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
249
syntax/applescript.vim
Normal file
249
syntax/applescript.vim
Normal file
@@ -0,0 +1,249 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'applescript') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: AppleScript
|
||||||
|
" Maintainer: Jim Eberle <jim.eberle@fastnlight.com>
|
||||||
|
" Last Change: Mar 18, 2010
|
||||||
|
" URL: http://www.fastnlight.com/syntax/applescript.vim
|
||||||
|
|
||||||
|
" Use :syn w/in a buffer to see language element breakdown
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" --- Statement ---
|
||||||
|
syn keyword scptStmt get set count copy run global local prop property
|
||||||
|
syn keyword scptStmt close put delete duplicate exists
|
||||||
|
syn keyword scptStmt launch open print quit make move reopen save
|
||||||
|
syn keyword scptStmt saving into
|
||||||
|
hi def link scptStmt Statement
|
||||||
|
|
||||||
|
" --- Type ---
|
||||||
|
syn keyword scptType text string number integer real color date
|
||||||
|
hi def link scptType Type
|
||||||
|
|
||||||
|
" --- Operator ---
|
||||||
|
syn keyword scptOp div mod not and or as
|
||||||
|
syn match scptOp "[-+*/^&]"
|
||||||
|
" MacRoman single char :- (divide)
|
||||||
|
exec 'syn match scptOp "'.nr2char(214).'"'
|
||||||
|
syn match scptOp "\<\(a \)\?\(ref\( to\)\?\|reference to\)\>"
|
||||||
|
hi def link scptOp Operator
|
||||||
|
|
||||||
|
" Containment
|
||||||
|
syn match scptIN "\<starts\? with\>"
|
||||||
|
syn match scptIN "\<begins\? with\>"
|
||||||
|
syn match scptIN "\<ends\? with\>"
|
||||||
|
syn match scptIN "\<contains\>"
|
||||||
|
syn match scptIN "\<does not contain\>"
|
||||||
|
syn match scptIN "\<doesn't contain\>"
|
||||||
|
syn match scptIN "\<is in\>"
|
||||||
|
syn match scptIN "\<is contained by\>"
|
||||||
|
syn match scptIN "\<is not in\>"
|
||||||
|
syn match scptIN "\<is not contained by\>"
|
||||||
|
syn match scptIN "\<isn't contained by\>"
|
||||||
|
hi def link scptIN scptOp
|
||||||
|
|
||||||
|
" Equals
|
||||||
|
syn match scptEQ "="
|
||||||
|
syn match scptEQ "\<equal\>"
|
||||||
|
syn match scptEQ "\<equals\>"
|
||||||
|
syn match scptEQ "\<equal to\>"
|
||||||
|
syn match scptEQ "\<is\>"
|
||||||
|
syn match scptEQ "\<is equal to\>"
|
||||||
|
hi def link scptEQ scptOp
|
||||||
|
|
||||||
|
" Not Equals
|
||||||
|
syn match scptNE "\<does not equal\>"
|
||||||
|
syn match scptNE "\<doesn't equal\>"
|
||||||
|
syn match scptNE "\<is not\>"
|
||||||
|
syn match scptNE "\<is not equal\( to\)\?\>"
|
||||||
|
syn match scptNE "\<isn't\>"
|
||||||
|
syn match scptNE "\<isn't equal\( to\)\?\>"
|
||||||
|
hi def link scptNE scptOp
|
||||||
|
" MacRoman single char /=
|
||||||
|
exec 'syn match scptNE "'.nr2char(173).'"'
|
||||||
|
|
||||||
|
" Less Than
|
||||||
|
syn match scptLT "<"
|
||||||
|
syn match scptLT "\<comes before\>"
|
||||||
|
syn match scptLT "\(is \)\?less than"
|
||||||
|
syn match scptLT "\<is not greater than or equal\( to\)\?\>"
|
||||||
|
syn match scptLT "\<isn't greater than or equal\( to\)\?\>"
|
||||||
|
hi def link scptLT scptOp
|
||||||
|
|
||||||
|
" Greater Than
|
||||||
|
syn match scptGT ">"
|
||||||
|
syn match scptGT "\<comes after\>"
|
||||||
|
syn match scptGT "\(is \)\?greater than"
|
||||||
|
syn match scptGT "\<is not less than or equal\( to\)\?\>"
|
||||||
|
syn match scptGT "\<isn't less than or equal\( to\)\?\>"
|
||||||
|
hi def link scptGT scptOp
|
||||||
|
|
||||||
|
" Less Than or Equals
|
||||||
|
syn match scptLE "<="
|
||||||
|
syn match scptLE "\<does not come after\>"
|
||||||
|
syn match scptLE "\<doesn't come after\>"
|
||||||
|
syn match scptLE "\(is \)\?less than or equal\( to\)\?"
|
||||||
|
syn match scptLE "\<is not greater than\>"
|
||||||
|
syn match scptLE "\<isn't greater than\>"
|
||||||
|
hi def link scptLE scptOp
|
||||||
|
" MacRoman single char <=
|
||||||
|
exec 'syn match scptLE "'.nr2char(178).'"'
|
||||||
|
|
||||||
|
" Greater Than or Equals
|
||||||
|
syn match scptGE ">="
|
||||||
|
syn match scptGE "\<does not come before\>"
|
||||||
|
syn match scptGE "\<doesn't come before\>"
|
||||||
|
syn match scptGE "\(is \)\?greater than or equal\( to\)\?"
|
||||||
|
syn match scptGE "\<is not less than\>"
|
||||||
|
syn match scptGE "\<isn't less than\>"
|
||||||
|
hi def link scptGE scptOp
|
||||||
|
" MacRoman single char >=
|
||||||
|
exec 'syn match scptGE "'.nr2char(179).'"'
|
||||||
|
|
||||||
|
" --- Constant String ---
|
||||||
|
syn region scptString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||||
|
hi def link scptString String
|
||||||
|
|
||||||
|
" --- Constant Number ---
|
||||||
|
syn match scptNumber "\<-\?\d\+\>"
|
||||||
|
hi def link scptNumber Number
|
||||||
|
|
||||||
|
" --- Constant Float ---
|
||||||
|
syn match scptFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\="
|
||||||
|
syn match scptFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=\>"
|
||||||
|
syn match scptFloat display contained "\d\+e[-+]\>"
|
||||||
|
hi def link scptFloat Float
|
||||||
|
|
||||||
|
" --- Constant Boolean ---
|
||||||
|
syn keyword scptBoolean true false yes no ask
|
||||||
|
hi def link scptBoolean Boolean
|
||||||
|
|
||||||
|
" --- Other Constants ---
|
||||||
|
syn keyword scptConst it me version pi result space tab anything
|
||||||
|
syn match scptConst "\<missing value\>"
|
||||||
|
|
||||||
|
" Considering and Ignoring
|
||||||
|
syn match scptConst "\<application responses\>"
|
||||||
|
syn match scptConst "\<current application\>"
|
||||||
|
syn match scptConst "\<white space\>"
|
||||||
|
syn keyword scptConst case diacriticals expansion hyphens punctuation
|
||||||
|
hi def link scptConst Constant
|
||||||
|
|
||||||
|
" Style
|
||||||
|
syn match scptStyle "\<all caps\>"
|
||||||
|
syn match scptStyle "\<all lowercase\>"
|
||||||
|
syn match scptStyle "\<small caps\>"
|
||||||
|
syn keyword scptStyle bold condensed expanded hidden italic outline plain
|
||||||
|
syn keyword scptStyle shadow strikethrough subscript superscript underline
|
||||||
|
hi def link scptStyle scptConst
|
||||||
|
|
||||||
|
" Day
|
||||||
|
syn keyword scptDay Mon Tue Wed Thu Fri Sat Sun
|
||||||
|
syn keyword scptDay Monday Tuesday Wednesday Thursday Friday Saturday Sunday
|
||||||
|
syn keyword scptDay weekday
|
||||||
|
hi def link scptDay scptConst
|
||||||
|
|
||||||
|
" Month
|
||||||
|
syn keyword scptMonth Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
|
||||||
|
syn keyword scptMonth January February March
|
||||||
|
syn keyword scptMonth April May June
|
||||||
|
syn keyword scptMonth July August September
|
||||||
|
syn keyword scptMonth October November December
|
||||||
|
syn keyword scptMonth month
|
||||||
|
hi def link scptMonth scptConst
|
||||||
|
|
||||||
|
" Time
|
||||||
|
syn keyword scptTime minutes hours days weeks
|
||||||
|
hi def link scptTime scptConstant
|
||||||
|
|
||||||
|
" --- Conditional ---
|
||||||
|
syn keyword scptCond if then else
|
||||||
|
syn match scptCond "\<end if\>"
|
||||||
|
hi def link scptCond Conditional
|
||||||
|
|
||||||
|
" --- Repeat ---
|
||||||
|
syn keyword scptRepeat repeat with from to by continue
|
||||||
|
syn match scptRepeat "\<repeat while\>"
|
||||||
|
syn match scptRepeat "\<repeat until\>"
|
||||||
|
syn match scptRepeat "\<repeat with\>"
|
||||||
|
syn match scptRepeat "\<end repeat\>"
|
||||||
|
hi def link scptRepeat Repeat
|
||||||
|
|
||||||
|
" --- Exception ---
|
||||||
|
syn keyword scptException try error
|
||||||
|
syn match scptException "\<on error\>"
|
||||||
|
syn match scptException "\<end try\>"
|
||||||
|
syn match scptException "\<end error\>"
|
||||||
|
hi def link scptException Exception
|
||||||
|
|
||||||
|
" --- Keyword ---
|
||||||
|
syn keyword scptKeyword end tell times exit
|
||||||
|
syn keyword scptKeyword application file alias activate
|
||||||
|
syn keyword scptKeyword script on return without given
|
||||||
|
syn keyword scptKeyword considering ignoring items delimiters
|
||||||
|
syn keyword scptKeyword some each every whose where id index item its
|
||||||
|
syn keyword scptKeyword first second third fourth fifth sixth seventh
|
||||||
|
syn keyword scptKeyword eighth ninth tenth container
|
||||||
|
syn match scptKeyword "\d\+\(st\|nd\|rd\|th\)"
|
||||||
|
syn keyword scptKeyword last front back middle named thru through
|
||||||
|
syn keyword scptKeyword before after in of the
|
||||||
|
syn match scptKeyword "\<text \>"
|
||||||
|
syn match scptKeyword "\<partial result\>"
|
||||||
|
syn match scptKeyword "\<but ignoring\>"
|
||||||
|
syn match scptKeyword "\<but considering\>"
|
||||||
|
syn match scptKeyword "\<with timeout\>"
|
||||||
|
syn match scptKeyword "\<with transaction\>"
|
||||||
|
syn match scptKeyword "\<do script\>"
|
||||||
|
syn match scptKeyword "\<POSIX path\>"
|
||||||
|
syn match scptKeyword "\<quoted form\>"
|
||||||
|
syn match scptKeyword "'s"
|
||||||
|
hi def link scptKeyword Keyword
|
||||||
|
|
||||||
|
" US Units
|
||||||
|
syn keyword scptUnitUS quarts gallons ounces pounds inches feet yards miles
|
||||||
|
syn match scptUnitUS "\<square feet\>"
|
||||||
|
syn match scptUnitUS "\<square yards\>"
|
||||||
|
syn match scptUnitUS "\<square miles\>"
|
||||||
|
syn match scptUnitUS "\<cubic inches\>"
|
||||||
|
syn match scptUnitUS "\<cubic feet\>"
|
||||||
|
syn match scptUnitUS "\<cubic yards\>"
|
||||||
|
syn match scptUnitUS "\<degrees Fahrenheit\>"
|
||||||
|
hi def link scptUnitUS scptKey
|
||||||
|
|
||||||
|
" British Units
|
||||||
|
syn keyword scptUnitBT litres centimetres metres kilometres
|
||||||
|
syn match scptUnitBT "\<square metres\>"
|
||||||
|
syn match scptUnitBT "\<square kilometres\>"
|
||||||
|
syn match scptUnitBT "\<cubic centimetres\>"
|
||||||
|
syn match scptUnitBT "\<cubic metres\>"
|
||||||
|
hi def link scptUnitBT scptKey
|
||||||
|
|
||||||
|
" Metric Units
|
||||||
|
syn keyword scptUnitMT liters centimeters meters kilometers grams kilograms
|
||||||
|
syn match scptUnitMT "\<square meters\>"
|
||||||
|
syn match scptUnitMT "\<square kilometers\>"
|
||||||
|
syn match scptUnitMT "\<cubic centimeters\>"
|
||||||
|
syn match scptUnitMT "\<cubic meters\>"
|
||||||
|
syn match scptUnitMT "\<degrees Celsius\>"
|
||||||
|
syn match scptUnitMT "\<degrees Kelvin\>"
|
||||||
|
hi def link scptUnitMT scptKey
|
||||||
|
|
||||||
|
" --- Comment ---
|
||||||
|
syn match scptComment "--.*"
|
||||||
|
syn match scptComment "#.*"
|
||||||
|
syn region scptComment start="(\*" end="\*)"
|
||||||
|
hi def link scptComment Comment
|
||||||
|
|
||||||
|
" --- Todo ---
|
||||||
|
syn keyword scptTodo contained TODO FIXME XXX
|
||||||
|
hi def link scptTodo Todo
|
||||||
|
|
||||||
|
let b:current_syntax = "applescript"
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -17,6 +17,9 @@ if exists("b:current_syntax")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:cpo_sav = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
if has("folding") && exists("g:clojure_fold") && g:clojure_fold > 0
|
if has("folding") && exists("g:clojure_fold") && g:clojure_fold > 0
|
||||||
setlocal foldmethod=syntax
|
setlocal foldmethod=syntax
|
||||||
endif
|
endif
|
||||||
@@ -216,6 +219,9 @@ highlight default link clojureParen Delimiter
|
|||||||
|
|
||||||
let b:current_syntax = "clojure"
|
let b:current_syntax = "clojure"
|
||||||
|
|
||||||
|
let &cpo = s:cpo_sav
|
||||||
|
unlet! s:cpo_sav
|
||||||
|
|
||||||
" vim:sts=8:sw=8:ts=8:noet
|
" vim:sts=8:sw=8:ts=8:noet
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ syntax keyword dartConditional if else switch
|
|||||||
syntax keyword dartRepeat do while for
|
syntax keyword dartRepeat do while for
|
||||||
syntax keyword dartBoolean true false
|
syntax keyword dartBoolean true false
|
||||||
syntax keyword dartConstant null
|
syntax keyword dartConstant null
|
||||||
syntax keyword dartTypedef this super class typedef
|
syntax keyword dartTypedef this super class typedef enum
|
||||||
syntax keyword dartOperator new is as in factory
|
syntax keyword dartOperator new is as in
|
||||||
syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:"
|
syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:"
|
||||||
syntax keyword dartType void var bool int double num dynamic
|
syntax keyword dartType void var bool int double num dynamic
|
||||||
syntax keyword dartStatement return
|
syntax keyword dartStatement return
|
||||||
syntax keyword dartStorageClass static abstract final const
|
syntax keyword dartStorageClass static abstract final const factory
|
||||||
syntax keyword dartExceptions throw rethrow try on catch finally
|
syntax keyword dartExceptions throw rethrow try on catch finally
|
||||||
syntax keyword dartAssert assert
|
syntax keyword dartAssert assert
|
||||||
syntax keyword dartClassDecl extends with implements
|
syntax keyword dartClassDecl extends with implements
|
||||||
@@ -39,11 +39,17 @@ syntax match dartUserLabelRef "\k\+" contained
|
|||||||
syntax region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":"
|
syntax region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":"
|
||||||
syntax keyword dartLabel default
|
syntax keyword dartLabel default
|
||||||
|
|
||||||
syntax match dartLibrary "^\(import\|part of\|part\|export\|library\|show\|hide\)\s"
|
syntax match dartLibrary "^\(import\|export\)\>" nextgroup=dartUri skipwhite
|
||||||
|
syntax region dartUri contained start=+r\=\z(["']\)+ end=+\z1+ nextgroup=dartCombinators skipwhite
|
||||||
|
syntax region dartCombinators contained start="" end=";" contains=dartCombinator
|
||||||
|
syntax keyword dartCombinator contained show hide deferred as
|
||||||
|
syntax match dartLibrary "^\(library\|part of\|part\)\>"
|
||||||
|
|
||||||
|
syntax match dartMetadata "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>"
|
||||||
|
|
||||||
" Comments
|
" Comments
|
||||||
syntax keyword dartTodo contained TODO FIXME XXX
|
syntax keyword dartTodo contained TODO FIXME XXX
|
||||||
syntax region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLink,@Spell
|
syntax region dartComment start="/\*" end="\*/" contains=dartComment,dartTodo,dartDocLink,@Spell
|
||||||
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
|
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
|
||||||
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
|
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
|
||||||
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
|
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
|
||||||
@@ -96,9 +102,12 @@ highlight default link dartInterpolation PreProc
|
|||||||
highlight default link dartDocLink SpecialComment
|
highlight default link dartDocLink SpecialComment
|
||||||
highlight default link dartSpecialChar SpecialChar
|
highlight default link dartSpecialChar SpecialChar
|
||||||
highlight default link dartLibrary Include
|
highlight default link dartLibrary Include
|
||||||
|
highlight default link dartUri String
|
||||||
|
highlight default link dartCombinator Keyword
|
||||||
highlight default link dartCoreClasses Type
|
highlight default link dartCoreClasses Type
|
||||||
highlight default link dartCoreTypedefs Typedef
|
highlight default link dartCoreTypedefs Typedef
|
||||||
highlight default link dartCoreExceptions Exception
|
highlight default link dartCoreExceptions Exception
|
||||||
|
highlight default link dartMetadata PreProc
|
||||||
|
|
||||||
let b:current_syntax = "dart"
|
let b:current_syntax = "dart"
|
||||||
let b:spell_options = "contained"
|
let b:spell_options = "contained"
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ syn region elixirRegex matchgroup=elixirRegexDelimiter start="%r/" end="/[uiomxf
|
|||||||
syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation
|
syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation
|
||||||
syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass
|
syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass
|
||||||
|
|
||||||
syn region elixirString matchgroup=elixirStringDelimiter start="'" end="'" skip="\\'\|\\\\"
|
syn region elixirString matchgroup=elixirStringDelimiter start="'" end="'" skip="\\'\|\\\\" contains=@elixirStringContained
|
||||||
syn region elixirString matchgroup=elixirStringDelimiter start='"' end='"' skip='\\"' contains=@elixirStringContained
|
syn region elixirString matchgroup=elixirStringDelimiter start='"' end='"' skip='\\"' contains=@elixirStringContained
|
||||||
syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirComment,@elixirNotTop
|
syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirComment,@elixirNotTop
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ syn keyword elixirCallbackDefine defcallback nextgroup=elixirCallbackDec
|
|||||||
syn keyword elixirStructDefine defstruct skipwhite skipnl
|
syn keyword elixirStructDefine defstruct skipwhite skipnl
|
||||||
|
|
||||||
" Declarations
|
" Declarations
|
||||||
syn match elixirModuleDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias nextgroup=elixirBlock skipwhite skipnl
|
syn match elixirModuleDeclaration "[^[:space:];#<]\+" contained nextgroup=elixirBlock skipwhite skipnl
|
||||||
syn match elixirFunctionDeclaration "[^[:space:];#<,()\[\]]\+" contained nextgroup=elixirArguments skipwhite skipnl
|
syn match elixirFunctionDeclaration "[^[:space:];#<,()\[\]]\+" contained nextgroup=elixirArguments skipwhite skipnl
|
||||||
syn match elixirProtocolDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
|
syn match elixirProtocolDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
|
||||||
syn match elixirImplDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
|
syn match elixirImplDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ hi def link goFunction Function
|
|||||||
|
|
||||||
" Methods;
|
" Methods;
|
||||||
if g:go_highlight_methods != 0
|
if g:go_highlight_methods != 0
|
||||||
syn match goMethod /\.\w\+(/hs=s+1,he=e-1
|
syn match goMethod /\.\w\+\ze(/hs=s+1
|
||||||
endif
|
endif
|
||||||
hi def link goMethod Type
|
hi def link goMethod Type
|
||||||
|
|
||||||
@@ -368,8 +368,14 @@ if g:go_highlight_build_constraints != 0
|
|||||||
hi def link goPackageComment Comment
|
hi def link goPackageComment Comment
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" :GoSameIds
|
||||||
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black
|
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black
|
||||||
|
|
||||||
|
" :GoCoverage commands
|
||||||
|
hi def link goCoverageNormalText Comment
|
||||||
|
hi def goCoverageCovered ctermfg=green
|
||||||
|
hi def goCoverageUncover ctermfg=red
|
||||||
|
|
||||||
" Search backwards for a global declaration to start processing the syntax.
|
" Search backwards for a global declaration to start processing the syntax.
|
||||||
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
|
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
|
|||||||
" Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
|
" Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
|
||||||
" Last Change: 2014-12-20 Load ftplugin/json.vim
|
" Last Change: 2014-12-20 Load ftplugin/json.vim
|
||||||
|
|
||||||
|
" Reload the definition of g:vim_json_syntax_conceal
|
||||||
|
" see https://github.com/elzr/vim-json/issues/42
|
||||||
|
runtime! ftplugin/json.vim
|
||||||
|
|
||||||
if !exists("main_syntax")
|
if !exists("main_syntax")
|
||||||
if version < 600
|
if version < 600
|
||||||
syntax clear
|
syntax clear
|
||||||
@@ -16,10 +20,16 @@ endif
|
|||||||
|
|
||||||
syntax match jsonNoise /\%(:\|,\)/
|
syntax match jsonNoise /\%(:\|,\)/
|
||||||
|
|
||||||
|
" NOTE that for the concealing to work your conceallevel should be set to 2
|
||||||
|
|
||||||
" Syntax: Strings
|
" Syntax: Strings
|
||||||
" Separated into a match and region because a region by itself is always greedy
|
" Separated into a match and region because a region by itself is always greedy
|
||||||
syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
|
syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
|
||||||
syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained
|
if has('conceal') && g:vim_json_syntax_conceal == 1
|
||||||
|
syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained
|
||||||
|
else
|
||||||
|
syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained
|
||||||
|
endif
|
||||||
|
|
||||||
" Syntax: JSON does not allow strings with single quotes, unlike JavaScript.
|
" Syntax: JSON does not allow strings with single quotes, unlike JavaScript.
|
||||||
syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
|
syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
|
||||||
@@ -27,7 +37,11 @@ syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
|
|||||||
" Syntax: JSON Keywords
|
" Syntax: JSON Keywords
|
||||||
" Separated into a match and region because a region by itself is always greedy
|
" Separated into a match and region because a region by itself is always greedy
|
||||||
syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword
|
syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword
|
||||||
syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contains=jsonEscape contained
|
if has('conceal') && g:vim_json_syntax_conceal == 1
|
||||||
|
syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contains=jsonEscape contained
|
||||||
|
else
|
||||||
|
syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contains=jsonEscape contained
|
||||||
|
endif
|
||||||
|
|
||||||
" Syntax: Escape sequences
|
" Syntax: Escape sequences
|
||||||
syn match jsonEscape "\\["\\/bfnrt]" contained
|
syn match jsonEscape "\\["\\/bfnrt]" contained
|
||||||
@@ -37,31 +51,33 @@ syn match jsonEscape "\\u\x\{4}" contained
|
|||||||
syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n]*[,}\]]"
|
syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n]*[,}\]]"
|
||||||
|
|
||||||
" ERROR WARNINGS **********************************************
|
" ERROR WARNINGS **********************************************
|
||||||
" Syntax: Strings should always be enclosed with quotes.
|
if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
|
||||||
syn match jsonNoQuotesError "\<[[:alpha:]][[:alnum:]]*\>"
|
" Syntax: Strings should always be enclosed with quotes.
|
||||||
syn match jsonTripleQuotesError /"""/
|
syn match jsonNoQuotesError "\<[[:alpha:]][[:alnum:]]*\>"
|
||||||
|
syn match jsonTripleQuotesError /"""/
|
||||||
|
|
||||||
" Syntax: An integer part of 0 followed by other digits is not allowed.
|
" Syntax: An integer part of 0 followed by other digits is not allowed.
|
||||||
syn match jsonNumError "-\=\<0\d\.\d*\>"
|
syn match jsonNumError "-\=\<0\d\.\d*\>"
|
||||||
|
|
||||||
" Syntax: Decimals smaller than one should begin with 0 (so .1 should be 0.1).
|
" Syntax: Decimals smaller than one should begin with 0 (so .1 should be 0.1).
|
||||||
syn match jsonNumError "\:\@<=[[:blank:]\r\n]*\zs\.\d\+"
|
syn match jsonNumError "\:\@<=[[:blank:]\r\n]*\zs\.\d\+"
|
||||||
|
|
||||||
" Syntax: No comments in JSON, see http://stackoverflow.com/questions/244777/can-i-comment-a-json-file
|
" Syntax: No comments in JSON, see http://stackoverflow.com/questions/244777/can-i-comment-a-json-file
|
||||||
syn match jsonCommentError "//.*"
|
syn match jsonCommentError "//.*"
|
||||||
syn match jsonCommentError "\(/\*\)\|\(\*/\)"
|
syn match jsonCommentError "\(/\*\)\|\(\*/\)"
|
||||||
|
|
||||||
" Syntax: No semicolons in JSON
|
" Syntax: No semicolons in JSON
|
||||||
syn match jsonSemicolonError ";"
|
syn match jsonSemicolonError ";"
|
||||||
|
|
||||||
" Syntax: No trailing comma after the last element of arrays or objects
|
" Syntax: No trailing comma after the last element of arrays or objects
|
||||||
syn match jsonTrailingCommaError ",\_s*[}\]]"
|
syn match jsonTrailingCommaError ",\_s*[}\]]"
|
||||||
|
|
||||||
" Syntax: Watch out for missing commas between elements
|
" Syntax: Watch out for missing commas between elements
|
||||||
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
|
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
|
||||||
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
|
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
|
||||||
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
|
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
|
||||||
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
|
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
|
||||||
|
endif
|
||||||
|
|
||||||
" ********************************************** END OF ERROR WARNINGS
|
" ********************************************** END OF ERROR WARNINGS
|
||||||
" Allowances for JSONP: function call at the beginning of the file,
|
" Allowances for JSONP: function call at the beginning of the file,
|
||||||
@@ -87,12 +103,13 @@ if version >= 508 || !exists("did_json_syn_inits")
|
|||||||
hi def link jsonString String
|
hi def link jsonString String
|
||||||
hi def link jsonTest Label
|
hi def link jsonTest Label
|
||||||
hi def link jsonEscape Special
|
hi def link jsonEscape Special
|
||||||
hi def link jsonNumber Number
|
hi def link jsonNumber Delimiter
|
||||||
hi def link jsonBraces Delimiter
|
hi def link jsonBraces Delimiter
|
||||||
hi def link jsonNull Function
|
hi def link jsonNull Function
|
||||||
hi def link jsonBoolean Boolean
|
hi def link jsonBoolean Delimiter
|
||||||
hi def link jsonKeyword Label
|
hi def link jsonKeyword Label
|
||||||
|
|
||||||
|
if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
|
||||||
hi def link jsonNumError Error
|
hi def link jsonNumError Error
|
||||||
hi def link jsonCommentError Error
|
hi def link jsonCommentError Error
|
||||||
hi def link jsonSemicolonError Error
|
hi def link jsonSemicolonError Error
|
||||||
@@ -101,6 +118,7 @@ if version >= 508 || !exists("did_json_syn_inits")
|
|||||||
hi def link jsonStringSQError Error
|
hi def link jsonStringSQError Error
|
||||||
hi def link jsonNoQuotesError Error
|
hi def link jsonNoQuotesError Error
|
||||||
hi def link jsonTripleQuotesError Error
|
hi def link jsonTripleQuotesError Error
|
||||||
|
endif
|
||||||
hi def link jsonQuote Quote
|
hi def link jsonQuote Quote
|
||||||
hi def link jsonNoise Noise
|
hi def link jsonNoise Noise
|
||||||
endif
|
endif
|
||||||
|
|||||||
140
syntax/ls.vim
Normal file
140
syntax/ls.vim
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
|
||||||
|
|
||||||
|
" Language: LiveScript "
|
||||||
|
" Maintainer: George Zahariev
|
||||||
|
" URL: http://github.com/gkz/vim-ls
|
||||||
|
" License: WTFPL
|
||||||
|
|
||||||
|
if exists('b:current_syntax') && b:current_syntax == 'livescript'
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "ls"
|
||||||
|
|
||||||
|
" Highlight long strings.
|
||||||
|
syntax sync minlines=100
|
||||||
|
|
||||||
|
setlocal iskeyword=48-57,A-Z,$,a-z,_,-
|
||||||
|
|
||||||
|
syntax match lsIdentifier /[$A-Za-z_]\k*\(-[a-zA-Z]\+\)*/
|
||||||
|
highlight default link lsIdentifier Identifier
|
||||||
|
|
||||||
|
" These are 'matches' rather than 'keywords' because vim's highlighting priority
|
||||||
|
" for keywords (the highest) causes them to be wrongly highlighted when used as
|
||||||
|
" dot-properties.
|
||||||
|
syntax match lsStatement /\<\%(return\|break\|continue\|throw\)\>/
|
||||||
|
highlight default link lsStatement Statement
|
||||||
|
|
||||||
|
syntax match lsRepeat /\<\%(for\%( own\| ever\)\?\|while\|until\)\>/
|
||||||
|
highlight default link lsRepeat Repeat
|
||||||
|
|
||||||
|
syntax match lsConditional /\<\%(if\|else\|unless\|switch\|case\|when\|default\|match\)\>/
|
||||||
|
highlight default link lsConditional Conditional
|
||||||
|
|
||||||
|
syntax match lsException /\<\%(try\|catch\|finally\)\>/
|
||||||
|
highlight default link lsException Exception
|
||||||
|
|
||||||
|
syntax match lsKeyword /\<\%(new\|in\%(stanceof\)\?\|typeof\|delete\|and\|o[fr]\|not\|xor\|is\|isnt\|imp\%(ort\%( all\)\?\|lements\)\|extends\|loop\|from\|to\|til\|by\|do\|then\|function\|class\|let\|with\|export\|const\|var\|eval\|super\|fallthrough\|debugger\|where\|yield\)\>/
|
||||||
|
highlight default link lsKeyword Keyword
|
||||||
|
|
||||||
|
syntax match lsBoolean /\<\%(true\|false\|yes\|no\|on\|off\|null\|void\)\>/
|
||||||
|
highlight default link lsBoolean Boolean
|
||||||
|
|
||||||
|
" Matches context variables.
|
||||||
|
syntax match lsContext /\<\%(this\|arguments\|it\|that\|constructor\|prototype\|superclass\)\>/
|
||||||
|
highlight default link lsContext Type
|
||||||
|
|
||||||
|
" Keywords reserved by the language
|
||||||
|
syntax cluster lsReserved contains=lsStatement,lsRepeat,lsConditional,
|
||||||
|
\ lsException,lsOperator,lsKeyword,lsBoolean
|
||||||
|
|
||||||
|
" Matches ECMAScript 5 built-in globals.
|
||||||
|
syntax match lsGlobal /\<\%(Array\|Boolean\|Date\|Function\|JSON\|Math\|Number\|Object\|RegExp\|String\|\%(Syntax\|Type\|URI\)\?Error\|is\%(NaN\|Finite\)\|parse\%(Int\|Float\)\|\%(en\|de\)codeURI\%(Component\)\?\)\>/
|
||||||
|
highlight default link lsGlobal Structure
|
||||||
|
|
||||||
|
syntax region lsString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=@lsInterpString
|
||||||
|
syntax region lsString start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=@lsSimpleString
|
||||||
|
highlight default link lsString String
|
||||||
|
|
||||||
|
" Matches decimal/floating-point numbers like 10.42e-8.
|
||||||
|
syntax match lsFloat
|
||||||
|
\ /\%(\<-\?\|-\)\zs\d[0-9_]*\%(\.\d[0-9_]*\)\?\%(e[+-]\?\d[0-9_]*\)\?\%([a-zA-Z$][$a-zA-Z0-9_]*\)\?/
|
||||||
|
\ contains=lsNumberComment
|
||||||
|
highlight default link lsFloat Float
|
||||||
|
syntax match lsNumberComment /\d\+\zs\%(e[+-]\?\d\)\@![a-zA-Z$][$a-zA-Z0-9_]*/ contained
|
||||||
|
highlight default link lsNumberComment Comment
|
||||||
|
" Matches hex numbers like 0xfff, 0x000.
|
||||||
|
syntax match lsNumber /\%(\<-\?\|-\)\zs0x\x\+/
|
||||||
|
" Matches N radix numbers like 2@1010.
|
||||||
|
syntax match lsNumber
|
||||||
|
\ /\%(\<-\?\|-\)\zs\%(\d*\)\~[0-9A-Za-z][0-9A-Za-z_]*/
|
||||||
|
highlight default link lsNumber Number
|
||||||
|
|
||||||
|
" Displays an error for reserved words.
|
||||||
|
syntax match lsReservedError /\<\%(enum\|interface\|package\|private\|protected\|public\|static\)\>/
|
||||||
|
highlight default link lsReservedError Error
|
||||||
|
|
||||||
|
syntax keyword lsTodo TODO FIXME XXX contained
|
||||||
|
highlight default link lsTodo Todo
|
||||||
|
|
||||||
|
syntax match lsComment /#.*/ contains=@Spell,lsTodo
|
||||||
|
syntax region lsComment start=/\/\*/ end=/\*\// contains=@Spell,lsTodo
|
||||||
|
highlight default link lsComment Comment
|
||||||
|
|
||||||
|
syntax region lsInfixFunc start=/`/ end=/`/
|
||||||
|
highlight default link lsInfixFunc Identifier
|
||||||
|
|
||||||
|
syntax region lsInterpolation matchgroup=lsInterpDelim
|
||||||
|
\ start=/\#{/ end=/}/
|
||||||
|
\ contained contains=TOP
|
||||||
|
highlight default link lsInterpDelim Delimiter
|
||||||
|
|
||||||
|
" Matches escape sequences like \000, \x00, \u0000, \n.
|
||||||
|
syntax match lsEscape /\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\./ contained
|
||||||
|
highlight default link lsEscape SpecialChar
|
||||||
|
|
||||||
|
syntax match lsVarInterpolation /#[$A-Za-z_]\k*\(-[a-zA-Z]\+\)*/ contained
|
||||||
|
highlight default link lsVarInterpolation Identifier
|
||||||
|
|
||||||
|
" What is in a non-interpolated string
|
||||||
|
syntax cluster lsSimpleString contains=@Spell,lsEscape
|
||||||
|
" What is in an interpolated string
|
||||||
|
syntax cluster lsInterpString contains=@lsSimpleString,
|
||||||
|
\ lsInterpolation,lsVarInterpolation
|
||||||
|
|
||||||
|
syntax region lsRegex start=/\%(\%()\|\i\@<!\d\)\s*\|\i\)\@<!\/\*\@!/
|
||||||
|
\ skip=/\[[^]]\{-}\/[^]]\{-}\]/
|
||||||
|
\ end=/\/[gimy$]\{,4}/
|
||||||
|
\ oneline contains=@lsSimpleString
|
||||||
|
syntax region lsHeregex start=/\/\// end=/\/\/[gimy$?]\{,4}/ contains=@lsInterpString,lsComment,lsSpaceError fold
|
||||||
|
highlight default link lsHeregex lsRegex
|
||||||
|
highlight default link lsRegex String
|
||||||
|
|
||||||
|
syntax region lsHeredoc start=/"""/ end=/"""/ contains=@lsInterpString fold
|
||||||
|
syntax region lsHeredoc start=/'''/ end=/'''/ contains=@lsSimpleString fold
|
||||||
|
highlight default link lsHeredoc String
|
||||||
|
|
||||||
|
syntax match lsWord /\\\S[^ \t\r,;)}\]]*/
|
||||||
|
highlight default link lsWord String
|
||||||
|
|
||||||
|
syntax region lsWords start=/<\[/ end=/\]>/ contains=fold
|
||||||
|
highlight default link lsWords String
|
||||||
|
|
||||||
|
" Reserved words can be used as property names.
|
||||||
|
syntax match lsProp /[$A-Za-z_]\k*[ \t]*:[:=]\@!/
|
||||||
|
highlight default link lsProp Label
|
||||||
|
|
||||||
|
syntax match lsKey
|
||||||
|
\ /\%(\.\@<!\.\%(=\?\s*\|\.\)\|[]})@?]\|::\)\zs\k\+/
|
||||||
|
\ transparent
|
||||||
|
\ contains=ALLBUT,lsNumberComment,lsIdentifier,lsContext,lsGlobal,lsReservedError,@lsReserved
|
||||||
|
|
||||||
|
" Displays an error for trailing whitespace.
|
||||||
|
syntax match lsSpaceError /\s\+$/ display
|
||||||
|
highlight default link lsSpaceError Error
|
||||||
|
|
||||||
|
if !exists('b:current_syntax')
|
||||||
|
let b:current_syntax = 'livescript'
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
216
syntax/lua.vim
Normal file
216
syntax/lua.vim
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'lua') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Lua
|
||||||
|
" URL: https://github.com/tbastos/vim-lua
|
||||||
|
|
||||||
|
if !exists("main_syntax")
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let main_syntax = 'lua'
|
||||||
|
endif
|
||||||
|
|
||||||
|
syntax sync fromstart
|
||||||
|
|
||||||
|
" Clusters
|
||||||
|
syntax cluster luaBase contains=luaComment,luaCommentLong,luaConstant,luaNumber,luaString,luaStringLong,luaBuiltIn
|
||||||
|
syntax cluster luaExpr contains=@luaBase,luaTable,luaParen,luaBracket,luaSpecialTable,luaSpecialValue,luaOperator,luaEllipsis,luaComma,luaFunc,luaFuncCall,luaError
|
||||||
|
syntax cluster luaStat contains=@luaExpr,luaIfThen,luaBlock,luaLoop,luaGoto,luaLabel,luaLocal,luaStatement,luaSemiCol
|
||||||
|
|
||||||
|
syntax match luaNoise /\%(\.\|,\|:\|\;\)/
|
||||||
|
|
||||||
|
" Symbols
|
||||||
|
syntax region luaTable transparent matchgroup=luaBraces start="{" end="}" contains=@luaExpr fold
|
||||||
|
syntax region luaParen transparent matchgroup=luaParens start='(' end=')' contains=@luaExpr
|
||||||
|
syntax region luaBracket transparent matchgroup=luaBrackets start="\[" end="\]" contains=@luaExpr
|
||||||
|
syntax match luaComma ","
|
||||||
|
syntax match luaSemiCol ";"
|
||||||
|
syntax match luaOperator "[#<>=~^&|*/%+-]\|\.\."
|
||||||
|
syntax match luaEllipsis "\.\.\."
|
||||||
|
|
||||||
|
" Catch errors caused by unbalanced brackets and keywords
|
||||||
|
syntax match luaError ")"
|
||||||
|
syntax match luaError "}"
|
||||||
|
syntax match luaError "\]"
|
||||||
|
syntax match luaError "\<\%(end\|else\|elseif\|then\|until\)\>"
|
||||||
|
|
||||||
|
" Shebang at the start
|
||||||
|
syntax match luaComment "\%^#!.*"
|
||||||
|
|
||||||
|
" Comments
|
||||||
|
syntax keyword luaCommentTodo contained TODO FIXME XXX TBD
|
||||||
|
syntax match luaComment "--.*$" contains=luaCommentTodo,luaDocTag,@Spell
|
||||||
|
syntax region luaCommentLong matchgroup=luaCommentLongTag start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaCommentTodo,luaDocTag,@Spell fold
|
||||||
|
syntax match luaDocTag contained "\s@\k\+"
|
||||||
|
|
||||||
|
" Function calls
|
||||||
|
syntax match luaFuncCall /\k\+\%(\s*[{('"]\)\@=/
|
||||||
|
|
||||||
|
" Functions
|
||||||
|
syntax region luaFunc transparent matchgroup=luaFuncKeyword start="\<function\>" end="\<end\>" contains=@luaStat,luaFuncSig fold
|
||||||
|
syntax region luaFuncSig contained transparent start="\(\<function\>\)\@<=" end=")" contains=luaFuncId,luaFuncArgs keepend
|
||||||
|
syntax match luaFuncId contained "[^(]*(\@=" contains=luaFuncTable,luaFuncName
|
||||||
|
syntax match luaFuncTable contained /\k\+\%(\s*[.:]\)\@=/
|
||||||
|
syntax match luaFuncName contained "[^(.:]*(\@="
|
||||||
|
syntax region luaFuncArgs contained transparent matchgroup=luaFuncParens start=/(/ end=/)/ contains=@luaBase,luaFuncArgName,luaFuncArgComma,luaEllipsis
|
||||||
|
syntax match luaFuncArgName contained /\k\+/
|
||||||
|
syntax match luaFuncArgComma contained /,/
|
||||||
|
|
||||||
|
" if ... then
|
||||||
|
syntax region luaIfThen transparent matchgroup=luaCond start="\<if\>" end="\<then\>"me=e-4 contains=@luaExpr nextgroup=luaThenEnd skipwhite skipempty
|
||||||
|
|
||||||
|
" then ... end
|
||||||
|
syntax region luaThenEnd contained transparent matchgroup=luaCond start="\<then\>" end="\<end\>" contains=@luaStat,luaElseifThen,luaElse fold
|
||||||
|
|
||||||
|
" elseif ... then
|
||||||
|
syntax region luaElseifThen contained transparent matchgroup=luaCond start="\<elseif\>" end="\<then\>" contains=@luaExpr
|
||||||
|
|
||||||
|
" else
|
||||||
|
syntax keyword luaElse contained else
|
||||||
|
|
||||||
|
" do ... end
|
||||||
|
syntax region luaBlock transparent matchgroup=luaRepeat start="\<do\>" end="\<end\>" contains=@luaStat fold
|
||||||
|
|
||||||
|
" repeat ... until
|
||||||
|
syntax region luaLoop transparent matchgroup=luaRepeat start="\<repeat\>" end="\<until\>" contains=@luaStat nextgroup=@luaExpr fold
|
||||||
|
|
||||||
|
" while ... do
|
||||||
|
syntax region luaLoop transparent matchgroup=luaRepeat start="\<while\>" end="\<do\>"me=e-2 contains=@luaExpr nextgroup=luaBlock skipwhite skipempty fold
|
||||||
|
|
||||||
|
" for ... do and for ... in ... do
|
||||||
|
syntax region luaLoop transparent matchgroup=luaRepeat start="\<for\>" end="\<do\>"me=e-2 contains=@luaExpr,luaIn nextgroup=luaBlock skipwhite skipempty
|
||||||
|
syntax keyword luaIn contained in
|
||||||
|
|
||||||
|
" goto and labels
|
||||||
|
syntax keyword luaGoto goto nextgroup=luaGotoLabel skipwhite
|
||||||
|
syntax match luaGotoLabel "\k\+" contained
|
||||||
|
syntax match luaLabel "::\k\+::"
|
||||||
|
|
||||||
|
" Other Keywords
|
||||||
|
syntax keyword luaConstant nil true false
|
||||||
|
syntax keyword luaBuiltIn _ENV self
|
||||||
|
syntax keyword luaLocal local
|
||||||
|
syntax keyword luaOperator and or not
|
||||||
|
syntax keyword luaStatement break return
|
||||||
|
|
||||||
|
" Strings
|
||||||
|
syntax match luaStringSpecial contained #\\[\\abfnrtvz'"]\|\\x[[:xdigit:]]\{2}\|\\[[:digit:]]\{,3}#
|
||||||
|
syntax region luaStringLong matchgroup=luaStringLongTag start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell
|
||||||
|
syntax region luaString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaStringSpecial,@Spell
|
||||||
|
syntax region luaString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaStringSpecial,@Spell
|
||||||
|
|
||||||
|
" Decimal constant
|
||||||
|
syntax match luaNumber "\<\d\+\>"
|
||||||
|
" Hex constant
|
||||||
|
syntax match luaNumber "\<0[xX][[:xdigit:].]\+\%([pP][-+]\=\d\+\)\=\>"
|
||||||
|
" Floating point constant, with dot, optional exponent
|
||||||
|
syntax match luaFloat "\<\d\+\.\d*\%([eE][-+]\=\d\+\)\=\>"
|
||||||
|
" Floating point constant, starting with a dot, optional exponent
|
||||||
|
syntax match luaFloat "\.\d\+\%([eE][-+]\=\d\+\)\=\>"
|
||||||
|
" Floating point constant, without dot, with exponent
|
||||||
|
syntax match luaFloat "\<\d\+[eE][-+]\=\d\+\>"
|
||||||
|
|
||||||
|
" Special names from the Standard Library
|
||||||
|
syntax keyword luaSpecialTable
|
||||||
|
\ bit32
|
||||||
|
\ coroutine
|
||||||
|
\ debug
|
||||||
|
\ io
|
||||||
|
\ math
|
||||||
|
\ os
|
||||||
|
\ package
|
||||||
|
\ string
|
||||||
|
\ table
|
||||||
|
\ utf8
|
||||||
|
|
||||||
|
syntax keyword luaSpecialValue
|
||||||
|
\ _G
|
||||||
|
\ _VERSION
|
||||||
|
\ assert
|
||||||
|
\ collectgarbage
|
||||||
|
\ dofile
|
||||||
|
\ error
|
||||||
|
\ getfenv
|
||||||
|
\ getmetatable
|
||||||
|
\ ipairs
|
||||||
|
\ load
|
||||||
|
\ loadfile
|
||||||
|
\ loadstring
|
||||||
|
\ module
|
||||||
|
\ next
|
||||||
|
\ pairs
|
||||||
|
\ pcall
|
||||||
|
\ print
|
||||||
|
\ rawequal
|
||||||
|
\ rawget
|
||||||
|
\ rawlen
|
||||||
|
\ rawset
|
||||||
|
\ require
|
||||||
|
\ select
|
||||||
|
\ setfenv
|
||||||
|
\ setmetatable
|
||||||
|
\ tonumber
|
||||||
|
\ tostring
|
||||||
|
\ type
|
||||||
|
\ unpack
|
||||||
|
\ xpcall
|
||||||
|
|
||||||
|
" Define the default highlighting.
|
||||||
|
" For version 5.7 and earlier: only when not done already
|
||||||
|
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||||
|
if version >= 508 || !exists("did_lua_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_lua_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink luaParens Noise
|
||||||
|
HiLink luaBraces Structure
|
||||||
|
HiLink luaBrackets Noise
|
||||||
|
HiLink luaBuiltIn Special
|
||||||
|
HiLink luaComment Comment
|
||||||
|
HiLink luaCommentLong luaComment
|
||||||
|
HiLink luaCommentTodo Todo
|
||||||
|
HiLink luaCond Conditional
|
||||||
|
HiLink luaConstant Boolean
|
||||||
|
HiLink luaDocTag Underlined
|
||||||
|
HiLink luaEllipsis StorageClass
|
||||||
|
HiLink luaElse Conditional
|
||||||
|
HiLink luaError Error
|
||||||
|
HiLink luaFloat Float
|
||||||
|
HiLink luaFuncTable Function
|
||||||
|
HiLink luaFuncArgName Noise
|
||||||
|
HiLink luaFuncCall PreProc
|
||||||
|
HiLink luaFuncId Function
|
||||||
|
HiLink luaFuncKeyword Type
|
||||||
|
HiLink luaFuncName Function
|
||||||
|
HiLink luaFuncParens Noise
|
||||||
|
HiLink luaGoto luaStatement
|
||||||
|
HiLink luaGotoLabel Noise
|
||||||
|
HiLink luaIn Repeat
|
||||||
|
HiLink luaLabel Label
|
||||||
|
HiLink luaLocal Type
|
||||||
|
HiLink luaNumber Number
|
||||||
|
HiLink luaOperator Operator
|
||||||
|
HiLink luaRepeat Repeat
|
||||||
|
HiLink luaSemiCol Delimiter
|
||||||
|
HiLink luaSpecialTable Special
|
||||||
|
HiLink luaSpecialValue PreProc
|
||||||
|
HiLink luaStatement Statement
|
||||||
|
HiLink luaString String
|
||||||
|
HiLink luaStringLong luaString
|
||||||
|
HiLink luaStringSpecial SpecialChar
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
end
|
||||||
|
|
||||||
|
let b:current_syntax = "lua"
|
||||||
|
if main_syntax == 'lua'
|
||||||
|
unlet main_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -121,6 +121,7 @@ syntax keyword swiftKeywords
|
|||||||
\ else
|
\ else
|
||||||
\ extension
|
\ extension
|
||||||
\ fallthrough
|
\ fallthrough
|
||||||
|
\ fileprivate
|
||||||
\ final
|
\ final
|
||||||
\ for
|
\ for
|
||||||
\ func
|
\ func
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ syn region typescriptInterpolation matchgroup=typescriptInterpolationDelimiter
|
|||||||
\ start=/${/ end=/}/ contained
|
\ start=/${/ end=/}/ contained
|
||||||
\ contains=@typescriptExpression
|
\ contains=@typescriptExpression
|
||||||
|
|
||||||
syn match typescriptSpecialCharacter "'\\.'"
|
|
||||||
syn match typescriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
syn match typescriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||||
syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
||||||
" syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
|
" syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
|
||||||
@@ -125,7 +124,7 @@ syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity Math
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public type namespace from
|
syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public type namespace from get set
|
||||||
"}}}
|
"}}}
|
||||||
"" typescript/DOM/HTML/CSS specified things"{{{
|
"" typescript/DOM/HTML/CSS specified things"{{{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user