diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2017-03-23 11:28:19 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2017-03-23 11:28:28 +0100 |
commit | 0801eac01aab5940fc1e4409ba749383cc353bc2 (patch) | |
tree | 9034c9f6cd0c7592a09e6c65521c6948c3a983af /syntax/vue.vim | |
parent | 9f735b1fe77072e001a593f7f6660703bf4a8c9c (diff) | |
download | vim-polyglot-0801eac01aab5940fc1e4409ba749383cc353bc2.tar.gz vim-polyglot-0801eac01aab5940fc1e4409ba749383cc353bc2.zip |
Update
Diffstat (limited to '')
-rw-r--r-- | syntax/vue.vim | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/syntax/vue.vim b/syntax/vue.vim index 89b5b794..a3ab794c 100644 --- a/syntax/vue.vim +++ b/syntax/vue.vim @@ -27,84 +27,70 @@ if !exists("s:syntaxes") return syntaxes endfunction - let s:syntaxes = s:search_syntaxes('pug', 'slm', 'coffee', 'stylus', 'sass', 'scss', 'less') + let s:syntaxes = s:search_syntaxes('pug', 'slm', 'coffee', 'stylus', 'sass', 'scss', 'less', 'typescript') endif syntax include @HTML syntax/html.vim -if exists("b:current_syntax") - unlet b:current_syntax -endif -syntax region html keepend start=/^<template>/ end=/^<\/template>/ contains=@HTML fold +unlet! b:current_syntax +syntax region html keepend start=/^<template\_[^>]*>/ end=/^<\/template>/ contains=@HTML fold if s:syntaxes.pug syntax include @PUG syntax/pug.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif + unlet! b:current_syntax syntax region pug keepend start=/<template lang=\("\|'\)[^\1]*pug[^\1]*\1>/ end="</template>" contains=@PUG fold syntax region pug keepend start=/<template lang=\("\|'\)[^\1]*jade[^\1]*\1>/ end="</template>" contains=@PUG fold endif if s:syntaxes.slm syntax include @SLM syntax/slm.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif + unlet! b:current_syntax syntax region slm keepend start=/<template lang=\("\|'\)[^\1]*slm[^\1]*\1>/ end="</template>" contains=@SLM fold endif syntax include @JS syntax/javascript.vim -if exists("b:current_syntax") - unlet b:current_syntax -endif +unlet! b:current_syntax syntax region javascript keepend matchgroup=Delimiter start=/<script\( lang="babel"\)\?\( type="text\/babel"\)\?>/ end="</script>" contains=@JS fold +if s:syntaxes.typescript + syntax include @TS syntax/typescript.vim + unlet! b:current_syntax + syntax region typescript keepend matchgroup=Delimiter start=/<script \_[^>]*\(lang=\("\|'\)[^\2]*\(ts\|typescript\)[^\2]*\2\|ts\)\_[^>]*>/ end="</script>" contains=@TS fold +endif + if s:syntaxes.coffee syntax include @COFFEE syntax/coffee.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif + unlet! b:current_syntax " Matchgroup seems to be necessary for coffee syntax region coffee keepend matchgroup=Delimiter start="<script lang=\"coffee\">" end="</script>" contains=@COFFEE fold endif syntax include @CSS syntax/css.vim -if exists("b:current_syntax") - unlet b:current_syntax -endif -syntax region css keepend start=/<style\( \+scoped\)\?>/ end="</style>" contains=@CSS fold +unlet! b:current_syntax +syntax region css keepend start=/<style\_[^>]*>/ end="</style>" contains=@CSS fold if s:syntaxes.stylus syntax include @stylus syntax/stylus.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif - syntax region stylus keepend start=/<style lang=\("\|'\)[^\1]*stylus[^\1]*\1\( \+scoped\)\?>/ end="</style>" contains=@stylus fold + unlet! b:current_syntax + syntax region stylus keepend start=/<style \_[^>]*lang=\("\|'\)[^\1]*stylus[^\1]*\1\_[^>]*>/ end="</style>" contains=@stylus fold endif if s:syntaxes.sass syntax include @sass syntax/sass.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif - syntax region sass keepend start=/<style\( \+scoped\)\? lang=\("\|'\)[^\1]*sass[^\1]*\1\( \+scoped\)\?>/ end="</style>" contains=@sass fold + unlet! b:current_syntax + syntax region sass keepend start=/<style \_[^>]*lang=\("\|'\)[^\1]*sass[^\1]*\1\_[^>]*>/ end="</style>" contains=@sass fold endif if s:syntaxes.scss syntax include @scss syntax/scss.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif - syntax region scss keepend start=/<style\( \+scoped\)\? lang=\("\|'\)[^\1]*scss[^\1]*\1\( \+scoped\)\?>/ end="</style>" contains=@scss fold + unlet! b:current_syntax + syntax region scss keepend start=/<style \_[^>]*lang=\("\|'\)[^\1]*scss[^\1]*\1\_[^>]*>/ end="</style>" contains=@scss fold endif if s:syntaxes.less syntax include @less syntax/less.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif - syntax region less keepend matchgroup=PreProc start=/<style\%( \+scoped\)\? lang=\("\|'\)[^\1]*less[^\1]*\1\%( \+scoped\)\?>/ end="</style>" contains=@less fold + unlet! b:current_syntax + syntax region less keepend matchgroup=PreProc start=/<style \_[^>]*lang=\("\|'\)[^\1]*less[^\1]*\1\_[^>]*>/ end="</style>" contains=@less fold endif let b:current_syntax = "vue" |