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

Chris Thomas chris at m-audio.com
Thu Feb 17 23:49:08 UTC 2005


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  useful to me too. It requires using 
macros, though. Here's a version that does everything except position 
the cursor in the block.

Chris
  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.plist
Type: application/octet-stream
Size: 2375 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20050217/19c5683a/attachment.plist>
-------------- next part --------------




More information about the textmate mailing list