|
|
|
SearchCategories
Books by the AuthorOther Ruby Projects |
Ruby Idioms Bundle for TextMate
Posted over 2 years ago
in Tools of the Trade.
Update: An improved version of Ruby Idioms has been merged into the Ruby bundle in the latest versions of TextMate. Everyone gets Ruby Idioms with TextMate now. Is that good news or what? If you are a TextMate user (a Mac OS X text editor), we have something in common and you might be interested in the rest of this post. If not, skip it. I have made my Ruby Idioms bundle available for anyone who would like to download it and try it out. This bundle contains all the Ruby shortcuts I use to program everyday. I've spent a lot of energy over the last six months refining them down to the keystroke, so hopefully there is a lot of value hidden in there. If you just want to get to the goods and start playing, click the above link and run. However, if you want some insight into my thinking with these shortcuts, read on... Tab TriggersI'm a Unix guy, so I'm very comfortable with two or three letter triggers and that's what you are going to find here. Sometimes I use a one or two caracter trigger (r, w, and rw just make sense for I mention this because it is not the TextMate style and may be a turn off to some. IteratorsAll the core and many standard iterators are included in this bundle. I do mine differently from the normal TextMate style though, so I better mention that too. I find myself skipping around the object when it is included in the block more often than not (and I know where the escape key is when I do need the object), so I just want an empty block that leaves the snippet when I enter it (in case I need new triggers). That's my style. TestsI've included a compete set of test snippets in this bundle. It duplicates some work in the Rails bundle, but my opinion is that those tests are misplaced there anyway. Automatic RequiresSome of my macros are really just snippets that ensure you have the proper require statement for the code. This can cause TextMate to flash the syntax highlighting because I have to replace all the code up to the cursor. If you would like to use the snippet, without the magic requires, just add a - to the end of the tab trigger. I use magic requires only where they make sense. For example, IdiomsYou will find some imaginary methods as snippet names, like That Personal TouchI wasn't kidding when I said these shortcuts are tuned to the keystroke. I've refined them after a lot of actual usage for what works best for me. You'll notice that extra tab stop in unix_filter I leave in just to activate paragraph mode when I need it and that deleting OTHER_ARGS in the option parsing code also removes the extra space. There are larger scale preferences too, of course. If you think like I do or can at least get into the flow, this should become pretty comfortable to work with. If not, it may just become a hellish set of magic rules you cant understand or remember. If the lattar is true, you may have to resort to you own bundle of tricks, but perhaps this will at least give you some ideas. FeedbackI welcome any feddback, suggestions, or cool new idioms to include. Send 'em in. |
|
|
|
Sweet.
Great bundle, extremely helpful, thanks!
Thanks the efforts to put this bundle out there.
I checked out the TextMate svn and while browsing the code found several references to your home directory in the bundlePath key. (grep bundlePath Macros/*.plist) I don't know enough TextMate to know whether that's a problem. Just thought I'd point it out.
Dave B: Allan tells me this is normal TextMate behavior.
I am a TextMate newbie. Has this stuff been added to the regular TextMate distribution (I purchased TextMate 2 months ago)? I downloaded the file and double clicked. TextMate has installed it, but I think I should remove it and I don't know how.
I have been using the Ruby and Rspec boundle with out any problems - other than I don't know what I am doing yet.
I enjoy your blog and use your book. I can't find out whether is OK to just remove the Ruby Idioms.tmbundle file from the application support/TextMate/... directory.
Thank you, Carlton Mills, Urbana, Illinois (birthplace of HAL)
OK. I should have read more carefully. This was the beginning of the Ruby bundle that I have. My bad!! I disavow previous message and will deny it's existence.
Yes, I just leave this post around for historical reference. The bundle is now the official Ruby bundle included with TextMate.
You can find help for deleting the bundle on the official site.