mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-08 05:34:44 +08:00
refact: improve pre-processors syntax
This commit is contained in:
@@ -181,7 +181,7 @@ function! s:SynPug(syn)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SynSASS(syn)
|
function! s:SynSASS(syn)
|
||||||
return a:syn ==? 'sassVueStyle'
|
return a:syn ==? 'cssSassVueStyle'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SynCSS(syn)
|
function! s:SynCSS(syn)
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ function! s:LoadDefaultSyntax(group, type)
|
|||||||
unlet! b:current_syntax
|
unlet! b:current_syntax
|
||||||
let syntaxPaths = ['$VIMRUNTIME', '$VIM/vimfiles', '$HOME/.vim']
|
let syntaxPaths = ['$VIMRUNTIME', '$VIM/vimfiles', '$HOME/.vim']
|
||||||
for path in syntaxPaths
|
for path in syntaxPaths
|
||||||
execute 'silent! syntax include '.a:group.' '.path.'/syntax/'.a:type.'.vim'
|
let file = expand(path).'/syntax/'.a:type.'.vim'
|
||||||
|
if filereadable(file)
|
||||||
|
execute 'syntax include '.a:group.' '.file
|
||||||
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -117,12 +120,10 @@ syntax clear htmlHead
|
|||||||
|
|
||||||
" Redefine syn-region to color <style> correctly.
|
" Redefine syn-region to color <style> correctly.
|
||||||
if s:use_sass || s:use_less
|
if s:use_sass || s:use_less
|
||||||
syntax region lessDefinition transparent matchgroup=cssBraces contains=@LessSyntax
|
syntax region lessDefinition matchgroup=cssBraces contains=@LessSyntax contained
|
||||||
\ start="{"
|
\ start="{" end="}"
|
||||||
\ end="}"
|
syntax region sassDefinition matchgroup=cssBraces contains=@SassSyntax contained
|
||||||
syntax region sassDefinition transparent matchgroup=cssBraces contains=@SassSyntax
|
\ start="{" end="}"
|
||||||
\ start="{"
|
|
||||||
\ end="}"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Number with minus
|
" Number with minus
|
||||||
@@ -137,6 +138,7 @@ syntax match htmlArg '\v<data(-[.a-z0-9]+)+>' containedin=@HTMLSyntax
|
|||||||
" Syntax highlight {{{
|
" Syntax highlight {{{
|
||||||
"
|
"
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" All start with html/javascript/css for vim-emmet type detection
|
||||||
syntax region htmlVueTemplate
|
syntax region htmlVueTemplate
|
||||||
\ start=+<template\(\s.\{-}\)\?>+
|
\ start=+<template\(\s.\{-}\)\?>+
|
||||||
\ end=+</template>\ze\n\(^$\n\)*<script>+
|
\ end=+</template>\ze\n\(^$\n\)*<script>+
|
||||||
@@ -162,15 +164,15 @@ syntax region cssVueStyle
|
|||||||
\ start=+<style\(\s.\{-}\)\?>+
|
\ start=+<style\(\s.\{-}\)\?>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
\ keepend contains=@htmlCss,vueTag
|
\ keepend contains=@htmlCss,vueTag
|
||||||
syntax region lessVueStyle
|
syntax region cssLessVueStyle
|
||||||
\ start=+<style lang="less"\(\s.\{-}\)\?>+
|
\ start=+<style lang="less"\(\s.\{-}\)\?>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
\ keepend contains=@LessSyntax,vueTag
|
\ keepend contains=@LessSyntax,vueTag
|
||||||
syntax region sassVueStyle
|
syntax region cssSassVueStyle
|
||||||
\ start=+<style lang="sass"\(\s.\{-}\)\?>+
|
\ start=+<style lang="sass"\(\s.\{-}\)\?>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
\ keepend contains=@SassSyntax,vueTag
|
\ keepend contains=@SassSyntax,vueTag
|
||||||
syntax region scssVueStyle
|
syntax region cssScssVueStyle
|
||||||
\ start=+<style lang="scss"\(\s.\{-}\)\?>+
|
\ start=+<style lang="scss"\(\s.\{-}\)\?>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
\ keepend contains=@SassSyntax,vueTag
|
\ keepend contains=@SassSyntax,vueTag
|
||||||
|
|||||||
Reference in New Issue
Block a user