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

Fred B. fredb7 at starflam.com
Thu Feb 17 23:24:07 UTC 2005


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

--
Fred



More information about the textmate mailing list