mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
Automatic documentation update.
From 7703a55ac416a131dec45fa6a1e0ec1e31adf760
This commit is contained in:
parent
b925a0388f
commit
1167e57937
261
faq.html
261
faq.html
@ -1,63 +1,90 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<?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">
|
||||
"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>Frequently Asked Questions</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||
<meta name="title" content="Frequently Asked Questions"/>
|
||||
<meta name="generator" content="Org-mode"/>
|
||||
<meta name="generated" content="2014-10-01T21:16+0100"/>
|
||||
<meta name="author" content=""/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="keywords" content=""/>
|
||||
<!-- 2015-09-24 Thu 21:15 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Org-mode" />
|
||||
<style type="text/css">
|
||||
<!--/*--><![CDATA[/*><!--*/
|
||||
html { font-family: Times, serif; font-size: 12pt; }
|
||||
.title { text-align: center; }
|
||||
.todo { color: red; }
|
||||
.todo { font-family: monospace; color: red; }
|
||||
.done { color: green; }
|
||||
.tag { background-color: #add8e6; font-weight:normal }
|
||||
.target { }
|
||||
.tag { background-color: #eee; font-family: monospace;
|
||||
padding: 2px; font-size: 80%; font-weight: normal; }
|
||||
.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% }
|
||||
.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; }
|
||||
.underline { text-decoration: underline; }
|
||||
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||||
p.verse { margin-left: 3%; }
|
||||
pre {
|
||||
border: 1pt solid #AEBDCC;
|
||||
background-color: #F3F5F7;
|
||||
padding: 5pt;
|
||||
font-family: courier, monospace;
|
||||
font-size: 90%;
|
||||
overflow:auto;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: 3px 3px 3px #eee;
|
||||
padding: 8pt;
|
||||
font-family: monospace;
|
||||
overflow: auto;
|
||||
margin: 1.2em;
|
||||
}
|
||||
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; }
|
||||
pre.src {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
padding-top: 1.2em;
|
||||
}
|
||||
pre.src:before {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
top: -10px;
|
||||
right: 10px;
|
||||
padding: 3px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
pre.src:hover:before { display: inline;}
|
||||
pre.src-sh:before { content: 'sh'; }
|
||||
pre.src-bash:before { content: 'sh'; }
|
||||
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||||
pre.src-R:before { content: 'R'; }
|
||||
pre.src-perl:before { content: 'Perl'; }
|
||||
pre.src-java:before { content: 'Java'; }
|
||||
pre.src-sql:before { content: 'SQL'; }
|
||||
|
||||
table { border-collapse:collapse; }
|
||||
caption.t-above { caption-side: top; }
|
||||
caption.t-bottom { caption-side: bottom; }
|
||||
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;
|
||||
.footpara:nth-child(2) { display: inline; }
|
||||
.footpara { display: block; }
|
||||
.footdef { margin-bottom: 1em; }
|
||||
.figure { padding: 1em; }
|
||||
.figure p { text-align: center; }
|
||||
.inlinetask {
|
||||
padding: 10px;
|
||||
border: 2px solid gray;
|
||||
margin: 10px;
|
||||
background: #ffffcc;
|
||||
}
|
||||
#org-div-home-and-up
|
||||
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
||||
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; }
|
||||
.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>
|
||||
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||
@ -107,11 +134,9 @@ for the JavaScript code in this tag.
|
||||
}
|
||||
/*]]>*///-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="preamble">
|
||||
<div id="preamble" class="status">
|
||||
<nav>
|
||||
<ul class="center">
|
||||
<li> <a href="index.html">Overview</a>
|
||||
@ -128,14 +153,9 @@ for the JavaScript code in this tag.
|
||||
<li> <a href="snippet-reference.html">Reference</a>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h1 class="title">Frequently Asked Questions</h1>
|
||||
|
||||
|
||||
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
@ -150,31 +170,27 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1" class="outline-2">
|
||||
<div id="outline-container-sec-1" class="outline-2">
|
||||
<h2 id="sec-1">Why is there an extra newline?</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
|
||||
|
||||
<p>
|
||||
If you have a newline at the end of the snippet definition file, then
|
||||
YASnippet will add a newline when you expanding a snippet. Please don't
|
||||
add a newline at the end if you don't want it when you saving the
|
||||
snippet file.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note some editors will automatically add a newline for you. In Emacs, if
|
||||
you set <code>require-final-newline</code> to <code>t</code>, it will add the final newline
|
||||
for you automatically.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2" class="outline-2">
|
||||
<div id="outline-container-sec-2" class="outline-2">
|
||||
<h2 id="sec-2">Why doesn't TAB expand a snippet?</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
|
||||
|
||||
<p>
|
||||
First check the mode line to see if there's <code>yas</code>. If not, then try
|
||||
<code>M-x yas-minor-mode</code> to manually turn on the minor mode and try to
|
||||
@ -182,25 +198,28 @@ expand the snippet again. If it works, then, you can add the following
|
||||
code to your <code>.emacs</code> <i>before</i> loading YASnippet:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(add-hook 'the-major-mode-hook 'yas-minor-mode-on)
|
||||
<pre class="src src-emacs-lisp">(add-hook 'the-major-mode-hook 'yas-minor-mode-on)
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
where <code>the-major-mode</code> is the major mode in which <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> isn't
|
||||
enabled by default.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
From YASnippet 0.6 you can also use the command <code>M-x yas-global-mode</code> to
|
||||
turn on YASnippet automatically for <i>all</i> major modes.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> is on but the snippet still not expanded. Then try
|
||||
to see what command is bound to the <code>TAB</code> key: press <code>C-h k</code> and then
|
||||
press <code>TAB</code>. Emacs will show you the result.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You'll see a buffer prompted by Emacs saying that
|
||||
<code>TAB runs the command ...</code>. Alternatively, you might see
|
||||
@ -210,77 +229,77 @@ command other than <a href="snippet-reference.html#yas-expand"><code>yas-expand<
|
||||
following code to work around:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(add-hook 'org-mode-hook
|
||||
(let ((original-command (lookup-key org-mode-map [tab])))
|
||||
`(lambda ()
|
||||
(setq yas-fallback-behavior
|
||||
'(apply ,original-command))
|
||||
(local-set-key [tab] 'yas-expand))))
|
||||
<pre class="src src-emacs-lisp">(add-hook 'org-mode-hook
|
||||
(let ((original-command (lookup-key org-mode-map [tab])))
|
||||
`(lambda ()
|
||||
(setq yas-fallback-behavior
|
||||
'(apply ,original-command))
|
||||
(local-set-key [tab] 'yas-expand))))
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
replace <code>org-mode-hook</code> and <code>org-mode-map</code> with the major mode hook you
|
||||
are dealing with (Use <code>C-h m</code> to see what major mode you are in).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As an alternative, you can also try
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(defun yas-advise-indent-function (function-symbol)
|
||||
<pre class="src src-emacs-lisp">(defun yas-advise-indent-function (function-symbol)
|
||||
(eval `(defadvice ,function-symbol (around yas-try-expand-first activate)
|
||||
,(format
|
||||
"Try to expand a snippet before point, then call `%s' as usual"
|
||||
function-symbol)
|
||||
(let ((yas-fallback-behavior nil))
|
||||
(unless (and (interactive-p)
|
||||
(yas-expand))
|
||||
ad-do-it)))))
|
||||
,(format
|
||||
"Try to expand a snippet before point, then call `%s' as usual"
|
||||
function-symbol)
|
||||
(let ((yas-fallback-behavior nil))
|
||||
(unless (and (interactive-p)
|
||||
(yas-expand))
|
||||
ad-do-it)))))
|
||||
|
||||
(yas-advise-indent-function 'ruby-indent-line)
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
To <i>advise</i> the modes indentation function bound to TAB, (in this case
|
||||
<code>ruby-indent-line</code>) to first try to run <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If the output of <code>C-h k RET <tab></code> tells you that <code><tab></code> is indeed
|
||||
bound to <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> but YASnippet still doesn't work, check your
|
||||
configuration and you may also ask for help on the <a href="http://groups.google.com/group/smart-snippet">discussion group</a>.
|
||||
See this particular <a href="http://code.google.com/p/yasnippet/issues/detail?id=93&can=1">thread</a> for quite some solutions and alternatives.
|
||||
See this particular <a href="http://code.google.com/p/yasnippet/issues/detail?id=93&can=1">thread</a> for quite some solutions and alternatives.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Don't forget to attach the information on what command is bound to TAB
|
||||
as well as the mode information (Can be obtained by <code>C-h m</code>).
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-3" class="outline-2">
|
||||
<div id="outline-container-sec-3" class="outline-2">
|
||||
<h2 id="sec-3">Why doesn't TAB navigation work with flyspell</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
|
||||
|
||||
<p>
|
||||
A workaround is to inhibit flyspell overlays while the snippet is
|
||||
active:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(add-hook 'flyspell-incorrect-hook
|
||||
#'(lambda (dummy1 dummy2 dymmy3)
|
||||
(and yas-active-field-overlay
|
||||
(overlay-buffer yas-active-field-overlay))))
|
||||
<pre class="src src-emacs-lisp">(add-hook 'flyspell-incorrect-hook
|
||||
#'(lambda (dummy1 dummy2 dymmy3)
|
||||
(and yas-active-field-overlay
|
||||
(overlay-buffer yas-active-field-overlay))))
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
This is apparently related to overlay priorities. For some reason, the
|
||||
@ -291,22 +310,19 @@ solve this problem, drop a line in the
|
||||
<a href="http://groups.google.com/group/smart-snippet">discussion group</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-4" class="outline-2">
|
||||
<div id="outline-container-sec-4" class="outline-2">
|
||||
<h2 id="sec-4">How to I use alternative keys, i.e. not TAB?</h2>
|
||||
<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>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(define-key yas-minor-mode-map (kbd "<tab>") nil)
|
||||
<pre class="src src-emacs-lisp">(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)
|
||||
|
||||
@ -318,30 +334,26 @@ Edit the keymaps <a href="snippet-reference.html#yas-minor-mode-map"><code>yas-m
|
||||
(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>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-5" class="outline-2">
|
||||
<div id="outline-container-sec-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>
|
||||
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:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(set-default 'yas-dont-activate
|
||||
#'(lambda ()
|
||||
(and yas-root-directory
|
||||
(null (yas-get-snippet-tables)))))
|
||||
<pre class="src src-emacs-lisp">(set-default 'yas-dont-activate
|
||||
#'(lambda ()
|
||||
(and yas-root-directory
|
||||
(null (yas-get-snippet-tables)))))
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
This is also the default value starting for that version. It skips the
|
||||
@ -349,28 +361,25 @@ minor mode in buffers where it is not applicable (no snippet tables),
|
||||
but only once you have setup your yas-root-directory.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-6" class="outline-2">
|
||||
<div id="outline-container-sec-6" class="outline-2">
|
||||
<h2 id="sec-6">How do I define an abbrev key containing characters not supported by the filesystem?</h2>
|
||||
<div class="outline-text-2" id="text-6">
|
||||
|
||||
|
||||
<ul>
|
||||
<ul class="org-ul">
|
||||
<li><b>Note</b>: This question applies if you're still defining snippets
|
||||
whose key <i>is</i> the filename. This is behavior still provided by
|
||||
version 0.6 for backward compatibilty, but is somewhat
|
||||
deprecated…
|
||||
whose key <i>is</i> the filename. This is behavior still provided by
|
||||
version 0.6 for backward compatibilty, but is somewhat
|
||||
deprecated…
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>
|
||||
For example, you want to define a snippet by the key <code><</code> which is not a
|
||||
valid character for filename on Windows. This means you can't use the
|
||||
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
|
||||
defined snippet explicitly and name your snippet with an arbitrary valid
|
||||
@ -378,23 +387,21 @@ filename, <code>lt.YASnippet</code> for example, using <code><</code> for the
|
||||
directive:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example"># key: <
|
||||
<pre class="src src-snippet"># key: <
|
||||
# name: <...></...>
|
||||
# --
|
||||
<${1:div}>$0</$1>
|
||||
</pre>
|
||||
|
||||
</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 2014-10-01T21:16+0100 from 08b044e559cc350c6e7142d088ec2d4a82e378cb
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.4.91.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10) on from 7703a55ac416a131dec45fa6a1e0ec1e31adf760
|
||||
</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</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
179
index.html
179
index.html
@ -1,63 +1,90 @@
|
||||
<?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">
|
||||
"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="2014-10-01T21:16+0100"/>
|
||||
<meta name="author" content=""/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="keywords" content=""/>
|
||||
<!-- 2015-09-24 Thu 21:15 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Org-mode" />
|
||||
<style type="text/css">
|
||||
<!--/*--><![CDATA[/*><!--*/
|
||||
html { font-family: Times, serif; font-size: 12pt; }
|
||||
.title { text-align: center; }
|
||||
.todo { color: red; }
|
||||
.todo { font-family: monospace; color: red; }
|
||||
.done { color: green; }
|
||||
.tag { background-color: #add8e6; font-weight:normal }
|
||||
.target { }
|
||||
.tag { background-color: #eee; font-family: monospace;
|
||||
padding: 2px; font-size: 80%; font-weight: normal; }
|
||||
.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% }
|
||||
.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; }
|
||||
.underline { text-decoration: underline; }
|
||||
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||||
p.verse { margin-left: 3%; }
|
||||
pre {
|
||||
border: 1pt solid #AEBDCC;
|
||||
background-color: #F3F5F7;
|
||||
padding: 5pt;
|
||||
font-family: courier, monospace;
|
||||
font-size: 90%;
|
||||
overflow:auto;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: 3px 3px 3px #eee;
|
||||
padding: 8pt;
|
||||
font-family: monospace;
|
||||
overflow: auto;
|
||||
margin: 1.2em;
|
||||
}
|
||||
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; }
|
||||
pre.src {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
padding-top: 1.2em;
|
||||
}
|
||||
pre.src:before {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
top: -10px;
|
||||
right: 10px;
|
||||
padding: 3px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
pre.src:hover:before { display: inline;}
|
||||
pre.src-sh:before { content: 'sh'; }
|
||||
pre.src-bash:before { content: 'sh'; }
|
||||
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||||
pre.src-R:before { content: 'R'; }
|
||||
pre.src-perl:before { content: 'Perl'; }
|
||||
pre.src-java:before { content: 'Java'; }
|
||||
pre.src-sql:before { content: 'SQL'; }
|
||||
|
||||
table { border-collapse:collapse; }
|
||||
caption.t-above { caption-side: top; }
|
||||
caption.t-bottom { caption-side: bottom; }
|
||||
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;
|
||||
.footpara:nth-child(2) { display: inline; }
|
||||
.footpara { display: block; }
|
||||
.footdef { margin-bottom: 1em; }
|
||||
.figure { padding: 1em; }
|
||||
.figure p { text-align: center; }
|
||||
.inlinetask {
|
||||
padding: 10px;
|
||||
border: 2px solid gray;
|
||||
margin: 10px;
|
||||
background: #ffffcc;
|
||||
}
|
||||
#org-div-home-and-up
|
||||
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
||||
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; }
|
||||
.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>
|
||||
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||
@ -107,11 +134,9 @@ for the JavaScript code in this tag.
|
||||
}
|
||||
/*]]>*///-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="preamble">
|
||||
<div id="preamble" class="status">
|
||||
<nav>
|
||||
<ul class="center">
|
||||
<li> <a href="index.html">Overview</a>
|
||||
@ -128,76 +153,78 @@ for the JavaScript code in this tag.
|
||||
<li> <a href="snippet-reference.html">Reference</a>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h1 class="title">Yet another snippet extension</h1>
|
||||
|
||||
<p>The YASnippet documentation has been split into separate parts:
|
||||
<p>
|
||||
The YASnippet documentation has been split into separate parts:
|
||||
</p>
|
||||
<ol>
|
||||
|
||||
<ol class="org-ol">
|
||||
<li><a href="https://github.com/capitaomorte/yasnippet/blob/master/README.mdown">README</a>
|
||||
|
||||
<p>
|
||||
Contains an introduction, installation instructions and other important
|
||||
notes.
|
||||
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.
|
||||
Describes ways to organize your snippets in the hard disk.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li><a href="snippet-expansion.html">Expanding Snippets</a>
|
||||
|
||||
<p>
|
||||
Describes how YASnippet chooses snippets for expansion at point.
|
||||
Describes how YASnippet chooses snippets for expansion at point.
|
||||
</p>
|
||||
|
||||
<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…
|
||||
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>
|
||||
|
||||
<p>
|
||||
Describes the YASnippet definition syntax, which is very close (but
|
||||
not equivalent) to Textmate's. Includes a section about converting
|
||||
TextMate snippets.
|
||||
Describes the YASnippet definition syntax, which is very close (but
|
||||
not equivalent) to Textmate's. Includes a section about converting
|
||||
TextMate snippets.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li><a href="snippet-menu.html">The YASnippet menu</a>
|
||||
|
||||
<p>
|
||||
Explains how to use the YASnippet menu to explore, learn and modify
|
||||
snippets.
|
||||
Explains how to use the YASnippet menu to explore, learn and modify
|
||||
snippets.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li><a href="faq.html">Frequently asked questions</a>
|
||||
|
||||
<p>
|
||||
Answers to frequently asked questions.
|
||||
Answers to frequently asked questions.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li><a href="snippet-reference.html">YASnippet Symbol Reference</a>
|
||||
|
||||
<p>
|
||||
An automatically generated listing of all YASnippet commands,
|
||||
(customization) variables, and functions.
|
||||
</p></li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
</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 2014-10-01T21:16+0100 from 08b044e559cc350c6e7142d088ec2d4a82e378cb
|
||||
An automatically generated listing of all YASnippet commands,
|
||||
(customization) variables, and functions.
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.4.91.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10) on from 7703a55ac416a131dec45fa6a1e0ec1e31adf760
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,63 +1,90 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<?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">
|
||||
"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>Expanding snippets</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||
<meta name="title" content="Expanding snippets"/>
|
||||
<meta name="generator" content="Org-mode"/>
|
||||
<meta name="generated" content="2014-10-01T21:16+0100"/>
|
||||
<meta name="author" content=""/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="keywords" content=""/>
|
||||
<!-- 2015-09-24 Thu 21:14 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Org-mode" />
|
||||
<style type="text/css">
|
||||
<!--/*--><![CDATA[/*><!--*/
|
||||
html { font-family: Times, serif; font-size: 12pt; }
|
||||
.title { text-align: center; }
|
||||
.todo { color: red; }
|
||||
.todo { font-family: monospace; color: red; }
|
||||
.done { color: green; }
|
||||
.tag { background-color: #add8e6; font-weight:normal }
|
||||
.target { }
|
||||
.tag { background-color: #eee; font-family: monospace;
|
||||
padding: 2px; font-size: 80%; font-weight: normal; }
|
||||
.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% }
|
||||
.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; }
|
||||
.underline { text-decoration: underline; }
|
||||
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||||
p.verse { margin-left: 3%; }
|
||||
pre {
|
||||
border: 1pt solid #AEBDCC;
|
||||
background-color: #F3F5F7;
|
||||
padding: 5pt;
|
||||
font-family: courier, monospace;
|
||||
font-size: 90%;
|
||||
overflow:auto;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: 3px 3px 3px #eee;
|
||||
padding: 8pt;
|
||||
font-family: monospace;
|
||||
overflow: auto;
|
||||
margin: 1.2em;
|
||||
}
|
||||
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; }
|
||||
pre.src {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
padding-top: 1.2em;
|
||||
}
|
||||
pre.src:before {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
top: -10px;
|
||||
right: 10px;
|
||||
padding: 3px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
pre.src:hover:before { display: inline;}
|
||||
pre.src-sh:before { content: 'sh'; }
|
||||
pre.src-bash:before { content: 'sh'; }
|
||||
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||||
pre.src-R:before { content: 'R'; }
|
||||
pre.src-perl:before { content: 'Perl'; }
|
||||
pre.src-java:before { content: 'Java'; }
|
||||
pre.src-sql:before { content: 'SQL'; }
|
||||
|
||||
table { border-collapse:collapse; }
|
||||
caption.t-above { caption-side: top; }
|
||||
caption.t-bottom { caption-side: bottom; }
|
||||
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;
|
||||
.footpara:nth-child(2) { display: inline; }
|
||||
.footpara { display: block; }
|
||||
.footdef { margin-bottom: 1em; }
|
||||
.figure { padding: 1em; }
|
||||
.figure p { text-align: center; }
|
||||
.inlinetask {
|
||||
padding: 10px;
|
||||
border: 2px solid gray;
|
||||
margin: 10px;
|
||||
background: #ffffcc;
|
||||
}
|
||||
#org-div-home-and-up
|
||||
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
||||
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; }
|
||||
.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>
|
||||
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||
@ -107,11 +134,9 @@ for the JavaScript code in this tag.
|
||||
}
|
||||
/*]]>*///-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="preamble">
|
||||
<div id="preamble" class="status">
|
||||
<nav>
|
||||
<ul class="center">
|
||||
<li> <a href="index.html">Overview</a>
|
||||
@ -128,21 +153,9 @@ for the JavaScript code in this tag.
|
||||
<li> <a href="snippet-reference.html">Reference</a>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h1 class="title">Expanding snippets</h1>
|
||||
|
||||
|
||||
<p>
|
||||
This section describes how YASnippet chooses snippets for expansion at point.
|
||||
</p>
|
||||
<p>
|
||||
Maybe, you'll want some snippets to be expanded in a particular
|
||||
mode, or only under certain conditions, or be prompted using
|
||||
</p>
|
||||
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
@ -178,104 +191,109 @@ for the JavaScript code in this tag.
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1" class="outline-2">
|
||||
<h2 id="sec-1">Triggering expansion</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
|
||||
<p>
|
||||
This section describes how YASnippet chooses snippets for expansion at point.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can use YASnippet to expand snippets in different ways:
|
||||
Maybe, you'll want some snippets to be expanded in a particular
|
||||
mode, or only under certain conditions, or be prompted using
|
||||
</p>
|
||||
<ul>
|
||||
|
||||
<div id="outline-container-sec-1" class="outline-2">
|
||||
<h2 id="sec-1">Triggering expansion</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
You can use YASnippet to expand snippets in different ways:
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>When <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> is active:
|
||||
<ul>
|
||||
<ul class="org-ul">
|
||||
<li>Type the snippet's <b>trigger key</b> then calling <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a>
|
||||
(bound to <code>TAB</code> by default).
|
||||
|
||||
</li>
|
||||
|
||||
<li>Use the snippet's <b>keybinding</b>.
|
||||
|
||||
</li>
|
||||
|
||||
<li>By expanding directly from the "YASnippet" menu in the menu-bar
|
||||
|
||||
</li>
|
||||
<li>Using hippie-expand
|
||||
|
||||
<li>Using hippie-expand
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>Call <a href="snippet-reference.html#yas-insert-snippet"><code>yas-insert-snippet</code></a> (use <code>M-x yas-insert-snippet=</code> or its
|
||||
keybinding <code>C-c & C-s</code>).
|
||||
|
||||
keybinding <code>C-c & C-s</code>).
|
||||
</li>
|
||||
|
||||
<li>Use m2m's excellent auto-complete
|
||||
TODO: example for this
|
||||
|
||||
TODO: example for this
|
||||
</li>
|
||||
|
||||
<li>Expanding from emacs-lisp code
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1-1" class="outline-3">
|
||||
<div id="outline-container-sec-1-1" class="outline-3">
|
||||
<h3 id="sec-1-1">Trigger key</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
|
||||
|
||||
<p>
|
||||
<a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> tries to expand a <i>snippet abbrev</i> (also known as
|
||||
<i>snippet key</i>) before point.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> is enabled, it binds <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> to <code>TAB</code> and
|
||||
<code><tab></code> by default, however, you can freely set it to some other key:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(define-key yas-minor-mode-map (kbd "<tab>") nil)
|
||||
<pre class="src src-emacs-lisp">(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)
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
To enable the YASnippet minor mode in all buffers globally use the
|
||||
command <a href="snippet-reference.html#yas-global-mode"><code>yas-global-mode</code></a>. This will enable a modeline indicator,
|
||||
<code>yas</code>:
|
||||
</p>
|
||||
<p>
|
||||
<img src="./images/minor-mode-indicator.png" alt="./images/minor-mode-indicator.png" />
|
||||
|
||||
|
||||
<div class="figure">
|
||||
<p><img src="./images/minor-mode-indicator.png" alt="minor-mode-indicator.png" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
When you use <a href="snippet-reference.html#yas-global-mode"><code>yas-global-mode</code></a> you can also selectively disable
|
||||
YASnippet in some buffers by setting the buffer-local variable
|
||||
<a href="snippet-reference.html#yas-dont-active"><code>yas-dont-active</code></a> in the buffer's mode hook.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1-1-1" class="outline-4">
|
||||
<div id="outline-container-sec-1-1-1" class="outline-4">
|
||||
<h4 id="sec-1-1-1">Fallback behaviour</h4>
|
||||
<div class="outline-text-4" id="text-1-1-1">
|
||||
|
||||
|
||||
<p>
|
||||
<a href="snippet-reference.html#yas-fallback-behaviour"><code>yas-fallback-behaviour</code></a> is a customization variable bound to
|
||||
'<code>call-other-command</code> by default. If <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> failed to find any
|
||||
suitable snippet to expand, it will disable the minor mode temporarily
|
||||
and find if there's any other command bound to the same key.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If found, the command will be called. Usually this works very well
|
||||
–when there's a snippet, expand it, otherwise, call whatever command
|
||||
–when there's a snippet, expand it, otherwise, call whatever command
|
||||
originally bind to the trigger key.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
However, you can change this behavior by customizing the
|
||||
<a href="snippet-reference.html#yas-fallback-behavior"><code>yas-fallback-behavior</code></a> variable. If you set this variable to
|
||||
@ -284,63 +302,53 @@ However, you can change this behavior by customizing the
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1-2" class="outline-3">
|
||||
<div id="outline-container-sec-1-2" class="outline-3">
|
||||
<h3 id="sec-1-2">Insert at point</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
|
||||
|
||||
<p>
|
||||
The command <a href="#yas-insert-snippet"><code>yas-insert-snippet</code></a> lets you insert snippets at point
|
||||
The command <i><code>yas-insert-snippet</code></i> lets you insert snippets at point
|
||||
<i>for your current major mode</i>. It prompts you for the snippet key
|
||||
first, and then for a snippet template if more than one template
|
||||
exists for the same key.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The list presented contains the snippets that can be inserted at point,
|
||||
according to the condition system. If you want to see all applicable
|
||||
snippets for the major mode, prefix this command with <code>C-u</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The prompting methods used are again controlled by
|
||||
<a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1-3" class="outline-3">
|
||||
<div id="outline-container-sec-1-3" class="outline-3">
|
||||
<h3 id="sec-1-3">Snippet keybinding</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
|
||||
|
||||
<p>
|
||||
See the section of the <code># binding:</code> directive in
|
||||
<a href="./snippet-development.html">Writing Snippets</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1-4" class="outline-3">
|
||||
<div id="outline-container-sec-1-4" class="outline-3">
|
||||
<h3 id="sec-1-4">Expanding from the menu</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
|
||||
|
||||
<p>
|
||||
See <a href="./snippet-menu.html">the YASnippet Menu</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1-5" class="outline-3">
|
||||
<div id="outline-container-sec-1-5" class="outline-3">
|
||||
<h3 id="sec-1-5">Expanding with <code>hippie-expand</code></h3>
|
||||
<div class="outline-text-3" id="text-1-5">
|
||||
|
||||
|
||||
<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
|
||||
@ -349,137 +357,130 @@ when placed at the top of the list, but it can be put anywhere you
|
||||
prefer.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1-6" class="outline-3">
|
||||
<div id="outline-container-sec-1-6" class="outline-3">
|
||||
<h3 id="sec-1-6">Expanding from emacs-lisp code</h3>
|
||||
<div class="outline-text-3" id="text-1-6">
|
||||
|
||||
|
||||
<p>
|
||||
Sometimes you might want to expand a snippet directly from you own
|
||||
elisp 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 this case.
|
||||
Sometimes you might want to expand a snippet directly from your own
|
||||
elisp 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 this case. <a href="snippet-reference.html#yas-expand-snippet"><code>yas-expand-snippet</code></a> takes a string in
|
||||
snippet template syntax, if you want to expand an existing snippet you
|
||||
can use <a href="snippet-reference.html#yas-lookup-snippet"><code>yas-lookup-snippet</code></a> to find its contents by name.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As with expanding from the menubar, the condition system and multiple
|
||||
candidates doesn't affect expansion. In fact, expanding from the
|
||||
YASnippet menu has the same effect of evaluating the follow code:
|
||||
candidates doesn't affect expansion (the condition system does affect
|
||||
<a href="snippet-reference.html#yas-lookup-snippet"><code>yas-lookup-snippet</code></a> though). In fact, expanding from the YASnippet
|
||||
menu has the same effect of evaluating the follow code:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(yas-expand-snippet template)
|
||||
<pre class="src src-emacs-lisp">(yas-expand-snippet template)
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
See the internal documentation on <a href="snippet-reference.html#yas-expand-snippet"><code>yas-expand-snippet</code></a> for more
|
||||
information.
|
||||
See the internal documentation on <a href="snippet-reference.html#yas-expand-snippet"><code>yas-expand-snippet</code></a> and
|
||||
<a href="snippet-reference.html#yas-lookup-snippet"><code>yas-lookup-snippet</code></a> for more information.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2" class="outline-2">
|
||||
<div id="outline-container-sec-2" class="outline-2">
|
||||
<h2 id="sec-2">Controlling expansion</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2-1" class="outline-3">
|
||||
</div><div id="outline-container-sec-2-1" class="outline-3">
|
||||
<h3 id="sec-2-1">Eligible snippets</h3>
|
||||
<div class="outline-text-3" id="text-2-1">
|
||||
|
||||
|
||||
<p>
|
||||
YASnippet does quite a bit of filtering to find out which snippets are
|
||||
eligible for expanding at the current cursor position.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In particular, the following things matter:
|
||||
</p>
|
||||
<ul>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>Currently loaded snippets tables
|
||||
|
||||
<p>
|
||||
These are loaded from a directory hierarchy in your file system. See
|
||||
<a href="./snippet-organization.html">Organizing Snippets</a>. They are named
|
||||
after major modes like <code>html-mode</code>, <code>ruby-mode</code>, etc…
|
||||
These are loaded from a directory hierarchy in your file system. See
|
||||
<a href="./snippet-organization.html">Organizing Snippets</a>. They are named
|
||||
after major modes like <code>html-mode</code>, <code>ruby-mode</code>, etc…
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>Major mode of the current buffer
|
||||
|
||||
<p>
|
||||
If the currrent major mode matches one of the loaded snippet tables,
|
||||
then all that table's snippets are considered for expansion. Use
|
||||
<code>M-x describe-variable RET major-mode RET</code> to find out which major
|
||||
mode you are in currently.
|
||||
If the currrent major mode matches one of the loaded snippet tables,
|
||||
then all that table's snippets are considered for expansion. Use
|
||||
<code>M-x describe-variable RET major-mode RET</code> to find out which major
|
||||
mode you are in currently.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>Parent tables
|
||||
|
||||
<p>
|
||||
Snippet tables defined as the parent of some other eligible table are
|
||||
also considered. This works recursively, i.e. parents of parents of
|
||||
eligible tables are also considered.
|
||||
Snippet tables defined as the parent of some other eligible table are
|
||||
also considered. This works recursively, i.e. parents of parents of
|
||||
eligible tables are also considered.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>Buffer-local list of extra modes
|
||||
|
||||
<p>
|
||||
Use <a href="#yas-activate-extra-mode"><code>yas-activate-extra-mode</code></a> to
|
||||
consider snippet tables whose name does not correspond to a major
|
||||
mode. Typically, you call this from a minor mode hook, for example:
|
||||
</p></li>
|
||||
Use <i><code>yas-activate-extra-mode</code></i> to
|
||||
consider snippet tables whose name does not correspond to a major
|
||||
mode. Typically, you call this from a minor mode hook, for example:
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
|
||||
|
||||
<pre class="example">;; When entering rinari-minor-mode, consider also the snippets in the
|
||||
<pre class="src src-emacs-lisp">;; When entering rinari-minor-mode, consider also the snippets in the
|
||||
;; snippet table "rails-mode"
|
||||
(add-hook 'rinari-minor-mode-hook
|
||||
#'(lambda ()
|
||||
(yas-activate-extra-mode 'rails-mode)))
|
||||
#'(lambda ()
|
||||
(yas-activate-extra-mode 'rails-mode)))
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<ul>
|
||||
<ul class="org-ul">
|
||||
<li>Buffer-local
|
||||
<a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a>
|
||||
variable
|
||||
<a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a>
|
||||
variable
|
||||
|
||||
<p>
|
||||
This variable provides finer grained control over what snippets can
|
||||
be expanded in the current buffer. The default value won't let you
|
||||
expand snippets inside comments or string literals for example. See
|
||||
The condition system_ for more info.
|
||||
</p></li>
|
||||
This variable provides finer grained control over what snippets can
|
||||
be expanded in the current buffer. The default value won't let you
|
||||
expand snippets inside comments or string literals for example. See
|
||||
The condition system\_ for more info.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2-2" class="outline-3">
|
||||
<div id="outline-container-sec-2-2" class="outline-3">
|
||||
<h3 id="sec-2-2">The condition system</h3>
|
||||
<div class="outline-text-3" id="text-2-2">
|
||||
|
||||
|
||||
<p>
|
||||
Consider this scenario: you are an old Emacs hacker. You like the
|
||||
abbrev-way and bind <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> to <code>SPC</code>. However, you don't want
|
||||
<code>if</code> to be expanded as a snippet when you are typing in a comment
|
||||
block or a string (e.g. in <code>python-mode</code>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you use the <code># condition :</code> directive (see
|
||||
<a href="./snippet-development.html">Writing Snippets</a>) you could just specify
|
||||
@ -489,154 +490,151 @@ snippets is just boring. So has a buffer local variable
|
||||
<a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a>. You can set this variable to
|
||||
<code>(not (python-in-string/comment))</code> in <code>python-mode-hook</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Then, what if you really want some particular snippet to expand even
|
||||
inside a comment? Set <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a> like this
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(add-hook 'python-mode-hook
|
||||
(lambda ()
|
||||
(setq yas-buffer-local-condition
|
||||
'(if (python-in-string/comment)
|
||||
'(require-snippet-condition . force-in-comment)
|
||||
t))))
|
||||
<pre class="src src-emacs-lisp">(add-hook 'python-mode-hook
|
||||
(lambda ()
|
||||
(setq yas-buffer-local-condition
|
||||
'(if (python-in-string/comment)
|
||||
'(require-snippet-condition . force-in-comment)
|
||||
t))))
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
… and specify the condition for a snippet that you're going to expand
|
||||
… and specify the condition for a snippet that you're going to expand
|
||||
in comment to be evaluated to the symbol <code>force-in-comment</code>. Then it can
|
||||
be expanded as you expected, while other snippets like <code>if</code> still can't
|
||||
expanded in comment.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For the full set of possible conditions, see the documentation for
|
||||
<a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2-3" class="outline-3">
|
||||
<div id="outline-container-sec-2-3" class="outline-3">
|
||||
<h3 id="sec-2-3">Multiples snippet with the same key</h3>
|
||||
<div class="outline-text-3" id="text-2-3">
|
||||
|
||||
|
||||
<p>
|
||||
The rules outlined <a href="#sec-2-1">above</a> can return more than
|
||||
The rules outlined <i>above</i> can return more than
|
||||
one snippet to be expanded at point.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When there are multiple candidates, YASnippet will let you select one.
|
||||
The UI for selecting multiple candidate can be customized through
|
||||
<a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a> , which defines your preferred methods of being
|
||||
prompted for snippets.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can customize it with
|
||||
<code>M-x customize-variable RET yas-prompt-functions RET</code>. Alternatively you
|
||||
can put in your emacs-file:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">(setq yas-prompt-functions '(yas-x-prompt yas-dropdown-prompt))
|
||||
<pre class="src src-emacs-lisp">(setq yas-prompt-functions '(yas-x-prompt yas-dropdown-prompt))
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Currently there are some alternatives solution with YASnippet.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2-3-1" class="outline-4">
|
||||
<div id="outline-container-sec-2-3-1" class="outline-4">
|
||||
<h4 id="sec-2-3-1">Use the X window system</h4>
|
||||
<div class="outline-text-4" id="text-2-3-1">
|
||||
|
||||
|
||||
<p>
|
||||
<img src="./images/x-menu.png" alt="./images/x-menu.png" />
|
||||
<div class="figure">
|
||||
<p><img src="./images/x-menu.png" alt="x-menu.png" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The function <a href="snippet-reference.html#yas-x-prompt"><code>yas-x-prompt</code></a> can be used to show a popup menu for you to
|
||||
select. This menu will be part of you native window system widget, which
|
||||
means:
|
||||
</p>
|
||||
<ul>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>It usually looks beautiful. E.g. when you compile Emacs with gtk
|
||||
support, this menu will be rendered with your gtk theme.
|
||||
support, this menu will be rendered with your gtk theme.
|
||||
</li>
|
||||
<li>Your window system may or may not allow to you use <code>C-n</code>, <code>C-p</code> to
|
||||
navigate this menu.
|
||||
navigate this menu.
|
||||
</li>
|
||||
<li>This function can't be used when in a terminal.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2-3-2" class="outline-4">
|
||||
<div id="outline-container-sec-2-3-2" class="outline-4">
|
||||
<h4 id="sec-2-3-2">Minibuffer prompting</h4>
|
||||
<div class="outline-text-4" id="text-2-3-2">
|
||||
|
||||
|
||||
<p>
|
||||
<img src="./images/ido-menu.png" alt="./images/ido-menu.png" />
|
||||
<div class="figure">
|
||||
<p><img src="./images/ido-menu.png" alt="ido-menu.png" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
You can use functions <a href="snippet-reference.html#yas-completing-prompt"><code>yas-completing-prompt</code></a> for the classic emacs
|
||||
completion method or <a href="snippet-reference.html#yas-ido-prompt"><code>yas-ido-prompt</code></a> for a much nicer looking method.
|
||||
The best way is to try it. This works in a terminal.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2-3-3" class="outline-4">
|
||||
<div id="outline-container-sec-2-3-3" class="outline-4">
|
||||
<h4 id="sec-2-3-3">Use <code>dropdown-menu.el</code></h4>
|
||||
<div class="outline-text-4" id="text-2-3-3">
|
||||
|
||||
|
||||
<p>
|
||||
<img src="./images/dropdown-menu.png" alt="./images/dropdown-menu.png" />
|
||||
<div class="figure">
|
||||
<p><img src="./images/dropdown-menu.png" alt="dropdown-menu.png" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The function <a href="snippet-reference.html#yas-dropdown-prompt"><code>yas-dropdown-prompt</code></a> can also be placed in the
|
||||
<a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a> list.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This works in both window system and terminal and is customizable, you
|
||||
can use <code>C-n</code>, <code>C-p</code> to navigate, <code>q</code> to quit and even press <code>6</code> as a
|
||||
shortcut to select the 6th candidate.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2-3-4" class="outline-4">
|
||||
<div id="outline-container-sec-2-3-4" class="outline-4">
|
||||
<h4 id="sec-2-3-4">Roll your own</h4>
|
||||
<div class="outline-text-4" id="text-2-3-4">
|
||||
|
||||
|
||||
<p>
|
||||
See the documentation on variable <a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>
|
||||
</p></div>
|
||||
</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 2014-10-01T21:16+0100 from 08b044e559cc350c6e7142d088ec2d4a82e378cb
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.4.91.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10) on from 7703a55ac416a131dec45fa6a1e0ec1e31adf760
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,63 +1,90 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<?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">
|
||||
"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>YASnippet menu</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||
<meta name="title" content="YASnippet menu"/>
|
||||
<meta name="generator" content="Org-mode"/>
|
||||
<meta name="generated" content="2014-10-01T21:16+0100"/>
|
||||
<meta name="author" content=""/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="keywords" content=""/>
|
||||
<!-- 2015-09-24 Thu 21:14 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Org-mode" />
|
||||
<style type="text/css">
|
||||
<!--/*--><![CDATA[/*><!--*/
|
||||
html { font-family: Times, serif; font-size: 12pt; }
|
||||
.title { text-align: center; }
|
||||
.todo { color: red; }
|
||||
.todo { font-family: monospace; color: red; }
|
||||
.done { color: green; }
|
||||
.tag { background-color: #add8e6; font-weight:normal }
|
||||
.target { }
|
||||
.tag { background-color: #eee; font-family: monospace;
|
||||
padding: 2px; font-size: 80%; font-weight: normal; }
|
||||
.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% }
|
||||
.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; }
|
||||
.underline { text-decoration: underline; }
|
||||
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||||
p.verse { margin-left: 3%; }
|
||||
pre {
|
||||
border: 1pt solid #AEBDCC;
|
||||
background-color: #F3F5F7;
|
||||
padding: 5pt;
|
||||
font-family: courier, monospace;
|
||||
font-size: 90%;
|
||||
overflow:auto;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: 3px 3px 3px #eee;
|
||||
padding: 8pt;
|
||||
font-family: monospace;
|
||||
overflow: auto;
|
||||
margin: 1.2em;
|
||||
}
|
||||
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; }
|
||||
pre.src {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
padding-top: 1.2em;
|
||||
}
|
||||
pre.src:before {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
top: -10px;
|
||||
right: 10px;
|
||||
padding: 3px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
pre.src:hover:before { display: inline;}
|
||||
pre.src-sh:before { content: 'sh'; }
|
||||
pre.src-bash:before { content: 'sh'; }
|
||||
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||||
pre.src-R:before { content: 'R'; }
|
||||
pre.src-perl:before { content: 'Perl'; }
|
||||
pre.src-java:before { content: 'Java'; }
|
||||
pre.src-sql:before { content: 'SQL'; }
|
||||
|
||||
table { border-collapse:collapse; }
|
||||
caption.t-above { caption-side: top; }
|
||||
caption.t-bottom { caption-side: bottom; }
|
||||
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;
|
||||
.footpara:nth-child(2) { display: inline; }
|
||||
.footpara { display: block; }
|
||||
.footdef { margin-bottom: 1em; }
|
||||
.figure { padding: 1em; }
|
||||
.figure p { text-align: center; }
|
||||
.inlinetask {
|
||||
padding: 10px;
|
||||
border: 2px solid gray;
|
||||
margin: 10px;
|
||||
background: #ffffcc;
|
||||
}
|
||||
#org-div-home-and-up
|
||||
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
||||
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; }
|
||||
.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>
|
||||
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||
@ -107,11 +134,9 @@ for the JavaScript code in this tag.
|
||||
}
|
||||
/*]]>*///-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="preamble">
|
||||
<div id="preamble" class="status">
|
||||
<nav>
|
||||
<ul class="center">
|
||||
<li> <a href="index.html">Overview</a>
|
||||
@ -128,40 +153,9 @@ for the JavaScript code in this tag.
|
||||
<li> <a href="snippet-reference.html">Reference</a>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h1 class="title">YASnippet menu</h1>
|
||||
|
||||
|
||||
<p>
|
||||
When <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> is active, YASnippet will setup a menu just after
|
||||
the "Buffers" menu in the menubar.
|
||||
</p>
|
||||
<p>
|
||||
In this menu, you can find
|
||||
</p>
|
||||
<ul>
|
||||
<li>The currently loaded snippet definitions, organized by major mode,
|
||||
and optional grouping.
|
||||
|
||||
</li>
|
||||
<li>A rundown of the most common commands, (followed by their
|
||||
keybindings) including commands to load directories and reload all
|
||||
snippet definitions.
|
||||
|
||||
</li>
|
||||
<li>A series of submenus for customizing and exploring YASnippet
|
||||
behavior.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>
|
||||
<img src="./images/menu-1.png" alt="./images/menu-1.png" />
|
||||
</p>
|
||||
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
@ -174,105 +168,125 @@ In this menu, you can find
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
When <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> is active, YASnippet will setup a menu just after
|
||||
the "Buffers" menu in the menubar.
|
||||
</p>
|
||||
|
||||
<div id="outline-container-1" class="outline-2">
|
||||
<p>
|
||||
In this menu, you can find
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>The currently loaded snippet definitions, organized by major mode,
|
||||
and optional grouping.
|
||||
</li>
|
||||
|
||||
<li>A rundown of the most common commands, (followed by their
|
||||
keybindings) including commands to load directories and reload all
|
||||
snippet definitions.
|
||||
</li>
|
||||
|
||||
<li>A series of submenus for customizing and exploring YASnippet
|
||||
behavior.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div class="figure">
|
||||
<p><img src="./images/menu-1.png" alt="menu-1.png" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1" class="outline-2">
|
||||
<h2 id="sec-1">Loading snippets from menu</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
|
||||
|
||||
<p>
|
||||
Invoking "Load snippets…" from the menu invokes <a href="snippet-reference.html#yas-load-directory"><code>yas-load-directory</code></a>
|
||||
Invoking "Load snippets…" from the menu invokes <a href="snippet-reference.html#yas-load-directory"><code>yas-load-directory</code></a>
|
||||
and prompts you for a snippet directory hierarchy to load.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Also useful is the "Reload everything" item to invoke <a href="#yas-reload-all"><code>yas-reload-all</code></a>
|
||||
Also useful is the "Reload everything" item to invoke <i><code>yas-reload-all</code></i>
|
||||
which uncondionally reloads all the snippets directories defined in
|
||||
<a href="snippet-reference.html#yas-snippet-dirs"><code>yas-snippet-dirs</code></a> and rebuilds the menus.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2" class="outline-2">
|
||||
<div id="outline-container-sec-2" class="outline-2">
|
||||
<h2 id="sec-2">Snippet menu behavior</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
|
||||
|
||||
<p>
|
||||
YASnippet will list in this section all the loaded snippet definitions
|
||||
organized by snippet table name.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can use this section to explore currently loaded snippets. If you
|
||||
click on one of them, the default behavior is to expand it,
|
||||
unconditionally, inside the current buffer.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can however, customize variable <a href="snippet-reference.html#yas-visit-from-menu"><code>yas-visit-from-menu</code></a> to be <code>t</code>
|
||||
which will take you to the snippet definition file when you select it
|
||||
from the menu.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you want the menu show only snippet tables whose name corresponds to
|
||||
a "real" major mode. You do this by setting <a href="snippet-reference.html#yas-use-menu"><code>yas-use-menu</code></a> to
|
||||
'<code>real-modes</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Finally, to have the menu show only the tables for the currently active
|
||||
mode, set <a href="snippet-reference.html#yas-use-menu"><code>yas-use-menu</code></a> to <code>abbreviate</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
These customizations can also be found in the menu itself, under the
|
||||
"Snippet menu behavior" submenu.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-3" class="outline-2">
|
||||
<div id="outline-container-sec-3" class="outline-2">
|
||||
<h2 id="sec-3">Controlling indenting</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
|
||||
|
||||
<p>
|
||||
The "Indenting" submenu contains options to control the values of
|
||||
<a href="snippet-reference.html#yas-indent-line"><code>yas-indent-line</code></a> and <a href="snippet-reference.html#yas-also-auto-indent-first-line"><code>yas-also-auto-indent-first-line</code></a>. See
|
||||
<a href="./snippet-development.html">Writing snippets</a> .
|
||||
<a href="./snippet-development.html">Writing snippets</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-4" class="outline-2">
|
||||
<div id="outline-container-sec-4" class="outline-2">
|
||||
<h2 id="sec-4">Prompting method</h2>
|
||||
<div class="outline-text-2" id="text-4">
|
||||
|
||||
|
||||
<p>
|
||||
The "Prompting method" submenu contains options to control the value of
|
||||
<a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>. See <a href="./snippet-expansion.html">Expanding snippets</a> .
|
||||
<a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>. See <a href="./snippet-expansion.html">Expanding snippets</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-5" class="outline-2">
|
||||
<div id="outline-container-sec-5" class="outline-2">
|
||||
<h2 id="sec-5">Misc</h2>
|
||||
<div class="outline-text-2" id="text-5">
|
||||
|
||||
|
||||
<p>
|
||||
The "Misc" submenu contains options to control the values of more
|
||||
variables.
|
||||
</p></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 2014-10-01T21:16+0100 from 08b044e559cc350c6e7142d088ec2d4a82e378cb
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.4.91.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10) on from 7703a55ac416a131dec45fa6a1e0ec1e31adf760
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,63 +1,90 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<?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">
|
||||
"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>Organizing snippets</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||
<meta name="title" content="Organizing snippets"/>
|
||||
<meta name="generator" content="Org-mode"/>
|
||||
<meta name="generated" content="2014-10-01T21:16+0100"/>
|
||||
<meta name="author" content=""/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="keywords" content=""/>
|
||||
<!-- 2015-09-24 Thu 21:14 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Org-mode" />
|
||||
<style type="text/css">
|
||||
<!--/*--><![CDATA[/*><!--*/
|
||||
html { font-family: Times, serif; font-size: 12pt; }
|
||||
.title { text-align: center; }
|
||||
.todo { color: red; }
|
||||
.todo { font-family: monospace; color: red; }
|
||||
.done { color: green; }
|
||||
.tag { background-color: #add8e6; font-weight:normal }
|
||||
.target { }
|
||||
.tag { background-color: #eee; font-family: monospace;
|
||||
padding: 2px; font-size: 80%; font-weight: normal; }
|
||||
.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% }
|
||||
.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; }
|
||||
.underline { text-decoration: underline; }
|
||||
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||||
p.verse { margin-left: 3%; }
|
||||
pre {
|
||||
border: 1pt solid #AEBDCC;
|
||||
background-color: #F3F5F7;
|
||||
padding: 5pt;
|
||||
font-family: courier, monospace;
|
||||
font-size: 90%;
|
||||
overflow:auto;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: 3px 3px 3px #eee;
|
||||
padding: 8pt;
|
||||
font-family: monospace;
|
||||
overflow: auto;
|
||||
margin: 1.2em;
|
||||
}
|
||||
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; }
|
||||
pre.src {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
padding-top: 1.2em;
|
||||
}
|
||||
pre.src:before {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
top: -10px;
|
||||
right: 10px;
|
||||
padding: 3px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
pre.src:hover:before { display: inline;}
|
||||
pre.src-sh:before { content: 'sh'; }
|
||||
pre.src-bash:before { content: 'sh'; }
|
||||
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||||
pre.src-R:before { content: 'R'; }
|
||||
pre.src-perl:before { content: 'Perl'; }
|
||||
pre.src-java:before { content: 'Java'; }
|
||||
pre.src-sql:before { content: 'SQL'; }
|
||||
|
||||
table { border-collapse:collapse; }
|
||||
caption.t-above { caption-side: top; }
|
||||
caption.t-bottom { caption-side: bottom; }
|
||||
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;
|
||||
.footpara:nth-child(2) { display: inline; }
|
||||
.footpara { display: block; }
|
||||
.footdef { margin-bottom: 1em; }
|
||||
.figure { padding: 1em; }
|
||||
.figure p { text-align: center; }
|
||||
.inlinetask {
|
||||
padding: 10px;
|
||||
border: 2px solid gray;
|
||||
margin: 10px;
|
||||
background: #ffffcc;
|
||||
}
|
||||
#org-div-home-and-up
|
||||
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
||||
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; }
|
||||
.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>
|
||||
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||
@ -107,11 +134,9 @@ for the JavaScript code in this tag.
|
||||
}
|
||||
/*]]>*///-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="preamble">
|
||||
<div id="preamble" class="status">
|
||||
<nav>
|
||||
<ul class="center">
|
||||
<li> <a href="index.html">Overview</a>
|
||||
@ -128,14 +153,9 @@ for the JavaScript code in this tag.
|
||||
<li> <a href="snippet-reference.html">Reference</a>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h1 class="title">Organizing snippets</h1>
|
||||
|
||||
|
||||
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
@ -143,39 +163,32 @@ for the JavaScript code in this tag.
|
||||
<li><a href="#sec-1">Basic structure</a></li>
|
||||
<li><a href="#sec-2">Setting up <code>yas-snippet-dirs</code></a></li>
|
||||
<li><a href="#sec-3">The <code>.yas-parents</code> file</a></li>
|
||||
<li><a href="#sec-4">The <code>.yas-make-groups</code> file</a></li>
|
||||
<li><a href="#sec-5">The <code>.yas-setup.el</code> file</a>
|
||||
<li><a href="#sec-4"><span class="todo TODO">TODO</span> The <code>.yas-make-groups</code> file</a></li>
|
||||
<li><a href="#sec-5"><span class="todo TODO">TODO</span> The <code>.yas-setup.el</code> file</a>
|
||||
<ul>
|
||||
<li><a href="#sec-5-1"></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#sec-6">The <code>.yas-compiled-snippet.el</code> file</a>
|
||||
<ul>
|
||||
<li><a href="#sec-6-1"></a></li>
|
||||
<li><a href="#sec-5-1"><span class="todo TODO">TODO</span> </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#sec-6">The <code>.yas-compiled-snippet.el</code> file</a></li>
|
||||
<li><a href="#sec-7">The <code>.yas-skip</code> file</a>
|
||||
<ul>
|
||||
<li><a href="#sec-7-1"></a></li>
|
||||
<li><a href="#sec-7-1"><span class="todo TODO">TODO</span> </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-1" class="outline-2">
|
||||
<div id="outline-container-sec-1" class="outline-2">
|
||||
<h2 id="sec-1">Basic structure</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
|
||||
|
||||
<p>
|
||||
Snippet collections can be stored in plain text files. They are arranged by
|
||||
sub-directories naming <b>snippet tables</b>. These mostly name Emacs major names.
|
||||
Snippet collections can be stored in plain text files. They are arranged by
|
||||
sub-directories naming <b>snippet tables</b>. These mostly name Emacs major names.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<pre class="example">.
|
||||
<pre class="example">
|
||||
.
|
||||
|-- c-mode
|
||||
| `-- printf
|
||||
|-- java-mode
|
||||
@ -185,81 +198,74 @@ for the JavaScript code in this tag.
|
||||
`-- time
|
||||
</pre>
|
||||
|
||||
|
||||
<p>
|
||||
The collections are loaded into <b>snippet tables</b> which the
|
||||
triggering mechanism (see <a href="snippet-expansion.html">Expanding Snippets</a>) looks up and
|
||||
(hopefully) causes the right snippet to be expanded for you.
|
||||
The collections are loaded into <b>snippet tables</b> which the
|
||||
triggering mechanism (see <a href="snippet-expansion.html">Expanding Snippets</a>) looks up and
|
||||
(hopefully) causes the right snippet to be expanded for you.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-2" class="outline-2">
|
||||
<div id="outline-container-sec-2" class="outline-2">
|
||||
<h2 id="sec-2">Setting up <code>yas-snippet-dirs</code></h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
|
||||
<p>
|
||||
The emacs variable <a href="snippet-reference.html#yas-snippet-dirs"><code>yas-snippet-dirs</code></a> tells YASnippet
|
||||
which collections to consider. It's used when you activate
|
||||
<a href="snippet-reference.html#yas-global-mode"><code>yas-global-mode</code></a> or call
|
||||
<a href="snippet-reference.html#yas-reload-all"><code>yas-reload-all</code></a> interactively.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The emacs variable <a href="snippet-reference.html#yas-snippet-dirs"><code>yas-snippet-dirs</code></a> tells YASnippet
|
||||
which collections to consider. It's used when you activate
|
||||
<a href="snippet-reference.html#yas-global-mode"><code>yas-global-mode</code></a> or call
|
||||
<a href="snippet-reference.html#yas-reload-all"><code>yas-reload-all</code></a> interactively.
|
||||
The default considers:
|
||||
</p>
|
||||
<p>
|
||||
The default considers:
|
||||
</p>
|
||||
<ul>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>a personal collection that lives in <code>~/.emacs.d/snippets</code>
|
||||
</li>
|
||||
<li>the bundled collection, taken as a relative path to <code>yasnippet.el</code> localtion
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>
|
||||
When you come across other snippet collections, do the following to try them
|
||||
out:
|
||||
When you come across other snippet collections, do the following to try them
|
||||
out:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
|
||||
<pre class="example">;; Develop in ~/emacs.d/mysnippets, but also
|
||||
<pre class="src src-emacs-lisp">;; Develop in ~/emacs.d/mysnippets, but also
|
||||
;; try out snippets in ~/Downloads/interesting-snippets
|
||||
(setq yas-snippet-dirs '("~/emacs.d/mysnippets"
|
||||
"~/Downloads/interesting-snippets"))
|
||||
"~/Downloads/interesting-snippets"))
|
||||
|
||||
;; OR, keeping YASnippet defaults try out ~/Downloads/interesting-snippets
|
||||
(setq yas-snippet-dirs (append yas-snippet-dirs
|
||||
'("~/Downloads/interesting-snippets")))
|
||||
'("~/Downloads/interesting-snippets")))
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Collections appearing earlier in the list shadow snippets with same names
|
||||
appearing in collections later in the list. <a href="snippet-reference.html#yas-new-snippet"><code>yas-new-snippet</code></a> always stores
|
||||
snippets in the first collection.
|
||||
Collections appearing earlier in the list override snippets with same names
|
||||
appearing in collections later in the list. <a href="snippet-reference.html#yas-new-snippet"><code>yas-new-snippet</code></a> always stores
|
||||
snippets in the first collection.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-3" class="outline-2">
|
||||
<div id="outline-container-sec-3" class="outline-2">
|
||||
<h2 id="sec-3">The <code>.yas-parents</code> file</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
|
||||
|
||||
<p>
|
||||
It's very useful to have certain modes share snippets between
|
||||
themselves. To do this, choose a mode subdirectory and place a
|
||||
<code>.yas-parents</code> containing a whitespace-separated list of other mode
|
||||
names. When you reload those modes become parents of the original
|
||||
mode.
|
||||
It's very useful to have certain modes share snippets between
|
||||
themselves. To do this, choose a mode subdirectory and place a
|
||||
<code>.yas-parents</code> containing a whitespace-separated list of other mode
|
||||
names. When you reload those modes become parents of the original
|
||||
mode.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<pre class="example">.
|
||||
<pre class="example">
|
||||
.
|
||||
|-- c-mode
|
||||
| |-- .yas-parents # contains "cc-mode text-mode"
|
||||
| `-- printf
|
||||
@ -273,35 +279,33 @@ for the JavaScript code in this tag.
|
||||
|-- email
|
||||
`-- time
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-4" class="outline-2">
|
||||
<div id="outline-container-sec-4" class="outline-2">
|
||||
<h2 id="sec-4"><span class="todo TODO">TODO</span> The <code>.yas-make-groups</code> file</h2>
|
||||
<div class="outline-text-2" id="text-4">
|
||||
|
||||
|
||||
<p>
|
||||
If you place an empty plain text file <code>.yas-make-groups</code> inside one
|
||||
of the mode directories, the names of these sub-directories are
|
||||
considered groups of snippets and <a href="#snippet-menu.org">the menu</a> is organized much more
|
||||
cleanly:
|
||||
</p>
|
||||
<p>
|
||||
<img src="./images/menu-groups.png" alt="./images/menu-groups.png" />
|
||||
</p>
|
||||
<p>
|
||||
Another way to achieve this is to place a <code># group:</code> directive
|
||||
inside the snippet definition. See <a href="./snippet-development.html">Writing Snippets</a>.
|
||||
If you place an empty plain text file <code>.yas-make-groups</code> inside one
|
||||
of the mode directories, the names of these sub-directories are
|
||||
considered groups of snippets and <i>the menu</i> is organized much more
|
||||
cleanly:
|
||||
</p>
|
||||
|
||||
|
||||
<div class="figure">
|
||||
<p><img src="./images/menu-groups.png" alt="menu-groups.png" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<pre class="example">$ tree ruby-mode/
|
||||
<p>
|
||||
Another way to achieve this is to place a <code># group:</code> directive
|
||||
inside the snippet definition. See <a href="./snippet-development.html">Writing Snippets</a>.
|
||||
</p>
|
||||
|
||||
<pre class="example">
|
||||
$ tree ruby-mode/
|
||||
ruby-mode/
|
||||
|-- .yas-make-groups
|
||||
|-- collections
|
||||
@ -316,73 +320,57 @@ ruby-mode/
|
||||
`-- ...
|
||||
</pre>
|
||||
|
||||
|
||||
<p>
|
||||
Yet another way to create a nice snippet menu is to write into
|
||||
<code>.yas-make-groups</code> a menu definition. TODO
|
||||
Yet another way to create a nice snippet menu is to write into
|
||||
<code>.yas-make-groups</code> a menu definition. TODO
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-5" class="outline-2">
|
||||
<div id="outline-container-sec-5" class="outline-2">
|
||||
<h2 id="sec-5"><span class="todo TODO">TODO</span> The <code>.yas-setup.el</code> file</h2>
|
||||
<div class="outline-text-2" id="text-5">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-5-1" class="outline-3">
|
||||
<h3 id="sec-5-1"><span class="todo TODO">TODO</span></h3>
|
||||
<div class="outline-text-3" id="text-5-1">
|
||||
|
||||
|
||||
</div><div id="outline-container-sec-5-1" class="outline-3">
|
||||
<h3 id="sec-5-1"><span class="todo TODO">TODO</span> </h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-6" class="outline-2">
|
||||
<h2 id="sec-6"><span class="todo TODO">TODO</span> The <code>.yas-compiled-snippet.el</code> file</h2>
|
||||
<div id="outline-container-sec-6" class="outline-2">
|
||||
<h2 id="sec-6">The <code>.yas-compiled-snippet.el</code> file</h2>
|
||||
<div class="outline-text-2" id="text-6">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-6-1" class="outline-3">
|
||||
<h3 id="sec-6-1"><span class="todo TODO">TODO</span></h3>
|
||||
<div class="outline-text-3" id="text-6-1">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-7" class="outline-2">
|
||||
<h2 id="sec-7"><span class="todo TODO">TODO</span> The <code>.yas-skip</code> file</h2>
|
||||
<div class="outline-text-2" id="text-7">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outline-container-7-1" class="outline-3">
|
||||
<h3 id="sec-7-1"><span class="todo TODO">TODO</span></h3>
|
||||
<div class="outline-text-3" id="text-7-1">
|
||||
|
||||
</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 2014-10-01T21:16+0100 from 08b044e559cc350c6e7142d088ec2d4a82e378cb
|
||||
<p>
|
||||
You may compile a top-level snippet directory with the
|
||||
<code>yas-compile-directory</code> function, which will create a
|
||||
<code>.yas-compiled-snippets.el</code> file under each mode subdirectory,
|
||||
which contains definitions for all snippets in the subdirectory.
|
||||
Compilation helps improve loading time.
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||
|
||||
<p>
|
||||
Alternatively, you may compile all directories in the list
|
||||
<code>yas-snippet-dirs</code> with the <code>yas-recompile-all</code> function.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-7" class="outline-2">
|
||||
<h2 id="sec-7">The <code>.yas-skip</code> file</h2>
|
||||
<div class="outline-text-2" id="text-7">
|
||||
<p>
|
||||
A <code>.yas-skip</code> file in a mode's snippet subdirectory tells YASnippet
|
||||
not to load snippets from there.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-7-1" class="outline-3">
|
||||
<h3 id="sec-7-1"><span class="todo TODO">TODO</span> </h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.4.91.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10) on from 7703a55ac416a131dec45fa6a1e0ec1e31adf760
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user