8

When writing ERB templates in Ruby on Rails using Textmate formatting by hand pretty much sucks.

Do anyone know of a textmate bundle that handles formatting of ERB templates/views? My googling has found nothing. Thanks!

Scott Schulthess
  • 2,853
  • 2
  • 27
  • 35
  • What do you mean with formatting by hand? I think the built-in Textmate Bundle for Rails is great. – nocksock Jan 17 '10 at 15:19
  • Auto-formatting the views. When your writing straight HTML in Textmate, you can use the HTML bundle Tidy command to "cleanup" a HTML file. I'm looking for an ERB equivalent to the HTML Tidy command. – Scott Schulthess Jan 17 '10 at 15:41
  • This is SOO annoying. Would love to find a good solution to this. – Brian Armstrong Feb 05 '11 at 08:16

1 Answers1

2

I think the best solution is to use the HTML (Rails) bundle. And when you want to tidy something, you'll need to go up to the Bundles menu > HTML > Tidy.

That coupled with Indent Selection (--[) , handles most of my reformatting needs.

NOTE: unfortunately, when in the HTML (Rails) bundle, the normal tidy shortcut --H gets overridden and instead launches the "Create a partial from the selected text" when in a *.html.erb file. I'm sure there's a way to change this but it hasn't been a big enough deal for me to investigate.

bndev
  • 31
  • 5
  • ⌥⌘[ gets you almost there but for some reason doesn't indent blocks in ERB correctly. Really wish there was a better solution for this. – Brian Armstrong Feb 07 '11 at 22:39
  • HTML > Tidy via the menu would attempt to make your partial HTML snippet a full HTML document with DOCTYPE etc... – xster Apr 08 '11 at 04:08