12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- if exists("b:did_indent")
- finish
- endif
- runtime! indent/html.vim
- setlocal indentexpr=GetGoHTMLTmplIndent(v:lnum)
- setlocal indentkeys+==else,=end
- if exists("*GetGoHTMLTmplIndent")
- finish
- endif
- function! GetGoHTMLTmplIndent(lnum)
-
- if exists('*HtmlIndent')
- let ind = HtmlIndent()
- else
- let ind = HtmlIndentGet(a:lnum)
- endif
-
- if exists('*shiftwidth')
- let sw = shiftwidth()
- else
- let sw = &sw
- endif
-
- let last_line = getline(a:lnum-1)
- if last_line =~ '^\s*{{-\=\s*\%(if\|else\|range\|with\|define\|block\).*}}'
- let ind += sw
- endif
-
- let current_line = getline(a:lnum)
- if current_line =~ '^\s*{{-\=\s*\%(else\|end\).*}}'
- let ind -= sw
- endif
- return ind
- endfunction
|