ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

ERB Autocomplete

by CasperLaiTW ST2/ST3

The package to help use erb template user that easy and quick to finish the erb tag.

Labels ERB, auto-complete

Details

  • 2017.06.23.03.47.01
  • github.​com
  • github.​com
  • 4 months ago
  • 1 hour ago
  • 4 years ago

Installs

  • Total 18K
  • Win 3K
  • OS X 9K
  • Linux 5K
Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4
Windows 3 2 1 1 2 2 1 1 1 2 0 4 0 5 3 2 3 2 3 1 1 2 4 1 2 0 0 3 3 7 0 6 1 3 0 6 2 4 2 3 3 4 2 1 4 4
OS X 5 4 1 9 0 6 8 7 5 7 9 1 4 7 9 5 7 8 2 6 4 15 14 12 2 5 6 9 6 11 10 10 4 3 9 9 10 3 3 3 2 8 13 6 10 5
Linux 2 2 7 3 2 1 5 2 2 4 3 1 2 5 4 5 2 9 4 3 2 6 1 6 4 1 3 7 3 1 5 10 3 0 3 6 2 4 2 3 0 5 3 4 6 4

Readme

Source
raw.​githubusercontent.​com

ERB Autocomplete

The package to help use erb template user that easy and quick to finish the ERB tag.


How to install

With Package Control:

  1. Run “Package Control: Install Package” command, find and install ERB Autocomplete package.
  2. Restart your sublime text editor.

Manually:

  1. Clone or download git repo into your Sublime Text packages folder.
git clone https://github.com/CasperLaiTW/ERBAutocomplete.git "ERB Autocomplete"
  1. Restart your sublime text editor.

We are support ST2 and ST3 now.

.base file

The .base file is project root, its include ERB Autocomplete package's configuration. “json { "partials” : “partials” }

We suggest you create this file. If you don't want, it's ok. We will use default setting.

## Auto complete
You would set syntax to **ERB**.

And you can:

Manually:

1. Type ERB keyword like **if**, **else** or nothing.
2. Press `Command` + `space`, will activate completion. ST would popup to tip you and select you want.

Automatic completion:

1. Open your user settings file.
2. Add `text.html.erb` to `auto_complete_selector`, you should according to your settings to set.

  This is example.
  ```json
  "auto_complete_selector" : "text.html.erb, source - comment, meta.tag - punctuation.definition.tag.begin"
  1. Reset your Sublime Text editor.
  2. And now you type if, else, the editor will automatic activate completion.

Create layout

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.

Manage page and layout mapping

Mapping layout

  1. Open you want to mapping view.
  2. Run command ERB: Add Layout Mapping
  3. Sublime Text will show all layout in your project.
  4. Select layout you want.
  5. Done!!!

Unmapping layout

  1. Open you want to unmapping view.
  2. Run command ERB: Remove Layout Mapping
  3. Auto delete mapping file. Done!!!

Added partials

Partial view default folder name: partials

  1. Open your file and cursor to you want to added.
  2. Run command ERB: ERB: Add Partial Mapping
  3. Sublime Text will show all partial views in project's partial folder.
  4. Select partial view you want.
  5. Done!!!

Avaiable actions

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