1 <?xml version=
"1.0" encoding=
"utf-8" ?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
6 <meta name=
"generator" content=
"Docutils 0.6: http://docutils.sourceforge.net/" />
7 <title>Yet Another Snippet extension
</title>
8 <link rel=
"stylesheet" href=
"styles.css" type=
"text/css" />
11 <div class=
"document" id=
"yet-another-snippet-extension">
12 <div id=
"header-region" class=
"clear-block"></div>
14 <div id=
"container" class=
"clear-block">
16 <div id=
"logo-floater">
17 <h1 class=
"title">Yet Another Snippet extension
</h1>
19 <ul class=
"primary-links">
21 <a title=
"" href=
"index.html">Intro and tutorial
</a>
24 <a title=
"" href=
"snippet-organization.html">Howto: organize
</a>
27 <a title=
"" href=
"snippet-expansion.html">Howto: expand
</a>
30 <a title=
"" href=
"snippet-development.html">Howto: write
</a>
33 <a title=
"" href=
"snippet-menu.html">Howto: menu
</a>
36 <a title=
"" href=
"faq.html">FAQ
</a>
39 <a title=
"" href=
"changelog.html">ChangeLog
</a>
42 <a title=
"" href=
"http://code.google.com/p/yasnippet/downloads/list">Download
</a>
48 <div class=
"right-corner">
49 <div class=
"left-corner">
51 <b>Important:
</b> This documentation applies to
52 the
<b>SVN trunk
</b> of YASnippet, which you
53 get
<a href=
"http://code.google.com/p/yasnippet/source/checkout">here
</a>. Documentation
54 for other versions can be found
<a title=
""
55 href=
"http://code.google.com/p/yasnippet/downloads/list">here
</a>.
57 <div class=
"contents topic" id=
"contents">
58 <p class=
"topic-title first">Contents
</p>
60 <li><a class=
"reference internal" href=
"#video-demo" id=
"id1">Video Demo
</a></li>
61 <li><a class=
"reference internal" href=
"#installation" id=
"id2">Installation
</a><ul>
62 <li><a class=
"reference internal" href=
"#install-with-yasnippet-bundle-el" id=
"id3">Install with
<tt class=
"docutils literal"><span class=
"pre">yasnippet-bundle.el
</span></tt></a></li>
63 <li><a class=
"reference internal" href=
"#normal-install" id=
"id4">Normal Install
</a></li>
66 <li><a class=
"reference internal" href=
"#how-to-use-yasnippet" id=
"id5">How to use YASnippet
</a></li>
67 <li><a class=
"reference internal" href=
"#bugs-contribution-and-support" id=
"id6">Bugs, Contribution and Support
</a></li>
70 <p><strong>YASnippet
</strong> is a template system for Emacs. It allows you to type an
71 abbreviation and automatically expand it into function
72 templates. Bundled language templates includes: C, C++, C#, Perl,
73 Python, Ruby, SQL, LaTeX, HTML, CSS and more.
</p>
74 <p>The snippet syntax is inspired from TextMate's syntax, you can even
75 <a class=
"reference external" href=
"snippet-development.html#importing-textmate-snippets">import
</a>
76 import most TextMate templates. YASnippet is a re-write of the
77 extension
<a class=
"reference external" href=
"http://code.google.com/p/smart-snippet/">smart-snippet
</a>. Both are original creations of
<a class=
"reference external" href=
"http://pluskid.lifegoo.org">pluskid
</a>.
</p>
78 <div class=
"section" id=
"video-demo">
79 <h1><a class=
"toc-backref" href=
"#id1">Video Demo
</a></h1>
80 <object type=
"application/x-shockwave-flash"
85 data=
"http://www.youtube.com/v/76Ygeg9miao">
86 <param name=
"movie" value=
"http://www.youtube.com/v/76Ygeg9miao"></param>
87 <param name=
"wmode" value=
"transparent"></param>
89 <p>Watch the
<a class=
"reference external" href=
"http://www.youtube.com/watch?v=76Ygeg9miao">demo at YouTube
</a> (download a higher
90 resolution version:
<a class=
"reference external" href=
"http://yasnippet.googlecode.com/files/yasnippet.avi">yasnippet.avi
</a>).
</p>
92 <div class=
"section" id=
"installation">
93 <h1><a class=
"toc-backref" href=
"#id2">Installation
</a></h1>
94 <p>There are two archives you can download. To quickly tryout YASnippet,
95 download the simpler
"bundle
" version. If you plan to modify the
96 bundled templates and/or build your own, download the
"normal
"
98 <div class=
"section" id=
"install-with-yasnippet-bundle-el">
99 <h2><a class=
"toc-backref" href=
"#id3">Install with
<tt class=
"docutils literal"><span class=
"pre">yasnippet-bundle.el
</span></tt></a></h2>
100 <ol class=
"arabic simple">
101 <li>Download the latest
<tt class=
"docutils literal"><span class=
"pre">yasnippet-bundle-x.y.z.el.tgz
</span></tt> and unpack it.
</li>
102 <li>You'll get a file named
<tt class=
"docutils literal"><span class=
"pre">yasnippet-bundle.el
</span></tt>, put it under
103 <tt class=
"docutils literal"><span class=
"pre">~/.emacs.d/plugins/
</span></tt> (create the directory if not exists).
</li>
104 <li>Open the file in Emacs, and type
<tt class=
"docutils literal"><span class=
"pre">Alt+x
</span> <span class=
"pre">eval-buffer
</span></tt>.
</li>
106 <p>That's it. Now open any one of your language file, you'll see a menu
107 YASnippet. you can pull the menu to insert a template. Or, you can
108 type the a
<em>trigger key
</em> then press
<tt class=
"docutils literal"><span class=
"pre">TAB
</span></tt> to expand it.
</p>
109 <p>To have Emacs load YASnippet automatically when it starts, put the
110 following in your
<tt class=
"docutils literal"><span class=
"pre">~/.emacs
</span></tt> file:
</p>
112 <div class=
"highlight"><pre>(
<span style=
"color: #19177C">add-to-list
</span> <span style=
"color: #19177C">'load-path
</span>
113 <span style=
"color: #BA2121">"~/.emacs.d/plugins
"</span>)
114 (
<span style=
"color: #008000">require
</span> <span style=
"color: #19177C">'yasnippet-bundle
</span>)
117 <p>The
<a class=
"reference external" href=
"http://www.youtube.com/watch?v=76Ygeg9miao">youtube video
</a>
118 demonstrates this quick installation.
</p>
120 <div class=
"section" id=
"normal-install">
121 <h2><a class=
"toc-backref" href=
"#id4">Normal Install
</a></h2>
122 <p>To install YASnippet as a normal emacs package, download and unpack
123 the latest
<tt class=
"docutils literal"><span class=
"pre">yasnippet-x.y.z.tar.bz2
</span></tt>. You'll get a directory named
124 <tt class=
"docutils literal"><span class=
"pre">yasnippet-x.y.z
</span></tt>, which you can put it in your
125 <tt class=
"docutils literal"><span class=
"pre">~/.emacs.d/plugins
</span></tt> and add the following in your
<tt class=
"docutils literal"><span class=
"pre">.emacs
</span></tt> file:
</p>
127 <div class=
"highlight"><pre>(
<span style=
"color: #19177C">add-to-list
</span> <span style=
"color: #19177C">'load-path
</span>
128 <span style=
"color: #BA2121">"~/.emacs.d/plugins/yasnippet-x.y.z
"</span>)
129 (
<span style=
"color: #008000">require
</span> <span style=
"color: #19177C">'yasnippet
</span>)
<span style=
"color: #408080; font-style: italic">;; not yasnippet-bundle
</span>
130 (
<span style=
"color: #19177C">yas/initialize
</span>)
131 (
<span style=
"color: #19177C">yas/load-directory
</span> <span style=
"color: #BA2121">"~/.emacs.d/plugins/yasnippet-x.y.z/snippets
"</span>)
134 <p>Please refer to the documentation for full customization, or use the
135 customization group.
</p>
138 <div class=
"section" id=
"how-to-use-yasnippet">
139 <h1><a class=
"toc-backref" href=
"#id5">How to use YASnippet
</a></h1>
140 <p>Since version
0.6, YASnippet contains more functionality. You don't
141 need to know all of it to use it successfully, but you it can improve
142 your snippeting experience.
</p>
143 <p>Hence this section has been split into separate documents:
</p>
144 <ol class=
"arabic simple">
145 <li><a class=
"reference external" href=
"snippet-organization.html">Organizing Snippets
</a></li>
148 Describes ways to organize your snippets in the hard disk (or not
149 organize them at all and just use
<tt class=
"docutils literal"><span class=
"pre">yasnippet-bundle.el
</span></tt>.
</blockquote>
150 <ol class=
"arabic simple" start=
"2">
151 <li><a class=
"reference external" href=
"snippet-expansion.html">Expanding Snippets
</a></li>
154 <p>Describes how YASnippet chooses snippets for expansion at point.
</p>
155 <p>Maybe, you'll want some snippets to be expanded in a particular
156 mode, or only under certain conditions, or be prompted using
157 <tt class=
"docutils literal"><span class=
"pre">ido
</span></tt>, etc...
</p>
159 <ol class=
"arabic simple" start=
"3">
160 <li><a class=
"reference external" href=
"snippet-development.html">Writing Snippets
</a></li>
163 Describes the YASnippet definition syntax, which is very close (but
164 not equivalent) to Textmate's. Includes a section about converting
165 TextMate snippets.
</blockquote>
166 <ol class=
"arabic simple" start=
"4">
167 <li><a class=
"reference external" href=
"snippet-menu.html">The YASnippet menu
</a></li>
170 Explains how to use the YASnippet menu to explore, learn and modify
171 snippets.
</blockquote>
173 <div class=
"section" id=
"bugs-contribution-and-support">
174 <h1><a class=
"toc-backref" href=
"#id6">Bugs, Contribution and Support
</a></h1>
176 <li>If you find a bug, please report it at
<a class=
"reference external" href=
"http://code.google.com/p/yasnippet/issues/list">Issue List
</a>.
</li>
177 <li>If you have problem using YASnippet, or have some new ideas,
178 including snippets, please post to the
<a class=
"reference external" href=
"http://groups.google.com/group/smart-snippet">discussion group
</a>.
</li>
180 <p>Thank you very much for using YASnippet!
</p>
181 <!-- LocalWords: YASnippet SQL LaTeX CSS yasnippet el eval html ido RET wiki -->
189 <script type=
"text/javascript">
190 var gaJsHost = ((
"https:" == document.location.protocol) ?
"https://ssl." :
"http://www.");
191 document.write(unescape(
"%3Cscript src='" + gaJsHost +
"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
193 <script type=
"text/javascript">
195 var pageTracker = _gat._getTracker(
"UA-10536822-1");
196 pageTracker._trackPageview();