The package to help use erb template user that easy and quick to finish the ERB tag.
With Package Control:
- Run "Package Control: Install Package" command, find and install
ERB Autocomplete
package. - Restart your sublime text editor.
Manually:
- Clone or download git repo into your Sublime Text packages folder.
git clone https://github.com/CasperLaiTW/ERBAutocomplete.git "ERB Autocomplete"
- Restart your sublime text editor.
We are support ST2 and ST3 now.
The .base
file is project root, its include ERB Autocomplete
package's configuration.
{
"partials" : "partials"
}
We suggest you create this file. If you don't want, it's ok. We will use default setting.
You would set syntax to ERB.
And you can:
Manually:
- Type ERB keyword like if, else or nothing.
- Press
Control
+space
, will activate completion. ST would popup to tip you and select you want.
Automatic completion:
- Open your user settings file.
- Add
text.html.erb
toauto_complete_selector
, you should according to your settings to set.
This is example.
"auto_complete_selector" : "text.html.erb, source - comment, meta.tag - punctuation.definition.tag.begin"
- Reset your Sublime Text editor.
- And now you type if, else, the editor will automatic activate completion.
We support quick to create layout file. You can Press Ctrl
+ Alt
+ l
, Sublime Text will show input panel to you and type your custom layout filename. We will create the file in your project.
If you press keyboard shortcut, Sublime Text would only create new file and show. Sublime text don't show input panel. That's means you don't open any file window and active in your project. So you should open any file window in your project. It will be working.
If your project is not root, means your project's parent have any folder. Please create a file named .base
in your project. We will detect the file and means this is your project root. Layout will created in this folder.
- Open you want to mapping view.
- Run command
ERB: Add Layout Mapping
- Sublime Text will show all layout in your project.
- Select layout you want.
- Done!!!
- Open you want to unmapping view.
- Run command
ERB: Remove Layout Mapping
- Auto delete mapping file. Done!!!
Partial view default folder name: partials
- Open your file and cursor to you want to added.
- Run command
ERB: ERB: Add Partial Mapping
- Sublime Text will show all partial views in project's partial folder.
- Select partial view you want.
- Done!!!
OSX:
- Toggle Mark comment – Command+.
- Create custom layout file - Command+Alt+l
Linux / Windows:
- Toggle Mark comment – Ctrl+.
- Create custom layout file - Ctrl+Alt+l