A collection of sublime text snippets useful for coding ERB templates
Switch branches/tags
Nothing to show
Clone or download
Latest commit 7b77ee7 Jun 8, 2018
Permalink
Type Name Latest commit message Commit time
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 Merge pull request #21 from jasonharrison/master Jun 8, 2018
comment_erb.sublime-snippet remove source.js from scope Mar 15, 2018
each_erb.sublime-snippet remove source.js from scope Mar 15, 2018
else_erb.sublime-snippet remove source.js from scope Mar 15, 2018
elsif_erb.sublime-snippet remove source.js from scope Mar 15, 2018
end_erb.sublime-snippet remove source.js from scope Mar 15, 2018
erb.sublime-snippet remove source.js from scope Mar 15, 2018
erb_translation.sublime-snippet remove source.js from scope Mar 15, 2018
form_for_erb.sublime-snippet remove source.js from scope Mar 15, 2018
if_else_erb.sublime-snippet remove source.js from scope Mar 15, 2018
if_erb.sublime-snippet remove source.js from scope Mar 15, 2018
image_tag.sublime-snippet remove source.js from scope for image_tag Mar 15, 2018
label_tag.sublime-snippet remove source.js from scope Mar 15, 2018
link_to.sublime-snippet remove source.js from scope Mar 15, 2018
password_tag.sublime-snippet remove source.js from scope Mar 15, 2018
print_erb.sublime-snippet remove source.js from scope Mar 15, 2018
submit_tag.sublime-snippet remove source.js from scope Mar 15, 2018
text_field_tag.sublime-snippet remove source.js from scope Mar 15, 2018
unless_erb.sublime-snippet remove source.js from scope Mar 15, 2018

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 %>
image_tag helper it <%= image_tag ..., ... %>
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
form_for helper ff `<%= form_for(@ ) do
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