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

James Edward Gray II james at grayproductions.net
Thu Feb 17 22:44:17 UTC 2005


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

I was trying to do this with a command, but it proved harder than I 
expected.  Any tips are greatly appreciated.

Thanks.

James Edward Gray II




More information about the textmate mailing list