[TxMt] Automating { ... } to do ... end

Chris Thomas chris at m-audio.com
Fri Feb 18 00:10:42 UTC 2005


On Feb 17, 2005, at 3:49 PM, Chris Thomas wrote:

> On Feb 17, 2005, at 3:24 PM, Fred B. wrote:
>> On 17 févr. 05, at 23:44, James Edward Gray II wrote:
>>> I want to build a command, macro or whatever to have TextMate do a 
>>> chore for me. I've taken a couple of passes at it, but I'm not 
>>> having much luck yet and could use a little help.
>>> I have many snippets that help me quickly build Ruby iterators.  
>>> Here's the one for each():
>>> .each { |${1:e}| ${1:e}.$0 }
>>> So when I run that I get:
>>> .each { |e| e.<cursor here> }
>>> When those are getting longish, I break them up over multiple lines, 
>>> but I switch { ... } to do ... end.  So I want to change the above 
>>> to:
>>> .each do |e|
>>>     e.<cursor here>
>>> end
>> Sorry if I'm missing something, but would this be ok for you?
>> each  |${1:element}| do
>>     ${1:element}.$0
>> end
> I think Fred is looking for a command to transform the {..} form to 
> the do..end form. This would be very
           ^^^^ James. Sorry.

> useful to me too. It requires using macros, though. Here's a version 
> that does everything except position the cursor in the block.
> Chris
>
> <Test.plist>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list