[SVN] Re: Indentation issues

Allan Odgaard mailinglist at textmate.org
Wed Mar 21 03:27:30 UTC 2012


On 02/03/2012, at 22.27, Paulo Moura wrote:

> TM have a "indentNextLinePattern" but not "unindentNextLinePattern". Is there a way to define a pattern such that the next line is unindented but not the current line? I tried "decreaseIndentPattern" but this setting insist on acting on the current line (while "increaseIndentPattern" acts on the next line; why the apparent lack of symmetry?).

The indentNextLinePattern affects only next line, although it “stacks up” the indent, incase next line is also matched by this pattern. E.g.

   1. if true
   2.    while false
   3.       /* loop */;
   4. /* back to normal indent */;

Here line 1 is matched and so, line 2 is indented. Line 2 is also matched, so line 3 gets double indent. Line 3 is _not_ matched, so line 4 is back to the indent of line 1.

So you don’t want full symmetry here wrt. decrease next line.

Can you provide a complete Logtalk example?

> The only indentation rule I have (for the Logtalk language) is:
> […] But I cannot find a way to get this behavior using "decreaseIndentPattern", which results in the line ending with a "." getting unindented instead of the next line.

Right, the rules were made pretty much for C-style languages where the token that indicates “end of block” is itself de-indented.

> On TM2, using the same settings that work fine on TM1, indentation is driving me crazy and preventing me to switch to TM2 for everyday programming tasks. Specifically, on TM1, when you insert one of more black lines, TM1 wants to start at the same indent level as the last non-empty line. That's not usually want I want so I just hit backspace, start typing, and everything is fine. But, on TM2, after hitting backspace, the cursor just jumps to the last indent level as soon as I type the first character, forcing me to go back, again, and correct the indentation.

The new auto-correction behavior can be disabled, see http://wiki.macromates.com/FAQ/TextMate2



More information about the textmate-dev mailing list