diff --git a/snippet-organization.html b/snippet-organization.html index 020389d..b92e1db 100644 --- a/snippet-organization.html +++ b/snippet-organization.html @@ -65,7 +65,7 @@
  • YASnippet bundle
  • Customizable variables
  • @@ -82,35 +82,50 @@ intended.

    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. +

    +

    Organizing snippets

    -

    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 @@ -192,15 +207,27 @@ generated this way.

    Customizable variables

    -
    -

    yas/root-directory

    -

    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

    +
    + +

    + yas-snippet-dirs +

    + +

    + 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 + . +

    +
    +

    yas/ignore-filenames-as-triggers

    If non-nil, don't derive tab triggers from filenames.