[TxMt] Tab Always Indent and indent-region

Jeroen jeroen at je-ju.net
Fri Oct 29 08:41:48 UTC 2004


Travis P wrote:
> I'm talking about a syntax-aware indentation.  It will change the 
> indentation only if the line is not already properly indented (properly 
> is language syntax dependent naturally).  If the line is not properly 
> indented, it will be indented as appropriate with whitespace.
> 
> With the "Tab Always Indent" option, pressing tab anywhere on a line 
> causes that line to be syntax-aware re-indented (which might not do 
> anything if the line is already indented correctly).

This sounds like it would require a whole lot of coding to get this done 
properly. And it's only of use to you if it's done properly, otherwise 
you'll turn it off after two uses and never look at it again.

Also, this is something that would only work in languages where the 
indentation is defined by brackets or something. And then only for people 
with the same coding style.

Perhaps I'm a bit biased, because I mostly code in python where it simply 
is not possible to have syntax-aware indentation. (Because the indentation 
*is* syntax).

> XCode has these features too (I'm looking at version 1.1):
>   Tab Always Indent:  Indentation Preference panel: "Syntax-aware 
> indents"  and "Tab indents: Always"
>   indent-region:  ", make a selection and choose Format" menu -> 
> "Re-indent"

> 
> This feature has the nifty side-effect that it really helps finding 
> unbalanced parens/braces/etc or other mistakes (forgetting to put braces 
> around multiple statement if/else/while/for-statement bodies in 
> languages where such braces are optional if the desired body is a single 
> statement: C/C++/Java) because all of a sudden the indentation will be 
> off unexpectedly.

There already is a feature for this: when you move over a parens/brace/etc, 
the matching one lights up briefly.

> Some language coloring/styling is problematic.  In particular, when 
> looking at HTML or some code, some things are italicized.  In my 
> preferred font of non-anti-aliased Monoco 10, italicized text is largely 
> unreadable.  I like the colors, but not the style changes.

As stated before: these are almost all user contributed. If you don't like 
the way it looks, get your hands dirty and edit the syntax file...

And before you ask: A syntax highlighting configuration editor/preferences 
window is already on the list of requested features ;-)

Jeroen.



More information about the textmate mailing list