Home Download Buy Blog Forum Support

insert erb tags

insert erb tags

Postby dgm on Sun Aug 21, 2011 10:08 pm

One very common feature of textmate that I miss is to add erb tags, and cycle them:

<%= %> using ctrl (shift) '>'

Is there any equivalent in sublime?
dgm
 
Posts: 4
Joined: Sat Aug 13, 2011 8:07 am

Re: insert erb tags

Postby nobleach on Mon Aug 22, 2011 7:30 pm

I actually add this snippet to every editor I use. I use the NetBeans standard of "re+TAB" for <%= %> and "r+TAB for <% %>... just cause NetBeans is the editor I was using when I started doing Ruby. Get Ryan Bates' "Ryan on Rails" bundle for some really helpful ERB stuff.

Creating snippets yourself is super easy. Take a look in your package directory for some great examples.
nobleach
 
Posts: 48
Joined: Thu Jun 23, 2011 4:14 pm

Re: insert erb tags

Postby aunderwo on Wed Sep 14, 2011 3:20 pm

Adding the following into the User sublime-keymap file adds the function to insert <%= 5> but it doesn't toggle between <% %> unfortunately :cry: . Anybody have any ideas?
Code: Select all
  { "keys": ["ctrl+shift+."], "command": "insert_snippet", "args": {"contents": "<%= ${0:$TM_SELECTED_TEXT} %>"}, "context":
     [
        { "key": "selector", "operator": "equal", "operand": "text.html, source.yaml, meta.erb" }
     ]
  }
aunderwo
 
Posts: 7
Joined: Thu Sep 08, 2011 9:40 am

Re: insert erb tags

Postby eddorre on Wed Sep 21, 2011 3:51 am

I've created a plugin that inserts and cycles the ERB tags. You can download it here:

https://github.com/eddorre/SublimeERB
eddorre
 
Posts: 1
Joined: Wed Sep 21, 2011 3:49 am

Re: insert erb tags

Postby dgm on Tue Oct 04, 2011 6:03 am

awesome, this needs to be added natively to sublime.
dgm
 
Posts: 4
Joined: Sat Aug 13, 2011 8:07 am


Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 20 guests