diff options
Diffstat (limited to 'runtime/indent/xml.vim')
-rw-r--r-- | runtime/indent/xml.vim | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim index 340981b3d..4ac35b6af 100644 --- a/runtime/indent/xml.vim +++ b/runtime/indent/xml.vim @@ -1,10 +1,11 @@ " Language: xml " Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: Tue, 27 Apr 2004 14:54:59 CEST +" Last Change: 2009-05-26 00:17:25 " Notes: 1) does not indent pure non-xml code (e.g. embedded scripts) " 2) will be confused by unbalanced tags in comments " or CDATA sections. -" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close +" 2009-05-26 patch by Nikolai Weibull +" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -46,6 +47,9 @@ fun! <SID>XmlIndentSynCheck(lnum) if '' != syn1 && syn1 !~ 'xml' && '' != syn2 && syn2 !~ 'xml' " don't indent pure non-xml code return 0 + elseif syn1 =~ '^xmlComment' && syn2 =~ '^xmlComment' + " indent comments specially + return -1 endif endif return 1 @@ -74,8 +78,12 @@ fun! XmlIndentGet(lnum, use_syntax_check) endif if a:use_syntax_check - if 0 == <SID>XmlIndentSynCheck(lnum) || 0 == <SID>XmlIndentSynCheck(a:lnum) + let check_lnum = <SID>XmlIndentSynCheck(lnum) + let check_alnum = <SID>XmlIndentSynCheck(a:lnum) + if 0 == check_lnum || 0 == check_alnum return indent(a:lnum) + elseif -1 == check_lnum || -1 == check_alnum + return -1 endif endif |