TextMate tips for Rails Development
Working on Rails code for a bit has started me on the spiral into obsessively customising my dev environment (I say obsessive as at the last Rails meetup I went to there was some guy who was raving about shaving milliseconds off each line of code and therefore upto half an hour a day... I hope I don't become that guy...)
I spend most of my time in TextMate so it seemed like a great place to start the optimising... So far I've added a few TextMate bundles like Git Bundle, Project Plus and the theme from Railscasts.
I've noticed some of the other TextMate users I've come into contact with using heaps of nifty keyboard shortcuts and other plugins to help make their dev environmen开发者_Python百科t more friendly.
Looking around the net, I was a bit overwhelmed by the amount of shortcuts and plugins available... So I was hoping to hear from other Rails developers out there:
What are some good keyboard shortcuts and plugins that I should be aware of for TextMate with specific reference to Rails Development?
I've read this question on SO: What are some useful TextMate shortcuts? but I was wondering if there was something a bit more specific to Rails development.
In addition to the Rails bundle, there's probably a bundle for your unit test framework (Shoulda, RSpec), and there's also one for Cucumber (if you lean that way). There may be one for your fixture framework too (I know there's one for Machinist, don't know if there's one for FactoryGirl). If you're into HAML there's a bundle for that too, or the Formtastic bundle if you like to use that for your forms.
The Rails bundle is worth it for the migration snippets and association snippets alone. Also "Partial From Selection" is another killer feature.
Of the topic of Ruby/Rails a bit, there's also a really good jQuery bundle. I bring this up because there's a good chance your Rails project is using jQuery. There's also a Prototype/Scriptalicious bundle if you're going that way.
When I'm using TextMate, I'll use Control-Command-T (brings up the "select bundle item" window), in which I can type part of the command and TextMate will filter the list until it finds the one that matches. This is great because I can never remember obscure keyboard commands, nor triggers that I only use a few times a week.
For searching in your project, use Ack in Project: http://github.com/protocool/ack-tmbundle
Works so much better than the built in Find in Project
One of the most popular ones is ruby-on-rails-tmbundle. Available here: http://github.com/drnic/ruby-on-rails-tmbundle/tree/
This bundle adds a ton of useful commands and features. Also recommended is the peepcode tutorial on using this bundle (not free but well worth the cost): http://peepcode.com/products/textmate-for-rails-2
ProjectPlus and Getbundles are two great additions to TextMate regardless of what you're using it for. This blog post has details on both of them.
Other than that, if you know a scripting language (such as Ruby or Python—probably Ruby in your case), you can extend TextMate pretty easily to do specific tasks. This post in the TextMate manual has good information on getting started, such as how to get input piped from the text to STDIN.
An editor is only as good as what you make with it, so write some awesome apps! But if you're itching to refine your workflow a bit, these links should help.
精彩评论