[TxMt] Newbie question -- fixing indentation?

Geoff Canyon gcanyon at inspiredlogic.com
Mon Apr 24 03:32:42 UTC 2006


On Apr 23, 2006, at 1:53 AM, Allan Odgaard wrote:

> On 23/4/2006, at 4:42, Geoff Canyon wrote:
>
>>>> If write a repeat loop (Python) everything indents properly.  
>>>> Then I want to surround the repeat loop with an if statement.  
>>>> How do I fix the indentation after that so the repeat loop is  
>>>> properly indented?
>>> Select the "block" after the if statement and hit option-tab to  
>>> indent it.
>> That certainly works. Is there a way to just get TextMate to re- 
>> examine the text as if I were typing it from scratch, and thus  
>> indent it all appropriately without me having to figure out where  
>> changes are needed?
>
> When should it do that? At all times? And enforcing the estimated  
> indent for all lines in your document?

I would think when pasting, or on command.

> There is no such “feature”.
>
> If however you often wrap code in an if loop, you could create a  
> snippet which wraps the selection and adjusts the indent. There is  
> a begin … rescue … end snippet in the Ruby bundle which does that  
> -- select text, press ctrl-shift W, and it will “wrap” the  
> selection in begin/rescue/end when the wrapped text given an extra  
> indent.

I see I have it backwards in the example I gave above. I actually ran  
into this when pasting some code into a pre-existing script. So the  
above wouldn't help in that instance. I'll look at it to see if  
there's a way I can adapt it.

Thanks!

gc


More information about the textmate mailing list