<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.17023" name=GENERATOR></HEAD>
<BODY>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Tahoma
size=2><B>From:</B> Patrick Mast<BR><B>Sent:</B> Friday, April 30, 2010 4:55
AM<BR><B>Subject:</B> [TxMt] Auto Indent<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>How can I enable Auto-Indent in Textmate?</DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV>
<HR tabIndex=-1>
</DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2>Do you
mean when you type, say...</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2>function foo() {</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2>and
then hit return, and end up on the next line, and your indentation is "plus
one?" Or the equivalent for dropped curly braces? Or the equilvalent
for whatever language you're working with?</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2>It
should be on by default, but the file you're in needs to be told what type of
file it is. Once the right language grammar is applied, it should know to
auto-indent in the right places. It's possible the grammar for your
language might not be complete, or has been changed
somehow.</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2>Open
up the Bundle Editor (Bundles > Bundle Editor > Show Bundle Editor, or
Control-Option-Command-B), find you language in the list on the left, and look
for a Preference entry called "indent" or "indentation rules," or
something. Click on it, and you should see something like
this:</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>{ decreaseIndentPattern = '<SPAN
class=548435816-30042010>...</SPAN>';<BR> increaseIndentPattern<SPAN
class=548435816-30042010> </SPAN>= '<SPAN
class=548435816-30042010>...</SPAN>';</FONT></DIV>
<DIV><FONT><SPAN class=548435816-30042010></SPAN><FONT face=Arial color=#0000ff
size=2> indentNextLinePattern = '<SPAN
class=548435816-30042010>...';</SPAN><BR>}</FONT></FONT></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2>Where
the "..." represents a hot-and-heavy regular expression. I don't think any
of the keys are required, but I think you need to add an expression to
increaseIndentPattern and also to decreaseIndentPattern...sort of what starts
the indent and what closes it, I think.</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2>Check
here for some details:</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2><A
href="http://manual.macromates.com/en/appendix.html#indentation_rules">http://manual.macromates.com/en/appendix.html#indentation_rules</A></FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2>If you
don't see these entries at all, you might need to add them. I won't get
into editing bundles...it's kinda intense and I'm not the best one to tell you
about it. But if you know regular expressions, and where to look for these
types of things, you can customize existing bundles pretty
easily.</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff size=2>Hope
that helps, at least a little.</FONT></SPAN></DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=548435816-30042010><FONT face=Arial color=#0000ff
size=2>+dru</FONT></SPAN></DIV></BODY></HTML>