GithubHelp home page GithubHelp logo

matthewrobertson / erb-sublime-snippets Goto Github PK

View Code? Open in Web Editor NEW
324.0 12.0 81.0 54 KB

A collection of sublime text snippets useful for coding ERB templates

Home Page: https://github.com/matthewrobertson/ERB-Sublime-Snippets

License: Do What The F*ck You Want To Public License

erb-sublime-snippets's Introduction

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 ..., ... %>
cl_image_tag helper cli <%= cl_image_tag 'path' {option} %>
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(@model`) do
simple_form_for helper sf <%= simple_form_for(@model`) do
f.input helper fi <%= f.input ... %>
f.button helper fs <%= f.button :input ... %>
time_ago_in_words helper tw <%= time_ago_in_words(...) %>
t() helper t <%= t('@model') %>

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

erb-sublime-snippets's People

Contributors

ascendbruce avatar barnabed avatar benkoshy avatar cestivan avatar hashtagerinl avatar ishanray avatar jasonharrison avatar matthewrobertson avatar moalamin avatar renny-ren avatar sdlong avatar turadg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

erb-sublime-snippets's Issues

Clarify README.md

We may consider clarifying the tab triggers listed in README.md by noting that the underscores indicate empty space surrounding the trigger.

Sublime Text 3

Error parsing snippet xml: expected = in file Packages/ERB_Snipptes/end_erb.sublime-snippet on line: 9

Others seem to be fine

User Configurations

Most of the issues and PRs I get for this project would be solved if there was a way to make the scopes and tab triggers configurable. Unfortunately, I don't know if there is a way to do that for snippets. Right now the best I can suggest is that people fork the project, edit the snippet files and install their custom fork.

Using 'er' and tabbing doesn't work.

This has been bothering me for a long time now, I've only just looked at it and I've found that if I change the scope to 'text.html.ruby' instead of 'text.html.rails', it starts working again.

form_with

Can you add "form_with" snippets? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.