On Feb 17, 2005, at 6:58 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
That is an option, of course. However, it requires me to double the number of iterator snippets, differentiate the keystrokes for them and select the right one before I get into writing it. I was looking for something better.
I'll take a glance at Chris' macro tomorrow and see if it gets me there. Thanks to you both.
James Edward Gray II