yasnippet/doc/index.html

451 lines
15 KiB
HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<title>YASnippet - Yet Another Snippet extension for Emacs</title>
<meta name="author" content="pluskid" />
<meta name="date" content="2008-03-20" />
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date: 2005-12-18 01:56:14 +0100 (Sun, 18 Dec 2005) $
:Revision: $Revision: 4224 $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-right {
clear: right }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="yasnippet-yet-another-snippet-extension-for-emacs">
<h1 class="title">YASnippet - Yet Another Snippet extension for Emacs</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>pluskid</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference" href="mailto:pluskid&#64;gmail.com">pluskid&#64;gmail.com</a></td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2008-03-20</td></tr>
</tbody>
</table>
<div class="contents topic">
<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
<ul class="simple">
<li><a class="reference" href="#getting-started" id="id5" name="id5">Getting Started</a><ul>
<li><a class="reference" href="#for-the-busy-or-impatient-people" id="id6" name="id6">For the busy or impatient people</a></li>
<li><a class="reference" href="#for-lazy-poeple-or-beginners" id="id7" name="id7">For lazy poeple or beginners</a></li>
<li><a class="reference" href="#for-you" id="id8" name="id8">For you</a></li>
<li><a class="reference" href="#for-geeks" id="id9" name="id9">For geeks</a></li>
</ul>
</li>
<li><a class="reference" href="#how-to-contribute" id="id10" name="id10">How to contribute ?</a><ul>
<li><a class="reference" href="#issues" id="id11" name="id11">Issues</a></li>
<li><a class="reference" href="#suggestion-feature-request" id="id12" name="id12">Suggestion, Feature Request</a></li>
<li><a class="reference" href="#snippets" id="id13" name="id13">Snippets</a></li>
</ul>
</li>
<li><a class="reference" href="#detailed-documentation" id="id14" name="id14">Detailed Documentation</a></li>
</ul>
</div>
<p>YASnippet is a re-design and re-write of my original extension
<a class="reference" href="http://code.google.com/p/smart-snippet/">smart-snippet</a>. It is much cleaner and more powerful than
smart-snippet.</p>
<div class="section">
<h1><a class="toc-backref" href="#id5" id="getting-started" name="getting-started">Getting Started</a></h1>
<div class="section">
<h2><a class="toc-backref" href="#id6" id="for-the-busy-or-impatient-people" name="for-the-busy-or-impatient-people">For the busy or impatient people</a></h2>
<p>Watch the <a class="reference" href="http://www.youtube.com/watch?v=vOj7btx3ATg">screencast at YouTube</a> or download <a class="reference" href="http://yasnippet.googlecode.com/files/yasnippet.avi">the one
with a higher resolution</a>.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id7" id="for-lazy-poeple-or-beginners" name="for-lazy-poeple-or-beginners">For lazy poeple or beginners</a></h2>
<ol class="arabic">
<li><p class="first">Download the latest bundle release <a class="footnote-reference" href="#id3" id="id1" name="id1">[1]</a> from the <a class="reference" href="http://code.google.com/p/yasnippet/downloads/list">downloads page</a>.</p>
</li>
<li><p class="first">Create a directory <tt class="docutils literal"><span class="pre">~/emacs/plugins</span></tt>.</p>
</li>
<li><p class="first">Unpack the downloaded bundle to that directory.</p>
</li>
<li><p class="first">Add the following code to your <tt class="docutils literal"><span class="pre">~/.emacs</span></tt> file:</p>
<div class="highlight"><pre>(<span style="color: #19177C">add-to-list</span> <span style="color: #19177C">&#39;load-path</span>
<span style="color: #BA2121">&quot;~/emacs/plugins&quot;</span>)
(<span style="color: #008000">require</span> <span style="color: #19177C">&#39;yasnippet-bundle</span>)
</pre></div>
</li>
</ol>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id8" id="for-you" name="for-you">For you</a></h2>
<ol class="arabic">
<li><p class="first">Download the latest YASnippet release package <a class="footnote-reference" href="#id4" id="id2" name="id2">[2]</a> from the
<a class="reference" href="http://code.google.com/p/yasnippet/downloads/list">downloads page</a>.</p>
</li>
<li><p class="first">Unpack it to a directory and add that directory to your
<tt class="docutils literal"><span class="pre">load-path</span></tt>.</p>
</li>
<li><p class="first">Add the following code to your <tt class="docutils literal"><span class="pre">~/.emacs</span></tt> file:</p>
<div class="highlight"><pre>(<span style="color: #008000">require</span> <span style="color: #19177C">&#39;yasnippet</span>) <span style="color: #408080; font-style: italic">;; not yasnippet-bundle</span>
(<span style="color: #19177C">yas/initialize</span>)
(<span style="color: #19177C">yas/load-directory</span> <span style="color: #BA2121">&quot;/path/to/the/snippets/directory/&quot;</span>)
</pre></div>
</li>
<li><p class="first">You can inspect into the <tt class="docutils literal"><span class="pre">snippets</span></tt> directory for adding your own
snippets.</p>
</li>
<li><p class="first">Detailed document can be found at the <tt class="docutils literal"><span class="pre">doc</span></tt> directory.</p>
</li>
</ol>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id9" id="for-geeks" name="for-geeks">For geeks</a></h2>
<p>If you want to always follow the latest code. You can check out it
from the svn repository:</p>
<div class="highlight"><pre>svn checkout http://yasnippet.googlecode.com/svn/trunk/ yasnippet
</pre></div>
<p>However, I try to release a new version as soon as I made some changes
that will affect the normal use or added some new features. So there's
usually no need to follow the svn repository. Except that you might
find <tt class="docutils literal"><span class="pre">svn</span> <span class="pre">up</span></tt> is more convenient than downloading and unpacking the
release package. :D</p>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id10" id="how-to-contribute" name="how-to-contribute">How to contribute ?</a></h1>
<p>If you like YASnippet, you can recommendate it to your friends.</p>
<div class="section">
<h2><a class="toc-backref" href="#id11" id="issues" name="issues">Issues</a></h2>
<p>If you find a bug you can create a new issue at the <a class="reference" href="http://code.google.com/p/yasnippet/issues/list">issue list</a>. Please describe
the problem as clear as possible.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id12" id="suggestion-feature-request" name="suggestion-feature-request">Suggestion, Feature Request</a></h2>
<p>There's a <a class="reference" href="http://groups.google.com/group/smart-snippet">discussion group</a> for both smart-snippet and yasnippet. If
you have any suggesion, you can post to there and discuss with other
members.</p>
<p>Especially, there's a <a class="reference" href="http://code.google.com/p/yasnippet/wiki/WishList">wish list</a> wiki page. I'll collect ideas from
the <a class="reference" href="http://groups.google.com/group/smart-snippet">discussion group</a> to the <a class="reference" href="http://code.google.com/p/yasnippet/wiki/WishList">wish list</a>. So you might want to look
at the <a class="reference" href="http://code.google.com/p/yasnippet/wiki/WishList">wish list</a> before you post something.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id13" id="snippets" name="snippets">Snippets</a></h2>
<p>YASnippet comes with some default snippet definitions. However, they
are far from complete. So I'm calling users to share their
snippets. If you have some good snippet definitions, you can post them
to the <a class="reference" href="http://groups.google.com/group/smart-snippet">discussion group</a>. You can specify the <tt class="docutils literal"><span class="pre">contributor</span></tt>
property of the snippet like:</p>
<div class="highlight"><pre>#contributor : pluskid &lt;pluskid@gmail.com&gt;
#name : __...__
# --
__${init}__
</pre></div>
<p>I'll incorporate (some of) them in the release if suitable. However,
if you have <em>many</em> snippets (especially when they need to be
maintained and updated constantly), it is not suitable to put them in
the YASnippet release package. A better way is to make your snippets
publicly available and tell me the URL. I'll try to keep a list of
them on the wiki page.</p>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id14" id="detailed-documentation" name="detailed-documentation">Detailed Documentation</a></h1>
<ul class="simple">
<li>See <a class="reference" href="define_snippet.html">this page</a> on how to define a snippet by
yourself.</li>
<li>Here's the <a class="reference" href="faq.html">FAQ</a> page.</li>
</ul>
<table class="docutils footnote" frame="void" id="id3" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1" name="id3">[1]</a></td><td>They usually named like <tt class="docutils literal"><span class="pre">yasnippet-bundle-x.y.z.el.tgz</span></tt> where
<tt class="docutils literal"><span class="pre">x.y.z</span></tt> is the version number.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id4" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2" name="id4">[2]</a></td><td>They usually named like <tt class="docutils literal"><span class="pre">yasnippet.x.y.z.tar.bz2</span></tt>.</td></tr>
</tbody>
</table>
</div>
</div>
</body>
</html>