ERB Snippets
Essential ERB snippets for faster development
How to install
With Forge Super installed, the button above opens the app on this extension, where you press Install. Nothing is installed until you do.
You can also open the Extensions panel in the app and search for ERB Snippets. The extension's id is erb-snippets.
Don't have Forge Super yet? Download it here.
README
From the extension's repository, written by its authors and not by Mentenaz. See the source.
Zed ERB Snippets
A comprehensive collection of ERB snippets for Zed editor, designed to accelerate ERB development with intelligent autocomplete and placeholder support.
✨ Features
- 50+ snippets covering all common Rails ERB patterns
- Smart tab stops - quickly navigate through snippet placeholders with Tab
- Organized by category - forms, helpers, control flow, Turbo, and more
- Autocomplete support - snippets appear in Zed's autocomplete menu
- Proper ERB syntax highlighting - enhanced language support for .html.erb files
- Auto-closing tags - ERB tags <% %> auto-close as you type
- Modern Rails support - includes Turbo Frame, Turbo Stream, and latest helpers
- Zero configuration - works immediately after installation
- Lightweight - no dependencies, fast loading
- Well-documented - each snippet includes a description
What's Included ✅ Basic ERB tags (output, execution, comments) ✅ Form helpers (form_with, form_for, all input types) ✅ Link and navigation helpers ✅ Asset management helpers ✅ Control structures (if/else, loops, unless) ✅ Rendering partials and collections ✅ Turbo Frame and Turbo Stream ✅ View helpers (sanitize, truncate, time_ago, etc.) ✅ Flash messages and error handling ✅ Content management (content_for, yield, capture)
📦 Installation
Via Zed Extensions (Recommended)
- Open Zed editor
- Press
Cmd/Ctrl + Shift + Pto open the command palette - Type "extensions" and select "zed: extensions"
- Search for "ERB Snippets"
- Click "Install"
Manual Installation
-
Clone this repository:
git clone https://github.com/enderahmetyurt/zed-erb-snippets -
Copy the extension to your Zed extensions directory:
- macOS:
~/.config/zed/extensions/ - Linux:
~/.config/zed/extensions/ - Windows:
%APPDATA%\Zed\extensions\
- macOS:
-
Restart Zed
Type the prefix and press Tab to expand the snippet.
Example
pe<Tab> → <%= | %>
The | represents your cursor position.
📝 Available Snippets
Basic ERB Tags
| Prefix | Output | Description |
|---|---|---|
pe | <%= %> | ERB output tag |
pc | <% %> | ERB execution tag |
pco | <%# %> | ERB comment |
Links and Assets
| Prefix | Description |
|---|---|
lt | link_to helper |
ltb | link_to with block |
img | image_tag |
bt | button_to |
ap | asset_path |
slt | stylesheet_link_tag |
jit | javascript_include_tag |
Forms
| Prefix | Description |
|---|---|
ffw | form_with |
ff | form_for |
ftf | text_field |
fta | text_area |
fem | email_field |
fpw | password_field |
fsb | submit button |
fl | label |
fcb | check_box |
frb | radio_button |
fse | select |
fcs | collection_select |
fhf | hidden_field |
fff | file_field |
fnf | number_field |
fdf | date_field |
Control Flow
| Prefix | Description |
|---|---|
if | if statement |
ife | if-else statement |
unl | unless statement |
each | each loop |
eachi | each_with_index loop |
Rendering
| Prefix | Description |
|---|---|
rp | render partial |
rpc | render partial with collection |
cf | content_for |
yield | yield |
Turbo (Hotwire)
| Prefix | Description |
|---|---|
tf | turbo_frame_tag |
tsf | turbo_stream_from |
View Helpers
| Prefix | Description |
|---|---|
sf | simple_format |
san | sanitize |
trc | truncate |
ntc | number_to_currency |
taiw | time_ago_in_words |
dotiw | distance_of_time_in_words |
plur | pluralize |
cyc | cycle |
Common Patterns
| Prefix | Description |
|---|---|
flash | flash messages loop |
err | error messages display |
csrf | csrf_meta_tags |
Content Tags
| Prefix | Description |
|---|---|
ct | content_tag |
tag | tag helper |
sj | safe_join |
cap | capture block |
prov | provide |
💡 Tips
- All snippets include tab stops (
$1,$2, etc.) for quick navigation - Press Tab to move to the next placeholder
- Press Shift+Tab to move to the previous placeholder
- The final tab stop (
$0) places your cursor at the end
Example Workflow
ffw<Tab>
→ <%= form_with model: @model do |f| %>
|
<% end %>
ftf<Tab>
→ <%= f.text_field :attribute, class: 'form-control' %>
🛠️ Troubleshooting
If snippets don't work:
-
Check Zed's extension log:
- Open Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) - Search for "Zed: Open Log"
- Look for any errors related to your extension
- Open Command Palette (
-
Verify file paths: Make sure all files are in the correct location
-
Check JSON syntax: Validate all JSON files
-
Restart Zed: Sometimes a full restart is needed
-
Verify file extension: Make sure your file ends with
.html.erb
🤝 Contributing
Contributions are welcome! If you have ideas for new snippets or improvements:
- Fork the repository
- Create a feature branch
- Submit a pull request
🙏 Acknowledgments
Built for the Ruby on Rails community using Zed editor.
Enjoy coding with Rails ERB Snippets! 🚀
If you find this extension helpful, please star the repository and share it with other Rails developers.