mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-09 22:25:12 +08:00
feat: support vim-emmet filetype detection in .vue
This commit is contained in:
@@ -149,7 +149,7 @@ function! GetVueIndent()
|
|||||||
call s:Log('current line is vue (end) tag or prev line is vue end tag')
|
call s:Log('current line is vue (end) tag or prev line is vue end tag')
|
||||||
let ind = 0
|
let ind = 0
|
||||||
elseif s:has_init_indent
|
elseif s:has_init_indent
|
||||||
if s:SynVueScope(cursyn) && ind == 0
|
if s:SynVueScriptOrStyle(cursyn) && ind == 0
|
||||||
call s:Log('add initial indent')
|
call s:Log('add initial indent')
|
||||||
let ind = &sw
|
let ind = &sw
|
||||||
endif
|
endif
|
||||||
@@ -169,23 +169,23 @@ function! s:SynsEOL(lnum)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SynHTML(syn)
|
function! s:SynHTML(syn)
|
||||||
return a:syn =~? '\v^(vueTemplate)'
|
return a:syn =~? '\v^(htmlVueTemplate)'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SynPug(syn)
|
function! s:SynPug(syn)
|
||||||
return a:syn =~? '\v^(vueTemplatePug)'
|
return a:syn =~? '\v^(pugVueTemplate)'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SynSASS(syn)
|
function! s:SynSASS(syn)
|
||||||
return a:syn =~? '\v^(vueStyleSASS)'
|
return a:syn =~? '\v^(sassVueStyle)'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SynCSS(syn)
|
function! s:SynCSS(syn)
|
||||||
return a:syn =~? '\v^(vueStyle)'
|
return a:syn =~? '\v^(cssVueStyle)'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SynVueScope(syn)
|
function! s:SynVueScriptOrStyle(syn)
|
||||||
return a:syn =~? '\v^(vueStyle)|(vueScript)'
|
return a:syn =~? '\v(vueStyle)|(vueScript)'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:PrevMultilineEmptyTag(lnum)
|
function! s:PrevMultilineEmptyTag(lnum)
|
||||||
@@ -215,11 +215,11 @@ function! GetVueTag()
|
|||||||
let cursyns = s:SynsEOL(lnum)
|
let cursyns = s:SynsEOL(lnum)
|
||||||
let first_syn = get(cursyns, 0)
|
let first_syn = get(cursyns, 0)
|
||||||
|
|
||||||
if first_syn =~ 'vueTemplate.*'
|
if first_syn =~ '.*VueTemplate'
|
||||||
let tag = 'template'
|
let tag = 'template'
|
||||||
elseif first_syn =~ 'vueScript.*'
|
elseif first_syn =~ 'vueScript.*'
|
||||||
let tag = 'script'
|
let tag = 'script'
|
||||||
elseif first_syn =~ 'vueStyle.*'
|
elseif first_syn =~ '.*vueStyle'
|
||||||
let tag = 'style'
|
let tag = 'style'
|
||||||
else
|
else
|
||||||
let tag = ''
|
let tag = ''
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ syntax region VueExpression
|
|||||||
\ start="{{"
|
\ start="{{"
|
||||||
\ end="}}"
|
\ end="}}"
|
||||||
syntax region VueExpression
|
syntax region VueExpression
|
||||||
\ containedin=vueTemplate,VueValue,htmlString,htmlValue
|
\ containedin=htmlVueTemplate,pugVueTemplate,VueValue,htmlString,htmlValue
|
||||||
\ contains=@simpleJavascriptExpression
|
\ contains=@simpleJavascriptExpression
|
||||||
\ matchgroup=VueBrace
|
\ matchgroup=VueBrace
|
||||||
\ start="{{"
|
\ start="{{"
|
||||||
|
|||||||
@@ -138,11 +138,11 @@ syntax match htmlArg '\v<data(-[.a-z0-9]+)+>' containedin=@HTMLSyntax
|
|||||||
" Syntax highlight {{{
|
" Syntax highlight {{{
|
||||||
"
|
"
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
syntax region vueTemplate
|
syntax region htmlVueTemplate
|
||||||
\ start=+<template\(\s.\{-}\)\?>+
|
\ start=+<template\(\s.\{-}\)\?>+
|
||||||
\ end=+^</template>+
|
\ end=+^</template>+
|
||||||
\ keepend contains=@HTMLSyntax
|
\ keepend contains=@HTMLSyntax
|
||||||
syntax region vueTemplatePug
|
syntax region pugVueTemplate
|
||||||
\ start=+<template lang="pug"\(\s.\{-}\)\?>+
|
\ start=+<template lang="pug"\(\s.\{-}\)\?>+
|
||||||
\ end=+</template>+
|
\ end=+</template>+
|
||||||
\ keepend contains=@PugSyntax,vueTag
|
\ keepend contains=@PugSyntax,vueTag
|
||||||
@@ -152,19 +152,19 @@ syntax region vueScript
|
|||||||
\ end=+</script>+
|
\ end=+</script>+
|
||||||
\ keepend contains=@htmlJavaScript,jsImport,jsExport,vueTag
|
\ keepend contains=@htmlJavaScript,jsImport,jsExport,vueTag
|
||||||
|
|
||||||
syntax region vueStyle
|
syntax region cssVueStyle
|
||||||
\ start=+<style\(\s.\{-}\)\?>+
|
\ start=+<style\(\s.\{-}\)\?>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
\ keepend contains=@htmlCss,vueTag
|
\ keepend contains=@htmlCss,vueTag
|
||||||
syntax region vueStyleLESS
|
syntax region lessVueStyle
|
||||||
\ start=+<style lang="less"\(\s.\{-}\)\?>+
|
\ start=+<style lang="less"\(\s.\{-}\)\?>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
\ keepend contains=@LessSyntax,vueTag
|
\ keepend contains=@LessSyntax,vueTag
|
||||||
syntax region vueStyleSASS
|
syntax region sassVueStyle
|
||||||
\ start=+<style lang="sass"\(\s.\{-}\)\?>+
|
\ start=+<style lang="sass"\(\s.\{-}\)\?>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
\ keepend contains=@SassSyntax,vueTag
|
\ keepend contains=@SassSyntax,vueTag
|
||||||
syntax region vueStyleSCSS
|
syntax region scssVueStyle
|
||||||
\ 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