Useful tips when using Textmate

I don’t get to use Textmate (hopefully E will suffice), so I don’t know if these tips are even worth sharing. But you never know… just because I can’t benefit from them, doesn’t give me the right to hold you back.

Ruby Documentation

When you’re coding and you draw a blank on what the acceptable parameters are (strftime for example), in Textmate, with your cursor at the end of the method you can hit CTRL+H to bring up the RDoc for that method. It would probably take me a bit to get used to doing that, but I’m always referencing documentation, so I could see that being huge for me.

Finding your way around

Let’s say you’re inside of a controller method, if you hit OPTION+COMMAND+SHIFT+DOWN, you will be presented with a drop down to navigate to the associated files (views, helpers, etc) for that method. Seems to be a nice and easy way to navigate.

Displaying the Schema

If you’re in a model, and you need some DB table details, hitting CTRL+UP+OPTION+S will pop-up the schema for that model, displaying the column, primary key, data type, and default value.

Completions

You can use the ESC key to complete what you’ve typed so far, based on matches within the current document (handy if you use long, descriptive method names).

Refactor Partials

I am grateful for the ability to refactor partials. All you have to do is select the chunk of view that you want to convert to a partial, and hit CTRL+UP+H (I think this is possible in E, too). This will prompt you for a partial name, then replace your text with a <%= render :partial => 'the_name_you_chose' %>, and create the partial using the replaced text. Very useful.

Footnotes Plugin

The footnotes plugin throws up a simple footer allowing you to access and monitor everything around the current action and the application in which it resides. For instance, you can easily view (and edit) the controller, the template for the current action, the layout, and the JS. You can also view the session, cookies, params, and debug. This is only for Mac, but seems like it’s an unobtrusive way to monitor things in development.

Like I said, these tips may be very common to Textmate users (and why wouldn’t they be… I don’t even use Textmate and I know about them). Anyway, that’s just the tip of the iceberg. I’m not going to try and link to all the useful references for Textmate, but they are worth looking up—just Google it. And just today, Chris mentioned word of a new Textmate book that’s either out or is coming out soon, and it’s fairly cheap.

Comments

01

Chris on Wed Mar 07 at 03:46AM

Just a note that the CTRL+H tip works for more than just Ruby – I’ve used it in CSS and HTML, as well.

02

Ryan on Wed Mar 07 at 06:14AM

Ahh… sweet.

Have something to say?
Please rewrite the image text Are You Human? Hint: Are You Human? Formatting Tips

or

© 2009 Ryan Heath | Site Management A Ruby on Rails production.

Get in Touch