<type>documentation</type>
<domain>edit</domain>
<id>snippet-directory</id>
<title>Snippets Directory Layout</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>pro+</product>

Snippets are stored in the directory ``snippets`` inside the `Settings Directory
<ref:install/user-settings-dir>`__. If this directory does not exist the first time the
``Snippets`` tool is used, it is created and populated by making a copy of the default set
of snippets that ship with Wing. Changes and additions made subsequently in the
``Snippets`` will be stored here, and the directory can be copied to other machines in
order to share its snippets with other installations of Wing Pro.

Snippets stored at the top level of this directory can be used with any file in the
editor and are shown in the ``*`` tab of the ``Snippets`` tool.

Snippets designed for a particular file type are stored in directories named with the
most common extension for the file type, for example ``py`` for Python.

Each of the file type directories may contain snippets that apply to any context in
files of that type and sub-directories named ``<context>.ctx`` for snippets designed
for a particular context.  ``<context>`` is replaced with the desired context name.

Snippet file names are simply the name of the snippet with no extension.  See
`Snippet Syntax <ref:edit/snippet-syntax>`__ for details on the snippet file format.

Wing also stores a file named ``.config`` in the ``snippets`` directory, which should not
be altered or removed, as this may cause the loss of your snippet files.

**Snippets Search Path**

Additional directories for finding snippets can be specified with the `Editor > Snippets >
Snippets Path <script:show_preferences_gui#prefname="edit.snippets-path">`__ preference.
Later directories on the path override earlier directories for the same snippet name. New
snippets will be created in the last directory on the path.

When one or more directories have been added to the Snippets Path, the `Editor > Snippets
> Include Default Snippets
<script:show_preferences_gui#prefname="edit.snippets-include-defaults">`__ preference can
be used to disable displaying the default set of snippets in the Snippets tool.
