mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-06 20:54:30 +08:00
Support view block
This commit is contained in:
@@ -244,7 +244,7 @@ function! vue#LoadDefaultSyntax(group, syntax)
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if loaded
|
if loaded
|
||||||
call vue#Log(a:syntax.': laod default')
|
call vue#Log(a:syntax.': load default')
|
||||||
else
|
else
|
||||||
call vue#Warn(a:syntax.': syntax not found in '.string(syntax_paths))
|
call vue#Warn(a:syntax.': syntax not found in '.string(syntax_paths))
|
||||||
call vue#Warn(a:syntax.': load full instead')
|
call vue#Warn(a:syntax.': load full instead')
|
||||||
|
|||||||
@@ -86,18 +86,23 @@ function! s:GetIndentByContext(tag, syntax)
|
|||||||
let prevline = getline(s:PrevNonBlankNonComment(v:lnum))
|
let prevline = getline(s:PrevNonBlankNonComment(v:lnum))
|
||||||
let curline = getline(v:lnum)
|
let curline = getline(v:lnum)
|
||||||
|
|
||||||
" When not in <template>, set block tags indent to 0
|
if a:tag == 'view'
|
||||||
if a:tag != 'template'
|
" Support 'view' tag from mini-program
|
||||||
if curline =~ s:block_tag || prevline =~ s:block_tag
|
if curline =~ s:block_tag && empty(prevline)
|
||||||
let ind = 0
|
let ind = 0
|
||||||
endif
|
endif
|
||||||
else
|
elseif a:tag == 'template'
|
||||||
" When 'pug' syntax in <template>, set block tags indent to 0
|
" When 'pug' syntax in <template>, set block tags indent to 0
|
||||||
if a:syntax == 'pug'
|
if a:syntax == 'pug'
|
||||||
if curline =~ s:block_tag
|
if curline =~ s:block_tag
|
||||||
let ind = 0
|
let ind = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
" When not in <template>, set block tags indent to 0
|
||||||
|
if curline =~ s:block_tag || prevline =~ s:block_tag
|
||||||
|
let ind = 0
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ syntax region VueExpression
|
|||||||
\ start="{{"
|
\ start="{{"
|
||||||
\ end="}}"
|
\ end="}}"
|
||||||
syntax region VueExpression
|
syntax region VueExpression
|
||||||
\ containedin=htmlTemplateBlock,pugTemplateBlock,VueValue,htmlString,htmlValue
|
\ containedin=VueValue,htmlString,htmlValue,.*TemplateBlock,html.*Block
|
||||||
\ contains=@simpleJavascriptExpression
|
\ contains=@simpleJavascriptExpression
|
||||||
\ matchgroup=VueBrace
|
\ matchgroup=VueBrace
|
||||||
\ start="{{"
|
\ start="{{"
|
||||||
|
|||||||
@@ -179,9 +179,9 @@ endfunction
|
|||||||
|
|
||||||
function! VimVuePluginSyntaxMain(...)
|
function! VimVuePluginSyntaxMain(...)
|
||||||
call s:Init()
|
call s:Init()
|
||||||
|
call s:SetBlockSyntax(s:config_syntax)
|
||||||
let syntax_list = vue#GetSyntaxList(s:config_syntax)
|
let syntax_list = vue#GetSyntaxList(s:config_syntax)
|
||||||
call s:LoadSyntaxList(syntax_list)
|
call s:LoadSyntaxList(syntax_list)
|
||||||
call s:SetBlockSyntax(s:config_syntax)
|
|
||||||
call s:SetIsKeyword()
|
call s:SetIsKeyword()
|
||||||
call s:HighlightVueTag()
|
call s:HighlightVueTag()
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user