diff --git a/rc/base/html.kak b/rc/base/html.kak
index ca7132f2..cd43e66d 100644
--- a/rc/base/html.kak
+++ b/rc/base/html.kak
@@ -44,12 +44,12 @@ def -hidden html-filter-around-selections %{
try %{ exec -draft -itersel s \h+$ d }
}
-def -hidden html-indent-on-char %{
- eval -draft -itersel %{
+def -hidden html-indent-on-greater-than %[
+ eval -draft -itersel %[
# align closing tag to opening when alone on a line
- try %{ exec -draft s ^\h+(\w+)>$ 1 s \A|.\z 1 }
- }
-}
+ try %[ exec -draft s ^\h+/(\w+)$ {c1,/1 s \A|.\z 1 ]
+ ]
+]
def -hidden html-indent-on-new-line %{
eval -draft -itersel %{
@@ -69,7 +69,7 @@ hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-high
hook global WinSetOption filetype=(?:html|xml) %{
hook window InsertEnd .* -group html-hooks html-filter-around-selections
- hook window InsertChar .* -group html-indent html-indent-on-char
+ hook window InsertChar '>' -group html-indent html-indent-on-greater-than
hook window InsertChar \n -group html-indent html-indent-on-new-line
}