A collection of sublime text snippets useful for coding ERB templates
Latest commit be2ce98 Oct 16, 2015 @matthewrobertson Merge pull request #17 from malamin92/master
form_for trigger to ff
Permalink
Failed to load latest commit information.
.gitignore added a test erb file Mar 14, 2013
LICENSE.txt added the do what the fuck you want license Jun 30, 2012
README.md Changed trigger for form_for from 'form' to 'ff' because default subl… Oct 14, 2015
comment_erb.sublime-snippet removed comments and useless scopes Mar 14, 2013
each_erb.sublime-snippet removed comments and useless scopes Mar 14, 2013
else_erb.sublime-snippet changed dashes to underscores in file names for consistency Mar 14, 2013
elsif_erb.sublime-snippet changed dashes to underscores in file names for consistency Mar 14, 2013
end_erb.sublime-snippet removed comments and useless scopes Mar 14, 2013
erb.sublime-snippet removed comments and useless scopes Mar 14, 2013
erb_translation.sublime-snippet added erb_translation snippets Sep 11, 2013
form_for_erb.sublime-snippet Changed trigger for form_for from 'form' to 'ff' because default subl… Oct 14, 2015
if_else_erb.sublime-snippet removed comments and useless scopes Mar 14, 2013
if_erb.sublime-snippet removed comments and useless scopes Mar 14, 2013
label_tag.sublime-snippet Adds text_field_tag snippet Jan 14, 2014
link_to.sublime-snippet removed comments and useless scopes Mar 14, 2013
password_tag.sublime-snippet Adds text_field_tag snippet Jan 14, 2014
print_erb.sublime-snippet removed comments and useless scopes Mar 14, 2013
submit_tag.sublime-snippet Adds text_field_tag snippet Jan 14, 2014
text_field_tag.sublime-snippet Adds text_field_tag snippet Jan 14, 2014
unless_erb.sublime-snippet Add unless_ERB snippet. Mar 31, 2014

README.md

ERB-Sublime-Snippets

A collection of Sublime Text snippets useful for writing ERB

Installation

These snippets can now be installed via Sublime Package Control. If you do not use package control, simply checkout the source code into Sublime Text's packages directory. The location is system specific:

For OSX

$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/
$ git clone git://github.com/matthewrobertson/ERB-Sublime-Snippets.git ERB_Snippets

For Windows

$ cd %APPDATA%/Sublime Text 2/Packages/
$ git clone git://github.com/matthewrobertson/ERB-Sublime-Snippets.git ERB_Snippets

For Linux

$ cd ~/.Sublime Text 2/Packages/
$ git clone git://github.com/matthewrobertson/ERB-Sublime-Snippets.git ERB_Snippets

Snippets and Bindings

Snippet Tab Trigger Output
ERB tags er <% %>
print ERB tags pe <%= %>
print ERB comment pc <%# %>
if block if <% if %>...<% end %>
if / else block ife <% if %>...<% else %>...<% end %>
else tag else <% else %>
elsif tag elsif <% elsif %>
unless block unless <% unless %>...<% end %>
end block end <% end %>
submit_tag helper st <%= submit_tag ..., ... %>
text_field_tag helper tft <%= text_field_tag ..., ... %>
password_field_tag helper pft <%= password_field_tag ..., ... %>
label_tag helper lblt <%= label_tag ..., ... %>
link_to helper lt <%= link_to ..., ... %>
each helper each <% @things.each do |thing| %> ... <% end %>
form_for helper ff <%= form_for(@ ) do |f| %> ... <% end %>
t() helper t <%= t('@') %>

Resolve conflicting tab trigger

It is possible for the snippets in this package to conflict with other Sublime text plugins, such as the built-in Rails package or Rails Developer Snippets. You may want to disable unwanted snippets.

For Sublime Text 2

Delete unwanted snippet files from ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/<PackageName>/

For Sublime Text 3

  1. Install the PackageResourceViewer Package
  2. Open unwanted snippets with PackageResourceViewer: Open Resource command and comment it out

Questions, Comments, Concerns?

Feel free to submit a pull request with any snippets you would like to add to the project. If you have any problems or suggestions you can contact me on twitter.

License

Released under WTFPL, Version 2