Skip to content

Commit

Permalink
vim: monkey-patch html indent
Browse files Browse the repository at this point in the history
See also: vim/vim#3673

In addition, set as "auto" tags that apply to "content" (as opposed to
e.g. layout, metadata), so that the former can be flush at left margin.
  • Loading branch information
muhmuhten committed Dec 7, 2018
1 parent d8dbab4 commit 6bee1d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions vim/after/indent/html.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
setl inde=FixedHtmlIndent()
func! FixedHtmlIndent()
let indent = HtmlIndent()
let b:hi_lasttick = b:changedtick - 1
return indent
endfunc
11 changes: 8 additions & 3 deletions vim/indent/html.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
let g:html_indent_script1 = 'inc'
let g:html_indent_style1 = 'inc'
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
let g:html_indent_autotags = join(["html","body","article","main","section",
\"a","abbr","b","bdi","bdo","cite","code","data","del","dfn","em",
\"i","ins","kbd","mark","q","s","ruby","samp","small","span",
\"strong","sub","sup","time","u","var","wbr",
\"area","keygen","rp","rt","track","wbr","content","shadow"], ",")
let g:html_indent_inctags = join(["dialog","hgroup","slot"], ",")

setl ts=2

let s:undo = exists("b:undo_indent") ? b:undo_indent . "|" : ""
let b:undo_indent = s:undo . "setl ts<"

0 comments on commit 6bee1d9

Please sign in to comment.