Improve multiple line tag syntax and custom tag indent

This commit is contained in:
leafOfTree
2021-08-04 11:14:15 +08:00
parent 44b0071e2d
commit 0e68102487
2 changed files with 11 additions and 6 deletions

View File

@@ -86,8 +86,8 @@ function! s:GetIndentByContext(tag, syntax)
let prevline = getline(s:PrevNonBlankNonComment(v:lnum))
let curline = getline(v:lnum)
if a:tag == 'view'
" Support 'view' tag from mini-program
if a:tag != 'template' && a:syntax == 'html'
" Set indent to 0 for custom tag with 'html' syntax
if curline =~ s:block_tag && empty(prevline)
let ind = 0
endif
@@ -99,7 +99,8 @@ function! s:GetIndentByContext(tag, syntax)
endif
endif
else
" When not in <template>, set block tags indent to 0
" When not in <template> and not 'html'
" Set indent to 0 if current or prev line is block tag
if curline =~ s:block_tag || prevline =~ s:block_tag
let ind = 0
endif