Tuesday, January 5, 2010

indenting wrapped lines in XML

I've been struggling to figure out how to modify the indentation
behavior for XML files when attributes are continued among multiple
lines.

Here's a summary of what I'd like to see:

<parent attr1="one" attr2="two
attr3="three"
attr4="four">
<child attr1="one"/>
</parent>


with two-space indenting, I'd like to have a wrapped line (attr3 and
attr4) indent one extra level; in this case, I'd like a total of four
spaces... 2 for the standard next-level indentation, plus 2 for a
"bonus because it's wrapped" indentation.

I *think* this is the same behavior that cinoptions=+2 would give for
C-style files and the like.

Has anybody tackled this or something similar?

Thanks in advance,
Jim

No comments: