Update runtime files
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index d4b91f6..a3c32d6 100644
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -1,7 +1,7 @@
" Vim indent script for HTML
" Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de>
-" Last Change: 2021 Jun 13
+" Last Change: 2022 Jan 31
" Version: 1.0 "{{{
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@@ -149,6 +149,15 @@
let b:html_indent_line_limit = 200
endif
endif
+
+ if exists('b:html_indent_attribute')
+ let b:hi_attr_indent = b:html_indent_attribute
+ elseif exists('g:html_indent_attribute')
+ let b:hi_attr_indent = g:html_indent_attribute
+ else
+ let b:hi_attr_indent = 2
+ endif
+
endfunc "}}}
" Init Script Vars
@@ -946,11 +955,11 @@
let idx = match(text, '<' . s:tagname . '\s\+\zs\w')
endif
if idx == -1
- " after just "<tag" indent two levels more
+ " after just "<tag" indent two levels more by default
let idx = match(text, '<' . s:tagname . '$')
if idx >= 0
call cursor(lnum, idx + 1)
- return virtcol('.') - 1 + shiftwidth() * 2
+ return virtcol('.') - 1 + shiftwidth() * b:hi_attr_indent
endif
endif
if idx > 0
diff --git a/runtime/indent/testdir/html.in b/runtime/indent/testdir/html.in
index 1acf8c0..b62c67d 100644
--- a/runtime/indent/testdir/html.in
+++ b/runtime/indent/testdir/html.in
@@ -1,4 +1,4 @@
-" vim: set ft=html sw=4 :
+" vim: set ft=html sw=4 ts=8 :
" START_INDENT
@@ -41,6 +41,11 @@
dt text
</dt>
</dl>
+<div
+class="test"
+style="color: yellow">
+text
+</div>
</body>
</html>
@@ -50,6 +55,7 @@
% START_INDENT
% INDENT_EXE let g:html_indent_style1 = "inc"
% INDENT_EXE let g:html_indent_script1 = "zero"
+% INDENT_EXE let g:html_indent_attribute = 1
% INDENT_EXE call HtmlIndent_CheckUserSettings()
<html>
<body>
@@ -61,6 +67,11 @@
var v1 = "v1";
var v2 = "v2";
</script>
+<div
+class="test"
+style="color: yellow">
+text
+</div>
</body>
</html>
% END_INDENT
diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok
index c0dfc9d..938e965 100644
--- a/runtime/indent/testdir/html.ok
+++ b/runtime/indent/testdir/html.ok
@@ -1,4 +1,4 @@
-" vim: set ft=html sw=4 :
+" vim: set ft=html sw=4 ts=8 :
" START_INDENT
@@ -41,6 +41,11 @@
dt text
</dt>
</dl>
+ <div
+ class="test"
+ style="color: yellow">
+ text
+ </div>
</body>
</html>
@@ -50,6 +55,7 @@
% START_INDENT
% INDENT_EXE let g:html_indent_style1 = "inc"
% INDENT_EXE let g:html_indent_script1 = "zero"
+% INDENT_EXE let g:html_indent_attribute = 1
% INDENT_EXE call HtmlIndent_CheckUserSettings()
<html>
<body>
@@ -61,6 +67,11 @@
var v1 = "v1";
var v2 = "v2";
</script>
+ <div
+ class="test"
+ style="color: yellow">
+ text
+ </div>
</body>
</html>
% END_INDENT