RubyMine – Creating live templates

Time is of the essence when you’re coding. Recently, I wrote about a line of code to get rid of a huge stack trace in rspec-rails. This will help you stay sane while you try to troubleshoot failing tests in your rails app.

config.backtrace_exclusion_patterns << /\.rvm\/gems/

However, you don’t want to have to keep typing this out every time you start a new rails app. If you use RubyMine, you’re in luck because you can just save this to a live template. Live templates act as auto-fill shortcuts in the same way that RubyMine predicts when you’re trying to type ApplicationController.

Creating a live template

If you want to create a live template, just highlight a line of text that you don’t ever want to have to type again, like the one above. Then go to the Tools Menu and select Save as Live Template. It will bring up a window where you can assign that code to an Abbreviation.


Then just hit okay and go into any file in RubyMine. Start typing your abbreviation and you should see a window popup with a suggestion. In the example above, I just type in back and hit TAB to let RubyMine take care of the rest.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s