mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
346 lines
10 KiB
HTML
346 lines
10 KiB
HTML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
<head>
|
|
<title>Yet another snippet extension</title>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
|
<meta name="title" content="Yet another snippet extension"/>
|
|
<meta name="generator" content="Org-mode"/>
|
|
<meta name="generated" content="2013-11-26T23:16-0500"/>
|
|
<meta name="author" content=""/>
|
|
<meta name="description" content=""/>
|
|
<meta name="keywords" content=""/>
|
|
<style type="text/css">
|
|
<!--/*--><![CDATA[/*><!--*/
|
|
html { font-family: Times, serif; font-size: 12pt; }
|
|
.title { text-align: center; }
|
|
.todo { color: red; }
|
|
.done { color: green; }
|
|
.tag { background-color: #add8e6; font-weight:normal }
|
|
.target { }
|
|
.timestamp { color: #bebebe; }
|
|
.timestamp-kwd { color: #5f9ea0; }
|
|
.right {margin-left:auto; margin-right:0px; text-align:right;}
|
|
.left {margin-left:0px; margin-right:auto; text-align:left;}
|
|
.center {margin-left:auto; margin-right:auto; text-align:center;}
|
|
p.verse { margin-left: 3% }
|
|
pre {
|
|
border: 1pt solid #AEBDCC;
|
|
background-color: #F3F5F7;
|
|
padding: 5pt;
|
|
font-family: courier, monospace;
|
|
font-size: 90%;
|
|
overflow:auto;
|
|
}
|
|
table { border-collapse: collapse; }
|
|
td, th { vertical-align: top; }
|
|
th.right { text-align:center; }
|
|
th.left { text-align:center; }
|
|
th.center { text-align:center; }
|
|
td.right { text-align:right; }
|
|
td.left { text-align:left; }
|
|
td.center { text-align:center; }
|
|
dt { font-weight: bold; }
|
|
div.figure { padding: 0.5em; }
|
|
div.figure p { text-align: center; }
|
|
div.inlinetask {
|
|
padding:10px;
|
|
border:2px solid gray;
|
|
margin:10px;
|
|
background: #ffffcc;
|
|
}
|
|
textarea { overflow-x: auto; }
|
|
.linenr { font-size:smaller }
|
|
.code-highlighted {background-color:#ffff00;}
|
|
.org-info-js_info-navigation { border-style:none; }
|
|
#org-info-js_console-label { font-size:10px; font-weight:bold;
|
|
white-space:nowrap; }
|
|
.org-info-js_search-highlight {background-color:#ffff00; color:#000000;
|
|
font-weight:bold; }
|
|
/*]]>*/-->
|
|
</style>
|
|
<script type="text/javascript">
|
|
/*
|
|
@licstart The following is the entire license notice for the
|
|
JavaScript code in this tag.
|
|
|
|
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
|
|
|
The JavaScript code in this tag is free software: you can
|
|
redistribute it and/or modify it under the terms of the GNU
|
|
General Public License (GNU GPL) as published by the Free Software
|
|
Foundation, either version 3 of the License, or (at your option)
|
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
|
|
|
As additional permission under GNU GPL version 3 section 7, you
|
|
may distribute non-source (e.g., minimized or compacted) forms of
|
|
that code without the copy of the GNU GPL normally required by
|
|
section 4, provided you include this license notice and a URL
|
|
through which recipients can access the Corresponding Source.
|
|
|
|
|
|
@licend The above is the entire license notice
|
|
for the JavaScript code in this tag.
|
|
*/
|
|
<!--/*--><![CDATA[/*><!--*/
|
|
function CodeHighlightOn(elem, id)
|
|
{
|
|
var target = document.getElementById(id);
|
|
if(null != target) {
|
|
elem.cacheClassElem = elem.className;
|
|
elem.cacheClassTarget = target.className;
|
|
target.className = "code-highlighted";
|
|
elem.className = "code-highlighted";
|
|
}
|
|
}
|
|
function CodeHighlightOff(elem, id)
|
|
{
|
|
var target = document.getElementById(id);
|
|
if(elem.cacheClassElem)
|
|
elem.className = elem.cacheClassElem;
|
|
if(elem.cacheClassTarget)
|
|
target.className = elem.cacheClassTarget;
|
|
}
|
|
/*]]>*///-->
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<div id="org-div-home-and-up" style="text-align:right;font-size:70%;white-space:nowrap;">
|
|
<a accesskey="h" href="./index.html"> UP </a>
|
|
|
|
|
<a accesskey="H" href="./index.html"> HOME </a>
|
|
</div>
|
|
|
|
<div id="preamble">
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
<h1 class="title">Yet another snippet extension</h1>
|
|
|
|
|
|
<div id="table-of-contents">
|
|
<h2>Table of Contents</h2>
|
|
<div id="text-table-of-contents">
|
|
<ul>
|
|
<li><a href="#sec-1">Quick start</a>
|
|
<ul>
|
|
<li><a href="#sec-1-1">Watch a demo</a></li>
|
|
<li><a href="#sec-1-2">Installation</a></li>
|
|
<li><a href="#import-textmate">Import textmate snippets (rails example)</a></li>
|
|
<li><a href="#sec-1-4">Contributing snippets</a></li>
|
|
<li><a href="#sec-1-5">Documentation</a></li>
|
|
<li><a href="#sec-1-6">Bugs, discussion, contributions, etc</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-1" class="outline-2">
|
|
<h2 id="sec-1">Quick start</h2>
|
|
<div class="outline-text-2" id="text-1">
|
|
|
|
|
|
<p>
|
|
<b>YASnippet</b> is a template system for Emacs. It allows you to type an
|
|
abbreviation and automatically expand it into function templates. Bundled
|
|
language templates includes: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML,
|
|
CSS and more. The snippet syntax is inspired from TextMate's syntax, you can
|
|
even <a href="#import-textmate">import most TextMate snippets</a>
|
|
</p>
|
|
<p>
|
|
YASnippet is an original creation of <a href="http://pluskid.lifegoo.org">pluskid</a> who also wrote its predecessor
|
|
<a href="http://code.google.com/p/smart-snippet">smart-snippet</a>.
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-1" class="outline-3">
|
|
<h3 id="sec-1-1">Watch a demo</h3>
|
|
<div class="outline-text-3" id="text-1-1">
|
|
|
|
|
|
<p>
|
|
On <a href="http://www.youtube.com/watch?v=ZCGmZK4V7Sg">youtube</a>.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-2" class="outline-3">
|
|
<h3 id="sec-1-2">Installation</h3>
|
|
<div class="outline-text-3" id="text-1-2">
|
|
|
|
|
|
<p>
|
|
Clone this repository somewhere
|
|
</p>
|
|
|
|
|
|
|
|
<pre class="example">$ cd ~/.emacs.d/plugins
|
|
$ git clone https://github.com/capitaomorte/yasnippet
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
Add the following in your <code>.emacs</code> file:
|
|
</p>
|
|
|
|
|
|
|
|
<pre class="example">(add-to-list 'load-path
|
|
"~/.emacs.d/plugins/yasnippet")
|
|
(require 'yasnippet)
|
|
(yas-global-mode 1)
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
Add your own snippets to <code>~/.emacs.d/snippets</code> by placing files there or
|
|
invoking <a href="snippet-reference.html#yas-new-snippet"><code>yas-new-snippet</code></a>.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-import-textmate" class="outline-3">
|
|
<h3 id="import-textmate"><a name="sec-1-3" id="sec-1-3"></a>Import textmate snippets (rails example)</h3>
|
|
<div class="outline-text-3" id="text-import-textmate">
|
|
|
|
|
|
<p>
|
|
YASnippet lets you use TextMate bundles directly:
|
|
</p>
|
|
|
|
|
|
|
|
<pre class="example">$ cd ~/.emacs.d/plugins
|
|
$ git clone https://github.com/capitaomorte/yasnippet
|
|
$ cd yasnippet
|
|
$ git submodule init
|
|
$ git submodule update
|
|
$ gem install plist trollop
|
|
$ rake convert_bundles # will convert ruby, rails and html bundles from drnic
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
Then, in your <code>.emacs</code> file
|
|
</p>
|
|
|
|
|
|
|
|
<pre class="example">(add-to-list 'load-path
|
|
"~/.emacs.d/plugins/yasnippet")
|
|
(require 'yasnippet)
|
|
(setq yas-snippet-dirs '("~/.emacs.d/snippets" "~/.emacs.d/extras/imported"))
|
|
(yas-global-mode 1)
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
Open some rails file (model, app, etc) and start using the textmate
|
|
snippets. Consider that this is a work-in-progress and many snippets/commands
|
|
might not work. Patches welcome!
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-4" class="outline-3">
|
|
<h3 id="sec-1-4">Contributing snippets</h3>
|
|
<div class="outline-text-3" id="text-1-4">
|
|
|
|
|
|
<p>
|
|
Please <b>do not ask me</b> to add snippets to the default collection under
|
|
<code>/snippets</code>. This collection is considered frozen. By customizing
|
|
<a href="snippet-reference.html#yas-snippet-dirs"><code>yas-snippet-dirs</code></a> you can point yasnippet to good
|
|
snippet collections out there.
|
|
</p>
|
|
<p>
|
|
The <code>extras/textmate-import.rb</code> tool can import many actual Textmate
|
|
snippets. I'm focusing on developing it and the accompanying <code>yas-setup.el</code>
|
|
files that guide it with more difficult importations. The idea is to deprecate
|
|
<code>/snippets</code> and replace it with <code>extras/imported</code>.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-5" class="outline-3">
|
|
<h3 id="sec-1-5">Documentation</h3>
|
|
<div class="outline-text-3" id="text-1-5">
|
|
|
|
|
|
<p>
|
|
The documentation has been split into separate parts:
|
|
</p>
|
|
<ol>
|
|
<li><a href="snippet-organization.html">Organizing Snippets</a>
|
|
Describes ways to organize your snippets in the hard disk.
|
|
|
|
</li>
|
|
<li><a href="snippet-expansion.html">Expanding Snippets</a>
|
|
Describes how YASnippet chooses snippets for expansion at point.
|
|
|
|
<p>
|
|
Maybe, you'll want some snippets to be expanded in a particular mode,
|
|
or only under certain conditions, or be prompted using <code>ido</code>, etc…
|
|
</p>
|
|
</li>
|
|
<li><a href="snippet-development.html">Writing Snippets</a>
|
|
Describes the YASnippet definition syntax, which is very close (but
|
|
not equivalent) to Textmate's. Includes a section about converting
|
|
TextMate snippets.
|
|
|
|
</li>
|
|
<li><a href="snippet-menu.html">The YASnippet menu</a>
|
|
Explains how to use the YASnippet menu to explore, learn and modify
|
|
snippets.
|
|
|
|
</li>
|
|
<li><a href="snippet-reference.html">YASnippet Symbol Reference</a>
|
|
An automatically generated listing of all YASnippet commands,
|
|
(customization) variables, and functions.
|
|
</li>
|
|
</ol>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-6" class="outline-3">
|
|
<h3 id="sec-1-6">Bugs, discussion, contributions, etc</h3>
|
|
<div class="outline-text-3" id="text-1-6">
|
|
|
|
|
|
<p>
|
|
If you think you've found a bug, please report it on <a href="https://github.com/capitaomorte/yasnippet/issues">the GitHub issue tracker</a>
|
|
(please **do not** submit new issues to the old <a href="http://code.google.com/p/yasnippet/issues/list">googlecode tracker</a>).
|
|
</p>
|
|
<p>
|
|
If you run into problems using YASnippet, or have snippets to contribute,
|
|
post to the <a href="http://groups.google.com/group/smart-snippet">yasnippet forum</a>. Thank you very much for using YASnippet!
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="postamble">
|
|
<hr><p class='creator'>Generated by <a href="http://orgmode.org">Org</a> version 7.9.3f with <a href="http://www.gnu.org/software/emacs/">Emacs</a> version 24 on 2013-11-26T23:16-0500 from fd3fa394449da99b191e56eae35e4ad4db6679ee
|
|
</p>
|
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|