Hello,
I'am now using TM2 as my main editor, and I am quite happy with it.
I noticed a annoying problem : I edit a lot of HAML files, where the indentation id syntactically relevant.
Sometime when I edit a line, the line step back by one tab left. I can reproduce it easily :
- @countries.each_with_index do |country, index|
- unless
Making a backspace at the end of the "unless" line make the line go left by 2 chars. I have setup soft tabs of 2. This is using the Ruby Haml bundle.
Any idea ?
++ David
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