How can I enable Auto-Indent in Textmate?
Do you
mean when you type, say...
function foo() {
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?
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.
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:
{ decreaseIndentPattern = '...';
increaseIndentPattern = '...';
indentNextLinePattern = '...';
}
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.
Check
here for some details:
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.
Hope
that helps, at least a little.
+dru