mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
Automatic documentation update.
From 582e3680b66a62f304034376516207c006f77fe4
This commit is contained in:
parent
dbed5e7fe1
commit
d8147447ee
51
faq.html
51
faq.html
@ -7,7 +7,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||||
<meta name="title" content="Frequently Asked Questions"/>
|
<meta name="title" content="Frequently Asked Questions"/>
|
||||||
<meta name="generator" content="Org-mode"/>
|
<meta name="generator" content="Org-mode"/>
|
||||||
<meta name="generated" content="2013-11-28T23:36-0500"/>
|
<meta name="generated" content="2013-12-02T19:38+0000"/>
|
||||||
<meta name="author" content=""/>
|
<meta name="author" content=""/>
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
<meta name="keywords" content=""/>
|
<meta name="keywords" content=""/>
|
||||||
@ -131,8 +131,9 @@ for the JavaScript code in this tag.
|
|||||||
<li><a href="#sec-1">Why is there an extra newline?</a></li>
|
<li><a href="#sec-1">Why is there an extra newline?</a></li>
|
||||||
<li><a href="#sec-2">Why doesn't TAB expand a snippet?</a></li>
|
<li><a href="#sec-2">Why doesn't TAB expand a snippet?</a></li>
|
||||||
<li><a href="#sec-3">Why doesn't TAB navigation work with flyspell</a></li>
|
<li><a href="#sec-3">Why doesn't TAB navigation work with flyspell</a></li>
|
||||||
<li><a href="#sec-4">How do I turn off the minor mode where in some buffers</a></li>
|
<li><a href="#sec-4">How to I use alternative keys, i.e. not TAB?</a></li>
|
||||||
<li><a href="#sec-5">How do I define an abbrev key containing characters not supported by</a></li>
|
<li><a href="#sec-5">How do I turn off the minor mode where in some buffers?</a></li>
|
||||||
|
<li><a href="#sec-6">How do I define an abbrev key containing characters not supported by</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -272,7 +273,7 @@ active:
|
|||||||
<p>
|
<p>
|
||||||
This is apparently related to overlay priorities. For some reason, the
|
This is apparently related to overlay priorities. For some reason, the
|
||||||
<code>keymap</code> property of flyspell's overlays always takes priority over the
|
<code>keymap</code> property of flyspell's overlays always takes priority over the
|
||||||
same property in yasnippet's overlays, even if one sets the latter's
|
same property in YASnippet's overlays, even if one sets the latter's
|
||||||
<code>priority</code> property to something big. If you know emacs-lisp and can
|
<code>priority</code> property to something big. If you know emacs-lisp and can
|
||||||
solve this problem, drop a line in the
|
solve this problem, drop a line in the
|
||||||
<a href="http://groups.google.com/group/smart-snippet">discussion group</a>.
|
<a href="http://groups.google.com/group/smart-snippet">discussion group</a>.
|
||||||
@ -282,10 +283,40 @@ solve this problem, drop a line in the
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-4" class="outline-2">
|
<div id="outline-container-4" class="outline-2">
|
||||||
<h2 id="sec-4">How do I turn off the minor mode where in some buffers</h2>
|
<h2 id="sec-4">How to I use alternative keys, i.e. not TAB?</h2>
|
||||||
<div class="outline-text-2" id="text-4">
|
<div class="outline-text-2" id="text-4">
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Edit the keymaps <a href="snippet-reference.html#yas-minor-mode-map"><code>yas-minor-mode-map</code></a> and
|
||||||
|
<a href="snippet-reference.html#yas-keymap"><code>yas-keymap</code></a> as you would any other keymap:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="example">(define-key yas-minor-mode-map (kbd "<tab>") nil)
|
||||||
|
(define-key yas-minor-mode-map (kbd "TAB") nil)
|
||||||
|
(define-key yas-minor-mode-map (kbd "<the new key>") 'yas-expand)
|
||||||
|
|
||||||
|
;;keys for navigation
|
||||||
|
(define-key yas-keymap [(tab)] nil)
|
||||||
|
(define-key yas-keymap (kbd "TAB") nil)
|
||||||
|
(define-key yas-keymap [(shift tab)] nil)
|
||||||
|
(define-key yas-keymap [backtab] nil)
|
||||||
|
(define-key yas-keymap (kbd "<new-next-field-key>") 'yas-next-field-or-maybe-expand)
|
||||||
|
(define-key yas-keymap (kbd "<new-prev-field-key>") 'yas-prev)
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-5" class="outline-2">
|
||||||
|
<h2 id="sec-5">How do I turn off the minor mode where in some buffers?</h2>
|
||||||
|
<div class="outline-text-2" id="text-5">
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The best way, since version 0.6.1c, is to set the default value of the
|
The best way, since version 0.6.1c, is to set the default value of the
|
||||||
variable <a href="snippet-reference.html#yas-dont-activate"><code>yas-dont-activate</code></a> to a lambda function like so:
|
variable <a href="snippet-reference.html#yas-dont-activate"><code>yas-dont-activate</code></a> to a lambda function like so:
|
||||||
@ -309,9 +340,9 @@ but only once you have setup your yas-root-directory.
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-5" class="outline-2">
|
<div id="outline-container-6" class="outline-2">
|
||||||
<h2 id="sec-5">How do I define an abbrev key containing characters not supported by</h2>
|
<h2 id="sec-6">How do I define an abbrev key containing characters not supported by</h2>
|
||||||
<div class="outline-text-2" id="text-5">
|
<div class="outline-text-2" id="text-6">
|
||||||
|
|
||||||
<p>the filesystem?
|
<p>the filesystem?
|
||||||
</p>
|
</p>
|
||||||
@ -332,7 +363,7 @@ filename as a trigger key in this case.
|
|||||||
<p>
|
<p>
|
||||||
You should rather use the <code># key:</code> directive to specify the key of the
|
You should rather use the <code># key:</code> directive to specify the key of the
|
||||||
defined snippet explicitly and name your snippet with an arbitrary valid
|
defined snippet explicitly and name your snippet with an arbitrary valid
|
||||||
filename, <code>lt.yasnippet</code> for example, using <code><</code> for the <code># key:</code>
|
filename, <code>lt.YASnippet</code> for example, using <code><</code> for the <code># key:</code>
|
||||||
directive:
|
directive:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -349,7 +380,7 @@ directive:
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="postamble">
|
<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-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb
|
<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-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4
|
||||||
</p>
|
</p>
|
||||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||||
|
|
||||||
|
216
index.html
216
index.html
@ -7,7 +7,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
<meta name="title" content="Yet another snippet extension"/>
|
<meta name="title" content="Yet another snippet extension"/>
|
||||||
<meta name="generator" content="Org-mode"/>
|
<meta name="generator" content="Org-mode"/>
|
||||||
<meta name="generated" content="2013-11-28T23:36-0500"/>
|
<meta name="generated" content="2013-12-02T19:38+0000"/>
|
||||||
<meta name="author" content=""/>
|
<meta name="author" content=""/>
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
<meta name="keywords" content=""/>
|
<meta name="keywords" content=""/>
|
||||||
@ -122,221 +122,67 @@ for the JavaScript code in this tag.
|
|||||||
<div id="content">
|
<div id="content">
|
||||||
<h1 class="title">Yet another snippet extension</h1>
|
<h1 class="title">Yet another snippet extension</h1>
|
||||||
|
|
||||||
|
<p>The YASnippet documentation has been split into separate parts:
|
||||||
<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>
|
</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="snippet-organization.html">Organizing Snippets</a>
|
<li><a href="https://github.com/capitaomorte/yasnippet/blob/master/README.mdown">README</a>
|
||||||
Describes ways to organize your snippets in the hard disk.
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Contains an introduction, installation instructions and other important
|
||||||
|
notes.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li><a href="snippet-organization.html">Organizing Snippets</a>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Describes ways to organize your snippets in the hard disk.
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="snippet-expansion.html">Expanding Snippets</a>
|
<li><a href="snippet-expansion.html">Expanding Snippets</a>
|
||||||
Describes how YASnippet chooses snippets for expansion at point.
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Describes how YASnippet chooses snippets for expansion at point.
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Maybe, you'll want some snippets to be expanded in a particular mode,
|
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…
|
or only under certain conditions, or be prompted using <code>ido</code>, etc…
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="snippet-development.html">Writing Snippets</a>
|
<li><a href="snippet-development.html">Writing Snippets</a>
|
||||||
|
|
||||||
|
<p>
|
||||||
Describes the YASnippet definition syntax, which is very close (but
|
Describes the YASnippet definition syntax, which is very close (but
|
||||||
not equivalent) to Textmate's. Includes a section about converting
|
not equivalent) to Textmate's. Includes a section about converting
|
||||||
TextMate snippets.
|
TextMate snippets.
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="snippet-menu.html">The YASnippet menu</a>
|
<li><a href="snippet-menu.html">The YASnippet menu</a>
|
||||||
|
|
||||||
|
<p>
|
||||||
Explains how to use the YASnippet menu to explore, learn and modify
|
Explains how to use the YASnippet menu to explore, learn and modify
|
||||||
snippets.
|
snippets.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li><a href="faq.html">Frequently asked questions</a>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Answers to frequently asked questions.
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="snippet-reference.html">YASnippet Symbol Reference</a>
|
<li><a href="snippet-reference.html">YASnippet Symbol Reference</a>
|
||||||
|
|
||||||
|
<p>
|
||||||
An automatically generated listing of all YASnippet commands,
|
An automatically generated listing of all YASnippet commands,
|
||||||
(customization) variables, and functions.
|
(customization) variables, and functions.
|
||||||
</li>
|
</p></li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</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">
|
<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-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb
|
<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-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4
|
||||||
</p>
|
</p>
|
||||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||||
<meta name="title" content="Writing snippets"/>
|
<meta name="title" content="Writing snippets"/>
|
||||||
<meta name="generator" content="Org-mode"/>
|
<meta name="generator" content="Org-mode"/>
|
||||||
<meta name="generated" content="2013-11-28T23:36-0500"/>
|
<meta name="generated" content="2013-12-02T19:38+0000"/>
|
||||||
<meta name="author" content=""/>
|
<meta name="author" content=""/>
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
<meta name="keywords" content=""/>
|
<meta name="keywords" content=""/>
|
||||||
@ -158,7 +158,6 @@ for the JavaScript code in this tag.
|
|||||||
<li><a href="#sec-3-9">Nested placeholder fields</a></li>
|
<li><a href="#sec-3-9">Nested placeholder fields</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#sec-4">Importing TextMate snippets</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -298,10 +297,10 @@ Here's a list of currently supported directives:
|
|||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This is the probably the most important directive, it's the abbreviation
|
This is the probably the most important directive, it's the
|
||||||
you type to expand a snippet just before hitting <a href="snippet-reference.html#yas-trigger-key"><code>yas-trigger-key</code></a>. If
|
abbreviation you type to expand a snippet just before hitting the key
|
||||||
you don't specify this the snippet will not be expandable through the
|
that runs <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a>. If you don't specify this
|
||||||
key mechanism.
|
the snippet will not be expandable through the trigger mechanism.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -790,9 +789,8 @@ insert))}}%
|
|||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The function <a href="snippet-reference.html#yas-verify-value"><code>yas-verify-value</code></a> has another neat trick, and makes use of
|
The function <a href="snippet-reference.html#yas-verify-value"><code>yas-verify-value</code></a> has another neat trick, and makes use
|
||||||
<a href="snippet-reference.html#yas-moving-away-p"><code>yas-moving-away-p</code></a>. Try it and see! Also, check out this
|
of <a href="snippet-reference.html#yas-moving-away-p"><code>yas-moving-away-p</code></a>. Try it and see! Also, check out this <a href="http://groups.google.com/group/smart-snippet/browse_thread/thread/282a90a118e1b662">thread</a>
|
||||||
<a href="http://groups.google.com/group/smart-snippet/browse_thread/thread/282a90a118e1b662">thread</a>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -824,89 +822,13 @@ the exit marker.
|
|||||||
By the way, <code>C-d</code> will only clear the field if you cursor is at the
|
By the way, <code>C-d</code> will only clear the field if you cursor is at the
|
||||||
beginning of the field <i>and</i> it hasn't been changed yet. Otherwise, it
|
beginning of the field <i>and</i> it hasn't been changed yet. Otherwise, it
|
||||||
performs the normal Emacs <code>delete-char</code> command.
|
performs the normal Emacs <code>delete-char</code> command.
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="outline-container-4" class="outline-2">
|
|
||||||
<h2 id="sec-4">Importing TextMate snippets</h2>
|
|
||||||
<div class="outline-text-2" id="text-4">
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
|
||||||
There are a couple of tools that take TextMate's ".tmSnippet" xml files
|
|
||||||
and create YASnippet definitions:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://code.nokrev.com/?p=snippet-copier.git;a=blob_plain;f=snippet_copier.py">a python script by Jeff Wheeler</a>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li>a <a href="http://yasnippet.googlecode.com/svn/trunk/extras/textmate_import.rb">ruby tool</a> , <code>textmate_import.rb</code> adapted from <a href="http://www.neutronflux.net/2009/07/28/shoulda-snippets-for-emacs/">Rob Christie's</a>,
|
|
||||||
which I have uploaded to the repository.
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
|
||||||
In this section, i'll shortly cover the <b>second</b> option.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Download the <code>textmate_import.rb</code> tool and the TextMate bundle you're
|
|
||||||
interested in.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<pre class="example">$ curl -O http://yasnippet.googlecode.com/svn/trunk/extras/textmate_import.rb
|
|
||||||
$ svn export http://svn.textmate.org/trunk/Bundles/HTML.tmbundle/
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Then invoke <code>textmate_import.rb</code> like this:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<pre class="example">$ ./textmate_import.rb -d HTML.tmbundle/Snippets/ -o html-mode -g HTML.tmbundle/info.plist
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
|
||||||
You should end up with a <code>html-mode</code> subdir containing snippets exported
|
|
||||||
from textmate.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<pre class="example">$ tree html-mode # to view dir contents, if you have 'tree' installed
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
|
||||||
The <code>-g</code> is optional but helps the tool figure out the grouping.
|
|
||||||
According to <a href="./snippet-organization.html">Organizing Snippets</a>, don't forget to touch
|
|
||||||
<code>.yas-make-groups</code> and <code>.yas-ignore-filename-triggers</code> inside the
|
|
||||||
<code>html-mode</code> dir.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Also try <code>textmate_import.rb --help</code> for a list of options.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Please note that snippet importation is not yet perfect. You'll probably
|
|
||||||
have some adjustments to some/many snippets. Please contribute these
|
|
||||||
adjustments to the google group or, better yet, patch the
|
|
||||||
<code>textmate_import.rb</code> to automatically perform them and submit that.
|
|
||||||
</p></div>
|
</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="postamble">
|
<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-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb
|
<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-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4
|
||||||
</p>
|
</p>
|
||||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||||
<meta name="title" content="Expanding snippets"/>
|
<meta name="title" content="Expanding snippets"/>
|
||||||
<meta name="generator" content="Org-mode"/>
|
<meta name="generator" content="Org-mode"/>
|
||||||
<meta name="generated" content="2013-11-28T23:36-0500"/>
|
<meta name="generated" content="2013-12-02T19:38+0000"/>
|
||||||
<meta name="author" content=""/>
|
<meta name="author" content=""/>
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
<meta name="keywords" content=""/>
|
<meta name="keywords" content=""/>
|
||||||
@ -330,9 +330,11 @@ See <a href="./snippet-menu.html">the YASnippet Menu</a>.
|
|||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To integrate with <code>hippie-expand</code>, just put <a href="snippet-reference.html#yas-hippie-try-expand"><code>yas-hippie-try-expand</code></a> in
|
To integrate with <code>hippie-expand</code>, just put
|
||||||
<code>hippie-expand-try-functions-list</code>. This probably makes more sense when
|
<a href="snippet-reference.html#yas-hippie-try-expand"><code>yas-hippie-try-expand</code></a> in
|
||||||
placed at the top of the list, but it can be put anywhere you prefer.
|
<code>hippie-expand-try-functions-list</code>. This probably makes more sense
|
||||||
|
when placed at the top of the list, but it can be put anywhere you
|
||||||
|
prefer.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -344,9 +346,10 @@ placed at the top of the list, but it can be put anywhere you prefer.
|
|||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Sometimes you might want to expand a snippet directly from you own elisp
|
Sometimes you might want to expand a snippet directly from you own
|
||||||
code. You should call <a href="snippet-reference.html#yas-expand-snippet"><code>yas-expand-snippet</code></a> instead of <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> in
|
elisp code. You should call
|
||||||
this case.
|
<a href="snippet-reference.html#yas-expand-snippet"><code>yas-expand-snippet</code></a> instead of
|
||||||
|
<a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> in this case.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
As with expanding from the menubar, the condition system and multiple
|
As with expanding from the menubar, the condition system and multiple
|
||||||
@ -418,9 +421,9 @@ In particular, the following things matter:
|
|||||||
<li>Buffer-local list of extra modes
|
<li>Buffer-local list of extra modes
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Use <a href="#yas-activate-extra-mode"><code>yas-activate-extra-mode</code></a> to consider snippet tables whose name
|
Use <a href="#yas-activate-extra-mode"><code>yas-activate-extra-mode</code></a> to
|
||||||
does not correspond to a major mode. Typically, you call this from
|
consider snippet tables whose name does not correspond to a major
|
||||||
a minor mode hook, for example:
|
mode. Typically, you call this from a minor mode hook, for example:
|
||||||
</p></li>
|
</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -437,7 +440,9 @@ In particular, the following things matter:
|
|||||||
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Buffer-local <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a> variable
|
<li>Buffer-local
|
||||||
|
<a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a>
|
||||||
|
variable
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This variable provides finer grained control over what snippets can
|
This variable provides finer grained control over what snippets can
|
||||||
@ -609,15 +614,14 @@ shortcut to select the 6th candidate.
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
See the documentation on variable <a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>
|
See the documentation on variable <a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>
|
||||||
</p>
|
</p></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="postamble">
|
<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-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb
|
<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-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4
|
||||||
</p>
|
</p>
|
||||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||||
<meta name="title" content="YASnippet menu"/>
|
<meta name="title" content="YASnippet menu"/>
|
||||||
<meta name="generator" content="Org-mode"/>
|
<meta name="generator" content="Org-mode"/>
|
||||||
<meta name="generated" content="2013-11-28T23:36-0500"/>
|
<meta name="generated" content="2013-12-02T19:38+0000"/>
|
||||||
<meta name="author" content=""/>
|
<meta name="author" content=""/>
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
<meta name="keywords" content=""/>
|
<meta name="keywords" content=""/>
|
||||||
@ -257,7 +257,7 @@ variables.
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="postamble">
|
<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-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb
|
<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-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4
|
||||||
</p>
|
</p>
|
||||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||||
<meta name="title" content="Organizing snippets"/>
|
<meta name="title" content="Organizing snippets"/>
|
||||||
<meta name="generator" content="Org-mode"/>
|
<meta name="generator" content="Org-mode"/>
|
||||||
<meta name="generated" content="2013-11-28T23:36-0500"/>
|
<meta name="generated" content="2013-12-02T19:38+0000"/>
|
||||||
<meta name="author" content=""/>
|
<meta name="author" content=""/>
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
<meta name="keywords" content=""/>
|
<meta name="keywords" content=""/>
|
||||||
@ -217,7 +217,7 @@ for the JavaScript code in this tag.
|
|||||||
(setq yas-snippet-dirs '("~/emacs.d/mysnippets"
|
(setq yas-snippet-dirs '("~/emacs.d/mysnippets"
|
||||||
"~/Downloads/interesting-snippets"))
|
"~/Downloads/interesting-snippets"))
|
||||||
|
|
||||||
;; OR, keeping yasnippet's defaults try out ~/Downloads/interesting-snippets
|
;; OR, keeping YASnippet defaults try out ~/Downloads/interesting-snippets
|
||||||
(setq yas-snippet-dirs (append yas-snippet-dirs
|
(setq yas-snippet-dirs (append yas-snippet-dirs
|
||||||
'("~/Downloads/interesting-snippets")))
|
'("~/Downloads/interesting-snippets")))
|
||||||
</pre>
|
</pre>
|
||||||
@ -367,7 +367,7 @@ ruby-mode/
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="postamble">
|
<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-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb
|
<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-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4
|
||||||
</p>
|
</p>
|
||||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||||
<meta name="title" content="Reference"/>
|
<meta name="title" content="Reference"/>
|
||||||
<meta name="generator" content="Org-mode"/>
|
<meta name="generator" content="Org-mode"/>
|
||||||
<meta name="generated" content="2013-11-28T23:36-0500"/>
|
<meta name="generated" content="2013-12-02T19:38+0000"/>
|
||||||
<meta name="author" content=""/>
|
<meta name="author" content=""/>
|
||||||
<meta name="description" content=""/>
|
<meta name="description" content=""/>
|
||||||
<meta name="keywords" content=""/>
|
<meta name="keywords" content=""/>
|
||||||
@ -1504,7 +1504,7 @@ The active keymap while a snippet expansion is in progress.
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="postamble">
|
<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-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb
|
<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-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4
|
||||||
</p>
|
</p>
|
||||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user