5 Snippet collections can be stored in plain text files. They are arranged by
6 sub-directories naming *snippet tables*. These mostly name Emacs major names.
19 The collections are loaded into *snippet tables* which the
20 triggering mechanism (see [[file:snippet-expansion.org][Expanding Snippets]]) looks up and
21 (hopefully) causes the right snippet to be expanded for you.
23 ** Setting up =yas-snippet-dirs=
25 The emacs variable [[sym:yas-snippet-dirs][=yas-snippet-dirs=]] tells YASnippet
26 which collections to consider. It's used when you activate
27 [[sym:yas-global-mode][=yas-global-mode=]] or call
28 [[sym:yas-reload-all][=yas-reload-all=]] interactively.
30 The default considers:
32 - a personal collection that lives in =~/.emacs.d/snippets=
33 - the bundled collection, taken as a relative path to =yasnippet.el= localtion
35 When you come across other snippet collections, do the following to try them
38 #+begin_src emacs-lisp :exports code
39 ;; Develop in ~/emacs.d/mysnippets, but also
40 ;; try out snippets in ~/Downloads/interesting-snippets
41 (setq yas-snippet-dirs '("~/emacs.d/mysnippets"
42 "~/Downloads/interesting-snippets"))
44 ;; OR, keeping yasnippet's defaults try out ~/Downloads/interesting-snippets
45 (setq yas-snippet-dirs (append yas-snippet-dirs
46 '("~/Downloads/interesting-snippets")))
49 Collections appearing earlier in the list shadow snippets with same names
50 appearing in collections later in the list. [[sym:yas-new-snippet][=yas-new-snippet=]] always stores
51 snippets in the first collection.
53 ** The =.yas-parents= file
55 It's very useful to have certain modes share snippets between
56 themselves. To do this, choose a mode subdirectory and place a
57 =.yas-parents= containing a whitespace-separated list of other mode
58 names. When you reload those modes become parents of the original
64 | |-- .yas-parents # contains "cc-mode text-mode"
70 | |-- .yas-parents # contains "cc-mode text-mode"
78 ** TODO The =.yas-make-groups= file
80 If you place an empty plain text file =.yas-make-groups= inside one
81 of the mode directories, the names of these sub-directories are
82 considered groups of snippets and [[snippet-menu.org][the menu]] is organized much more
85 [[images/menu-groups.png]]
87 Another way to achieve this is to place a =# group:= directive
88 inside the snippet definition. See [[snippet-development.org][Writing Snippets]].
106 Yet another way to create a nice snippet menu is to write into
107 =.yas-make-groups= a menu definition. TODO
109 ** TODO The =.yas-setup.el= file
113 ** TODO The =.yas-compiled-snippet.el= file
117 ** TODO The =.yas-skip= file