Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Add some info about changed snippets.

Snippets are basically aligned with Jinja2.
  • Loading branch information
deathaxe committed Oct 20, 2024
1 parent 3d0d5bb commit 1a0b0ee
Showing 1 changed file with 46 additions and 19 deletions.
65 changes: 46 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,55 @@ Since a user can have more than one templating language package installed, this

### Snippets

This package adds basic snippets for common code blocks. If you want more snippets, then please follow the official documentation on
[snippets](https://www.sublimetext.com/docs/completions.html#snippets) and create your own. Or use [SnippetMaker](https://packagecontrol.io/packages/SnippetMaker) for convenience.

- apply
- autoescape
- block
- dump
- embed
- extends
- for
- if
- if else
- include
- macro
- sandbox
- set
- verbatim
- with
Basic snippets for each keyword are provided to create expressions without bothering with `{% %}`.

| **Tab Trigger** | **Twig Tag**
|-------------------|-----------------------
| `autoescape` | `{% autoescape %}`
| `endautoescape` | `{% endautoescape %}`
| ... | ...

Prefixed with `b` basic snippets for most common control structures are provided.

| **Tab Trigger** | **Twig Code Block**
|-------------------|--------------------------------------
| `bautoescape` | `{% autoescape %}{% endautoescape %}`
| `bblock` | `{% block %}{% endblock %}`
| `bembed` | `{% embed %}{% endembed %}`
| `bextends` | `{% extends %}`
| `bfor` | `{% for %}{% endfor %}`
| `bif` | `{% if %}{% endif %}`
| `bifelse` | `{% if %}{% else %}{% endif %}`
| `bmacro` | `{% macro %}{% endmacro %}`
| `bsandbox` | `{% sandbox %}{% endsandbox %}`
| `bverbatim` | `{% verbatim %}{% endverbatim %}`
| `bwith` | `{% with %}{% endwith %}`

For more, please follow the official documentation on [snippets](https://www.sublimetext.com/docs/completions.html#snippets) to create your own.

Or use [SnippetMaker](https://packagecontrol.io/packages/SnippetMaker) for convenience.

If you want to ignore the snippets that are provided by default, you can use the `ignored_snippets` setting.

`"ignored_snippets": ["Twig/*"]`
| ignored snippets | values
|------------------|--------------------------------------
| all | `"Twig/Snippets/*"`
| blocks | `"Twig/Snippets/blocks"`
| expressions | `"Twig/Snippets/expressions"`
| tags | `"Twig/Snippets/tags"`

#### Example

To only keep tag snippets...

```json
{
"ignored_snippets": [
"Twig/Snippets/blocks",
"Twig/Snippets/expressions",
],
}
```

## Reporting issues.

Expand Down

0 comments on commit 1a0b0ee

Please sign in to comment.