[TxMt] Re: Re -indenting XML with tag on multiple lines

Daniel Stockman daniel.stockman at gmail.com
Tue Oct 6 16:26:04 UTC 2009


> Consider the following code:
>
> <gaga>
>    <bar at1="" at2="" at3="" at4="" at5=""
>        at6="" at7="" at8="" at9="" at10=""/>
>    gaga
> </gaga>
> [...]
> I imagine that this could
> be fixed by tuning the decreaseIndentPattern and  
> increaseIndentPattern for
> XML. Has anyone already done that?

The reason this doesn't work, sadly, is due to a limitation of the  
folding engine. In a nutshell, the "closing" fold needs to be at the  
same tab stop as the "opening". In my experience the indenting  
behaviour maps fairly consistently with the folding behaviour.

A workaround to make the example fold, and perhaps re-indent properly:

<gaga>
     <bar at1="" at2="" at3="" at4="" at5=""
         at6="" at7="" at8="" at9="" at10=""
     />
     gaga
</gaga>

Less than ideal, I'll grant, but you get used to it.

~ Daniel



More information about the textmate mailing list