[TxMt] Re: TM2 : problem with indentation jumping back automatically

Allan Odgaard mailinglist at textmate.org
Sun Dec 25 20:55:25 UTC 2011


On 23 Dec 2011, at 14:48, David Bourguignon wrote:

> […] Sometime when I edit a line, the line step back by one tab left.

TM2 will “correct” the indentation as-you-type.

This is done using the indent patterns¹ for the current scope.

Many languages currently have suboptimal indent patterns since TM didn’t previously use the patterns as aggressively — the problem can thus often be fixed by improving the patterns, for example I find it (now) does an excellent job at auto-indenting in C/Objective-C/C++, but then, I have refined the patterns to my style :)

Some languages make it impossible to do correct indent estimates, either due to the limited rule system or because the language lack syntax to indicate “level”, I believe HAML is such language.

In this case, it might work better to simply disable the automatic indent corrections, this can be done by creating a new settings item scoped to the particular item and setting:

    disableIndentCorrections = :true;

You’ll find an example of this in (bundle editor) Python → Settings → Disable Indention Correction.

It should be mentioned that by disabling automatic indent corrections one also change the behaviour of the re-indenting happening on paste to a heuristic that works better for indent-based languages — long-term these things need to be split into separate preferences.


¹ http://manual.macromates.com/en/appendix#indentation_rules



More information about the textmate mailing list