From b19daa31ca50d0a696ee39e0ac9d5b27eac1d8b1 Mon Sep 17 00:00:00 2001
From: "Duong H. Nguyen"
The non-bundle version of YASnippet, once unpacked, comes with a full directory of snippets, which you can copy somewhere and use. You can also create or download more directories.
-Once these directories are in place reference them in the variable -yas/root-directory and load them with yas/load-directory:
-;; Develop and keep personal snippets under ~/emacs.d/mysnippets
-(setq yas/root-directory "~/emacs.d/mysnippets")
-;; Load the snippets
-(yas/load-directory yas/root-directory)
-
The point in using yas/root-directory (as opposed to calling -yas/load-directory directly) is considering "~/emacs.d/mysnippets" -for snippet development, so you can use commands like -yas/new-snippet and others described in section Writing -Snippets.
-You can make this variable a list and store more items into it:
-;; Develop in ~/emacs.d/mysnippets, but also
-;; try out snippets in ~/Downloads/interesting-snippets
-(setq yas/root-directory '("~/emacs.d/mysnippets"
- "~/Downloads/interesting-snippets"))
+
+ Once these directories are in place reference them in the variable
+
+ yas-snippet-dirs
+
+ and then load YASnippet as usual:
+
-;; Map `yas/load-directory' to every element
-(mapc 'yas/load-directory yas/root-directory)
+
+ ;; Develop and keep personal snippets under ~/emacs.d/mysnippets
+(setq yas-snippet-dirs '("~/emacs.d/mysnippets"))
+
+;; Load yasnippet
+(yas-global-mode 1)
-In this last example, the all the directories are loaded and their
-snippets considered for expansion. However development still happens
-in the first element, "~/emacs.d/mysnippets".
+
+
+ The point in using
+
+ yas-snippet-dirs
+
+ is considering "~/emacs.d/mysnippets" for snippet development, so
+ you can use commands like
+
+ yas/new-snippet
+
+ and others described in section
+ Writing Snippets.
+
+ Note: In the past, + + yas/root-directory + + is the variable that stores the list of snippet directories. This method is + deprecated and only exists for backward-compatibility reason. +
+Once you've setup yas/root-directory , you can store snippets
From 124a59dfe90984f8c4b1d224633e6691d0429f65 Mon Sep 17 00:00:00 2001
From: "Duong H. Nguyen"
Once you've setup yas/root-directory , you can store snippets +
Once you've setup yas-snippet-dirs , 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 @@ -207,15 +207,27 @@ generated this way.
Root directory that stores the snippets for each major mode.
-If you set this from your .emacs, can also be a list of strings, -for multiple root directories. If you make this a list, the first -element is always the user-created snippets directory. Other -directories are used for bulk reloading of all snippets using -yas/reload-all
++ List of directories that store the snippets for each major mode. +
+ ++ The first element of the list is always the user-created snippets + directory. Other directories are used for bulk reloading of all snippets + using + + yas/reload-all + . +
+If non-nil, don't derive tab triggers from filenames.