1 =============================
2 Yet Another Snippet extension
3 =============================
5 .. _Organizing Snippets: snippet-organization.html
6 .. _Expanding Snippets: snippet-expansion.html
7 .. _Writing Snippets: snippet-development.html
8 .. _The YASnippet Menu: snippet-menu.html
12 **YASnippet** is a template system for Emacs. It allows you to type an
13 abbreviation and automatically expand it into function
14 templates. Bundled language templates includes: C, C++, C#, Perl,
15 Python, Ruby, SQL, LaTeX, HTML, CSS and more.
17 The snippet syntax is inspired from TextMate's syntax, you can even
18 `import <snippet-development.html#importing-textmate-snippets>`_
19 import most TextMate templates. YASnippet is a re-write of the
20 extension `smart-snippet`_. Both are original creations of `pluskid
21 <http://pluskid.lifegoo.org>`_.
23 .. _smart-snippet: http://code.google.com/p/smart-snippet/
28 .. youtube:: 76Ygeg9miao
31 Watch the `demo at YouTube
32 <http://www.youtube.com/watch?v=76Ygeg9miao>`_ (download a higher
33 resolution version: `yasnippet.avi
34 <http://yasnippet.googlecode.com/files/yasnippet.avi>`_).
39 There are two archives you can download. To quickly tryout YASnippet,
40 download the simpler "bundle" version. If you plan to modify the
41 bundled templates and/or build your own, download the "normal"
44 Install with ``yasnippet-bundle.el``
45 ------------------------------------
47 1. Download the latest ``yasnippet-bundle-x.y.z.el.tgz`` and unpack it.
48 2. You'll get a file named ``yasnippet-bundle.el``, put it under
49 ``~/.emacs.d/plugins/`` (create the directory if not exists).
50 3. Open the file in Emacs, and type ``Alt+x eval-buffer``.
52 That's it. Now open any one of your language file, you'll see a menu
53 YASnippet. you can pull the menu to insert a template. Or, you can
54 type the a *trigger key* then press ``TAB`` to expand it.
56 To have Emacs load YASnippet automatically when it starts, put the
57 following in your ``~/.emacs`` file:
59 .. sourcecode:: common-lisp
61 (add-to-list 'load-path
63 (require 'yasnippet-bundle)
65 The `youtube video <http://www.youtube.com/watch?v=76Ygeg9miao>`_
66 demonstrates this quick installation.
71 To install YASnippet as a normal emacs package, download and unpack
72 the latest ``yasnippet-x.y.z.tar.bz2``. You'll get a directory named
73 ``yasnippet-x.y.z``, which you can put it in your
74 ``~/.emacs.d/plugins`` and add the following in your ``.emacs`` file:
76 .. sourcecode:: common-lisp
78 (add-to-list 'load-path
79 "~/.emacs.d/plugins/yasnippet-x.y.z")
80 (require 'yasnippet) ;; not yasnippet-bundle
82 (yas/load-directory "~/.emacs.d/plugins/yasnippet-x.y.z/snippets")
84 Please refer to the documentation for full customization, or use the
90 Since version 0.6, YASnippet contains more functionality. You don't
91 need to know all of it to use it successfully, but you it can improve
92 your snippeting experience.
94 Hence this section has been split into separate documents:
96 1. `Organizing Snippets`_
98 Describes ways to organize your snippets in the hard disk (or not
99 organize them at all and just use ``yasnippet-bundle.el``.
101 2. `Expanding Snippets`_
103 Describes how YASnippet chooses snippets for expansion at point.
105 Maybe, you'll want some snippets to be expanded in a particular
106 mode, or only under certain conditions, or be prompted using
109 3. `Writing Snippets`_
111 Describes the YASnippet definition syntax, which is very close (but
112 not equivalent) to Textmate's. Includes a section about converting
115 4. `The YASnippet menu`_
117 Explains how to use the YASnippet menu to explore, learn and modify
120 Bugs, Contribution and Support
121 ==============================
123 * If you find a bug, please report it at `Issue List
124 <http://code.google.com/p/yasnippet/issues/list>`_.
125 * If you have problem using YASnippet, or have some new ideas,
126 including snippets, please post to the `discussion group`_.
128 .. _discussion group: http://groups.google.com/group/smart-snippet
129 .. _wish list: http://code.google.com/p/yasnippet/wiki/WishList
131 Thank you very much for using YASnippet!
133 .. LocalWords: YASnippet SQL LaTeX CSS yasnippet el eval html ido RET wiki