Once you've setup ``yas/root-directory`` , you can store snippets
inside sub-directories of these directories.
-Snippet definitions are put in plain text files. They are arranged by
-sub-directories, and the snippet tables are named after these directories.
+Snippet definitions are put in plain text files. They are arranged
+by sub-directories, and the snippet tables are named after these
+directories.
The name corresponds to the Emacs mode where you want expansion to
take place. For example, snippets for ``c-mode`` are put in the
-``c-mode`` sub-directory. You can also skip snippet storage altogether
-and use the bundle (see `YASnippet bundle`_).
+``c-mode`` sub-directory.
-Nested organization
--------------------
+The ``.yas.parents`` file
+-------------------------
-Here is an excerpt of a directory hierarchy containing snippets
-for some modes:
-
-.. sourcecode:: text
-
- $ tree
- .
- `-- text-mode
- |-- cc-mode
- | |-- c-mode
- | | `-- printf
- | |-- for
- | |-- java-mode
- | | `-- println
- | `-- while
- |-- email
- |-- perl-mode
- | |-- cperl-mode
- | `-- for
- `-- time
-
-A parent directory acts as a *parent table* of any of its
-sub-directories. This is one of the ways different Emacs major modes
-can share snippet definitions. As you can see above, ``c-mode`` and
-``java-mode`` share the same parent ``cc-mode`` and its ``while``
-snipepts, while all modes are share the ``time`` snippet from
-``text-mode``.
-
-This can be also used to as an *alias* -- ``cperl-mode`` is an empty
-directory whose parent is ``perl-mode``.
-
-.. image:: images/menu-parent.png
- :align: right
-
-The ``.yas-parents`` file
-------------------------------
-
-An alternate (and preferred) way of setting up parent tables consists
-of placing a plain text file ``.yas-parents`` inside one of the
-sub-directories. By doing this, you avoid complex directory
-nesting. In the ``.yas-parents`` file you just write
-whitespace-separated names of modes. This allows more flexibility and
-readability of your snippet hierarchy.
+It's very useful to have certain modes share snippets between
+themselves. To do this, choose a mode subdirectory and place a
+``.yas-parents`` containing a whitespace-separated list of other
+mode names. When you reload those modes become parents of the
+original mode.
.. sourcecode:: text
`-- ...
-Using plain file names
-----------------------
-
-Normally, file names act as the snippet expansion *abbreviation* (also
-known as the *snippet key* or *snippet trigger*, see `Expanding
-Snippets`_).
-
-However, if you customize the variable
-``yas/ignore-filenames-as-triggers`` to be true *or* place an empty
-file ``.yas-ignore-filename-triggers`` you can use much more
-descriptive file names. This is useful if many snippets within a mode
-share the same trigger key.
-
-.. sourcecode:: text
-
- $ tree rails-mode/
- rails-mode/
- |-- .yas-make-groups
- |-- .yas-ignore-filename-triggers
- |-- Insert ERb's <% __ %> or <%= __ %>.yasnippet
- |-- asserts
- | |-- assert(var = assigns(%3Avar)).yasnippet
- | |-- assert_difference.yasnippet
- | |-- assert_no_difference.yasnippet
- | |-- assert_redirected_to (nested path plural).yasnippet
- | |-- assert_redirected_to (nested path).yasnippet
- | |-- assert_redirected_to (path plural).yasnippet
- | |-- assert_redirected_to (path).yasnippet
- | |-- assert_rjs.yasnippet
- | `-- assert_select.yasnippet
-
-
YASnippet bundle
================