mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-02-04 06:32:24 +00:00
Automatic documentation update.
From 0.13.0
This commit is contained in:
@@ -3,21 +3,28 @@
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Writing snippets</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Org-mode" />
|
||||
<meta name="generator" content="Org mode" />
|
||||
<style type="text/css">
|
||||
<!--/*--><![CDATA[/*><!--*/
|
||||
.title { text-align: center; }
|
||||
.title { text-align: center;
|
||||
margin-bottom: .2em; }
|
||||
.subtitle { text-align: center;
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
margin-top:0; }
|
||||
.todo { font-family: monospace; color: red; }
|
||||
.done { color: green; }
|
||||
.done { font-family: monospace; color: green; }
|
||||
.priority { font-family: monospace; color: orange; }
|
||||
.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; }
|
||||
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
|
||||
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
|
||||
.org-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%; }
|
||||
@@ -44,27 +51,111 @@
|
||||
border: 1px solid black;
|
||||
}
|
||||
pre.src:hover:before { display: inline;}
|
||||
pre.src-sh:before { content: 'sh'; }
|
||||
pre.src-bash:before { content: 'sh'; }
|
||||
/* Languages per Org manual */
|
||||
pre.src-asymptote:before { content: 'Asymptote'; }
|
||||
pre.src-awk:before { content: 'Awk'; }
|
||||
pre.src-C:before { content: 'C'; }
|
||||
/* pre.src-C++ doesn't work in CSS */
|
||||
pre.src-clojure:before { content: 'Clojure'; }
|
||||
pre.src-css:before { content: 'CSS'; }
|
||||
pre.src-D:before { content: 'D'; }
|
||||
pre.src-ditaa:before { content: 'ditaa'; }
|
||||
pre.src-dot:before { content: 'Graphviz'; }
|
||||
pre.src-calc:before { content: 'Emacs Calc'; }
|
||||
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'; }
|
||||
pre.src-fortran:before { content: 'Fortran'; }
|
||||
pre.src-gnuplot:before { content: 'gnuplot'; }
|
||||
pre.src-haskell:before { content: 'Haskell'; }
|
||||
pre.src-hledger:before { content: 'hledger'; }
|
||||
pre.src-java:before { content: 'Java'; }
|
||||
pre.src-js:before { content: 'Javascript'; }
|
||||
pre.src-latex:before { content: 'LaTeX'; }
|
||||
pre.src-ledger:before { content: 'Ledger'; }
|
||||
pre.src-lisp:before { content: 'Lisp'; }
|
||||
pre.src-lilypond:before { content: 'Lilypond'; }
|
||||
pre.src-lua:before { content: 'Lua'; }
|
||||
pre.src-matlab:before { content: 'MATLAB'; }
|
||||
pre.src-mscgen:before { content: 'Mscgen'; }
|
||||
pre.src-ocaml:before { content: 'Objective Caml'; }
|
||||
pre.src-octave:before { content: 'Octave'; }
|
||||
pre.src-org:before { content: 'Org mode'; }
|
||||
pre.src-oz:before { content: 'OZ'; }
|
||||
pre.src-plantuml:before { content: 'Plantuml'; }
|
||||
pre.src-processing:before { content: 'Processing.js'; }
|
||||
pre.src-python:before { content: 'Python'; }
|
||||
pre.src-R:before { content: 'R'; }
|
||||
pre.src-ruby:before { content: 'Ruby'; }
|
||||
pre.src-sass:before { content: 'Sass'; }
|
||||
pre.src-scheme:before { content: 'Scheme'; }
|
||||
pre.src-screen:before { content: 'Gnu Screen'; }
|
||||
pre.src-sed:before { content: 'Sed'; }
|
||||
pre.src-sh:before { content: 'shell'; }
|
||||
pre.src-sql:before { content: 'SQL'; }
|
||||
pre.src-sqlite:before { content: 'SQLite'; }
|
||||
/* additional languages in org.el's org-babel-load-languages alist */
|
||||
pre.src-forth:before { content: 'Forth'; }
|
||||
pre.src-io:before { content: 'IO'; }
|
||||
pre.src-J:before { content: 'J'; }
|
||||
pre.src-makefile:before { content: 'Makefile'; }
|
||||
pre.src-maxima:before { content: 'Maxima'; }
|
||||
pre.src-perl:before { content: 'Perl'; }
|
||||
pre.src-picolisp:before { content: 'Pico Lisp'; }
|
||||
pre.src-scala:before { content: 'Scala'; }
|
||||
pre.src-shell:before { content: 'Shell Script'; }
|
||||
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
|
||||
/* additional language identifiers per "defun org-babel-execute"
|
||||
in ob-*.el */
|
||||
pre.src-cpp:before { content: 'C++'; }
|
||||
pre.src-abc:before { content: 'ABC'; }
|
||||
pre.src-coq:before { content: 'Coq'; }
|
||||
pre.src-groovy:before { content: 'Groovy'; }
|
||||
/* additional language identifiers from org-babel-shell-names in
|
||||
ob-shell.el: ob-shell is the only babel language using a lambda to put
|
||||
the execution function name together. */
|
||||
pre.src-bash:before { content: 'bash'; }
|
||||
pre.src-csh:before { content: 'csh'; }
|
||||
pre.src-ash:before { content: 'ash'; }
|
||||
pre.src-dash:before { content: 'dash'; }
|
||||
pre.src-ksh:before { content: 'ksh'; }
|
||||
pre.src-mksh:before { content: 'mksh'; }
|
||||
pre.src-posh:before { content: 'posh'; }
|
||||
/* Additional Emacs modes also supported by the LaTeX listings package */
|
||||
pre.src-ada:before { content: 'Ada'; }
|
||||
pre.src-asm:before { content: 'Assembler'; }
|
||||
pre.src-caml:before { content: 'Caml'; }
|
||||
pre.src-delphi:before { content: 'Delphi'; }
|
||||
pre.src-html:before { content: 'HTML'; }
|
||||
pre.src-idl:before { content: 'IDL'; }
|
||||
pre.src-mercury:before { content: 'Mercury'; }
|
||||
pre.src-metapost:before { content: 'MetaPost'; }
|
||||
pre.src-modula-2:before { content: 'Modula-2'; }
|
||||
pre.src-pascal:before { content: 'Pascal'; }
|
||||
pre.src-ps:before { content: 'PostScript'; }
|
||||
pre.src-prolog:before { content: 'Prolog'; }
|
||||
pre.src-simula:before { content: 'Simula'; }
|
||||
pre.src-tcl:before { content: 'tcl'; }
|
||||
pre.src-tex:before { content: 'TeX'; }
|
||||
pre.src-plain-tex:before { content: 'Plain TeX'; }
|
||||
pre.src-verilog:before { content: 'Verilog'; }
|
||||
pre.src-vhdl:before { content: 'VHDL'; }
|
||||
pre.src-xml:before { content: 'XML'; }
|
||||
pre.src-nxml:before { content: 'XML'; }
|
||||
/* add a generic configuration mode; LaTeX export needs an additional
|
||||
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
|
||||
pre.src-conf:before { content: 'Configuration File'; }
|
||||
|
||||
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; }
|
||||
th.org-right { text-align: center; }
|
||||
th.org-left { text-align: center; }
|
||||
th.org-center { text-align: center; }
|
||||
td.org-right { text-align: right; }
|
||||
td.org-left { text-align: left; }
|
||||
td.org-center { text-align: center; }
|
||||
dt { font-weight: bold; }
|
||||
.footpara:nth-child(2) { display: inline; }
|
||||
.footpara { display: block; }
|
||||
.footpara { display: inline; }
|
||||
.footdef { margin-bottom: 1em; }
|
||||
.figure { padding: 1em; }
|
||||
.figure p { text-align: center; }
|
||||
@@ -84,6 +175,7 @@
|
||||
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
||||
.org-info-js_search-highlight
|
||||
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
||||
.org-svg { width: 90%; }
|
||||
/*]]>*/-->
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||
@@ -92,7 +184,7 @@
|
||||
@licstart The following is the entire license notice for the
|
||||
JavaScript code in this tag.
|
||||
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
|
||||
The JavaScript code in this tag is free software: you can
|
||||
redistribute it and/or modify it under the terms of the GNU
|
||||
@@ -141,11 +233,11 @@ for the JavaScript code in this tag.
|
||||
<li> <a href="index.html">Overview</a>
|
||||
<li> <a href="https://github.com/joaotavora/yasnippet/blob/master/README.mdown">
|
||||
Intro and Tutorial</a>
|
||||
<li class="center">Snippet
|
||||
<ul>
|
||||
<li class="center border">Snippet
|
||||
<ul class="nopad">
|
||||
<li> <a href="snippet-organization.html">Organization</a>
|
||||
<li> <a href="snippet-expansion.html">Expansion</a>
|
||||
<li> <a href="snippet-development.html">Development</a>
|
||||
<li> <span class='current'>Development</span>
|
||||
<li> <a href="snippet-menu.html">Menu</a>
|
||||
</ul>
|
||||
<li> <a href="faq.html">FAQ</a>
|
||||
@@ -159,87 +251,90 @@ for the JavaScript code in this tag.
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#sec-1">Snippet development</a>
|
||||
<li><a href="#org6796ab7">Snippet development</a>
|
||||
<ul>
|
||||
<li><a href="#sec-1-1">Quickly finding snippets</a></li>
|
||||
<li><a href="#sec-1-2">Using the <code>snippet-mode</code> major mode </a></li>
|
||||
<li><a href="#orgd2c5216">Quickly finding snippets</a></li>
|
||||
<li><a href="#org4406e2d">Using the <code>snippet-mode</code> major mode </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#sec-2">File content</a>
|
||||
<li><a href="#org5e87ae3">File content</a>
|
||||
<ul>
|
||||
<li><a href="#sec-2-1"><code># key:</code> snippet abbrev</a></li>
|
||||
<li><a href="#sec-2-2"><code># name:</code> snippet name</a></li>
|
||||
<li><a href="#sec-2-3"><code># condition:</code> snippet condition</a></li>
|
||||
<li><a href="#sec-2-4"><code># group:</code> snippet menu grouping</a></li>
|
||||
<li><a href="#sec-2-5"><code># expand-env:</code> expand environment</a></li>
|
||||
<li><a href="#sec-2-6"><code># binding:</code> direct keybinding</a></li>
|
||||
<li><a href="#sec-2-7"><code># type:</code> <code>snippet</code> or <code>command</code></a></li>
|
||||
<li><a href="#sec-2-8"><code># uuid:</code> unique identifier</a></li>
|
||||
<li><a href="#sec-2-9"><code># contributor:</code> snippet author</a></li>
|
||||
<li><a href="#org9b062b6"><code># key:</code> snippet abbrev</a></li>
|
||||
<li><a href="#org592456a"><code># name:</code> snippet name</a></li>
|
||||
<li><a href="#org185b594"><code># condition:</code> snippet condition</a></li>
|
||||
<li><a href="#orgd710184"><code># group:</code> snippet menu grouping</a></li>
|
||||
<li><a href="#orga37203f"><code># expand-env:</code> expand environment</a></li>
|
||||
<li><a href="#org67f4e69"><code># binding:</code> direct keybinding</a></li>
|
||||
<li><a href="#org24f6fba"><code># type:</code> <code>snippet</code> or <code>command</code></a></li>
|
||||
<li><a href="#orgd0516f9"><code># uuid:</code> unique identifier</a></li>
|
||||
<li><a href="#orge2b38b9"><code># contributor:</code> snippet author</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#sec-3">Template Syntax</a>
|
||||
<li><a href="#org9801aa7">Template Syntax</a>
|
||||
<ul>
|
||||
<li><a href="#sec-3-1">Plain Text</a></li>
|
||||
<li><a href="#sec-3-2">Embedded Emacs-lisp code</a>
|
||||
<li><a href="#org0e7ccf8">Plain Text</a></li>
|
||||
<li><a href="#orgcde188c">Embedded Emacs-lisp code</a>
|
||||
<ul>
|
||||
<li><a href="#sec-3-2-1">Note: backquote expressions should not modify the buffer</a></li>
|
||||
<li><a href="#org9804f4c">Note: backquote expressions should not modify the buffer</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#sec-3-3">Tab stop fields</a></li>
|
||||
<li><a href="#sec-3-4">Placeholder fields</a></li>
|
||||
<li><a href="#sec-3-5">Mirrors </a></li>
|
||||
<li><a href="#sec-3-6">Mirrors with transformations </a></li>
|
||||
<li><a href="#sec-3-7">Fields with transformations</a></li>
|
||||
<li><a href="#sec-3-8">Choosing fields value from a list and other tricks</a></li>
|
||||
<li><a href="#sec-3-9">Nested placeholder fields</a></li>
|
||||
<li><a href="#sec-3-10">Indentation markers</a></li>
|
||||
<li><a href="#org41a4ac7">Tab stop fields</a></li>
|
||||
<li><a href="#org844d0b2">Placeholder fields</a></li>
|
||||
<li><a href="#org087775c">Mirrors </a></li>
|
||||
<li><a href="#orge2c1f71">Mirrors with transformations </a></li>
|
||||
<li><a href="#org4efa067">Fields with transformations</a></li>
|
||||
<li><a href="#org73e1209">Choosing fields value from a list and other tricks</a></li>
|
||||
<li><a href="#orgca40be6">Nested placeholder fields</a></li>
|
||||
<li><a href="#org92b7360">Indentation markers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1" class="outline-2">
|
||||
<h2 id="sec-1">Snippet development</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
</div><div id="outline-container-sec-1-1" class="outline-3">
|
||||
<h3 id="sec-1-1">Quickly finding snippets</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
<div id="outline-container-org6796ab7" class="outline-2">
|
||||
<h2 id="org6796ab7">Snippet development</h2>
|
||||
<div class="outline-text-2" id="text-org6796ab7">
|
||||
</div>
|
||||
<div id="outline-container-orgd2c5216" class="outline-3">
|
||||
<h3 id="orgd2c5216">Quickly finding snippets</h3>
|
||||
<div class="outline-text-3" id="text-orgd2c5216">
|
||||
<p>
|
||||
There are some ways you can quickly find a snippet file or create a new one:
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li><code>M-x yas-new-snippet</code>, key bindind: <code>C-c & C-n</code>
|
||||
<li><p>
|
||||
<code>M-x yas-new-snippet</code>, key bindind: <code>C-c & C-n</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Creates a new buffer with a template for making a new snippet. The
|
||||
buffer is in <code>snippet-mode</code> (see <a href="#snippet-mode">below</a>). When you are done editing
|
||||
the new snippet, use <a href="#yas-load-snippet-buffer-and-close"><code>C-c C-c</code></a> to save it.
|
||||
</p>
|
||||
</li>
|
||||
buffer is in <code>snippet-mode</code> (see <a href="#orgb9ac10d">below</a>). When you are done editing
|
||||
the new snippet, use <a href="#org7f07002"><code>C-c C-c</code></a> to save it.
|
||||
</p></li>
|
||||
|
||||
<li><code>M-x yas-visit-snippet-file</code>, key binding: <code>C-c & C-v</code>
|
||||
<li><p>
|
||||
<code>M-x yas-visit-snippet-file</code>, key binding: <code>C-c & C-v</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Prompts you for possible snippet expansions like
|
||||
<a href="snippet-reference.html#yas-insert-snippet"><code>yas-insert-snippet</code></a>, but instead of expanding it, takes you directly
|
||||
to the snippet definition's file, if it exists.
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Once you find this file it will be set to <code>snippet-mode</code> (see <a href="#snippet-mode">ahead</a>)
|
||||
Once you find this file it will be set to <code>snippet-mode</code> (see <a href="#orgb9ac10d">ahead</a>)
|
||||
and you can start editing your snippet.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-1-2" class="outline-3">
|
||||
<h3 id="sec-1-2">Using the <code>snippet-mode</code> major mode <a id="snippet-mode" name="snippet-mode"></a></h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<div id="outline-container-org4406e2d" class="outline-3">
|
||||
<h3 id="org4406e2d">Using the <code>snippet-mode</code> major mode <a id="orgb9ac10d"></a></h3>
|
||||
<div class="outline-text-3" id="text-org4406e2d">
|
||||
<p>
|
||||
There is a major mode <code>snippet-mode</code> to edit snippets. You can set the
|
||||
buffer to this mode with <code>M-x snippet-mode</code>. It provides reasonably
|
||||
@@ -251,16 +346,19 @@ Three commands are defined in this mode:
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li><code>M-x yas-load-snippet-buffer</code>, key binding: <code>C-c C-l</code>
|
||||
<li><p>
|
||||
<code>M-x yas-load-snippet-buffer</code>, key binding: <code>C-c C-l</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Prompts for a snippet table (with a default based on snippet's
|
||||
major mode) and loads the snippet currently being edited.
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
|
||||
<li><code>M-x yas-load-snippet-buffer-and-close</code>, key binding: <code>C-c C-c</code>
|
||||
<a id="yas-load-snippet-buffer-and-close" name="yas-load-snippet-buffer-and-close"></a>
|
||||
<li><p>
|
||||
<code>M-x yas-load-snippet-buffer-and-close</code>, key binding: <code>C-c C-c</code>
|
||||
<a id="org7f07002"></a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Like <code>yas-load-snippet-buffer</code>, but also saves the snippet and
|
||||
@@ -268,17 +366,17 @@ calls <code>quit-window</code>. The destination is decided based on the
|
||||
chosen snippet table and snippet collection directly (defaulting to
|
||||
the first directory in <code>yas-snippet-dirs</code> (see <a href="snippet-organization.html">Organizing Snippets</a>
|
||||
for more detail on how snippets are organized).
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
|
||||
<li><code>M-x yas-tryout-snippet</code>, key binding: <code>C-c C-t</code>
|
||||
<li><p>
|
||||
<code>M-x yas-tryout-snippet</code>, key binding: <code>C-c C-t</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When editing a snippet, this opens a new empty buffer, sets it to
|
||||
the appropriate major mode and inserts the snippet there, so you
|
||||
can see what it looks like.
|
||||
</p>
|
||||
</li>
|
||||
</p></li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
@@ -289,9 +387,9 @@ There are also <i>snippets for writing snippets</i>: <code>vars</code>, <code>$f
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2" class="outline-2">
|
||||
<h2 id="sec-2">File content</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<div id="outline-container-org5e87ae3" class="outline-2">
|
||||
<h2 id="org5e87ae3">File content</h2>
|
||||
<div class="outline-text-2" id="text-org5e87ae3">
|
||||
<p>
|
||||
A file defining a snippet generally contains the template to be
|
||||
expanded.
|
||||
@@ -310,7 +408,6 @@ Here's a typical example:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet"><span class="org-comment"># contributor: pluskid <a href="mailto:pluskid%40gmail.com"><pluskid@gmail.com></a></span>
|
||||
<span class="org-comment"># name: __...__</span>
|
||||
<span class="org-comment"># --</span>
|
||||
@@ -323,21 +420,21 @@ Here's a list of currently supported directives:
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-1" class="outline-3">
|
||||
<h3 id="sec-2-1"><code># key:</code> snippet abbrev</h3>
|
||||
<div class="outline-text-3" id="text-2-1">
|
||||
<div id="outline-container-org9b062b6" class="outline-3">
|
||||
<h3 id="org9b062b6"><code># key:</code> snippet abbrev</h3>
|
||||
<div class="outline-text-3" id="text-org9b062b6">
|
||||
<p>
|
||||
This is the probably the most important directive, it's the
|
||||
abbreviation you type to expand a snippet just before hitting the key
|
||||
that runs <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a>. If you don't specify this
|
||||
that runs <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a>. If you don't specify this,
|
||||
the snippet will not be expandable through the trigger mechanism.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-2" class="outline-3">
|
||||
<h3 id="sec-2-2"><code># name:</code> snippet name</h3>
|
||||
<div class="outline-text-3" id="text-2-2">
|
||||
<div id="outline-container-org592456a" class="outline-3">
|
||||
<h3 id="org592456a"><code># name:</code> snippet name</h3>
|
||||
<div class="outline-text-3" id="text-org592456a">
|
||||
<p>
|
||||
This is a one-line description of the snippet. It will be displayed in
|
||||
the menu. It's a good idea to select a descriptive name for a snippet –
|
||||
@@ -345,15 +442,15 @@ especially distinguishable among similar snippets.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you omit this name it will default to the file name the snippet was
|
||||
loaded from.
|
||||
If you omit this name, it will default to the file name the snippet
|
||||
was loaded from.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-3" class="outline-3">
|
||||
<h3 id="sec-2-3"><code># condition:</code> snippet condition</h3>
|
||||
<div class="outline-text-3" id="text-2-3">
|
||||
<div id="outline-container-org185b594" class="outline-3">
|
||||
<h3 id="org185b594"><code># condition:</code> snippet condition</h3>
|
||||
<div class="outline-text-3" id="text-org185b594">
|
||||
<p>
|
||||
This is a piece of Emacs-lisp code. If a snippet has a condition, then
|
||||
it will only be expanded when the condition code evaluate to some
|
||||
@@ -367,9 +464,9 @@ See also <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-b
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-4" class="outline-3">
|
||||
<h3 id="sec-2-4"><code># group:</code> snippet menu grouping</h3>
|
||||
<div class="outline-text-3" id="text-2-4">
|
||||
<div id="outline-container-orgd710184" class="outline-3">
|
||||
<h3 id="orgd710184"><code># group:</code> snippet menu grouping</h3>
|
||||
<div class="outline-text-3" id="text-orgd710184">
|
||||
<p>
|
||||
When expanding/visiting snippets from the menu-bar menu, snippets for a
|
||||
given mode can be grouped into sub-menus . This is useful if one has too
|
||||
@@ -393,9 +490,9 @@ group which is under the <code>control structure</code> group.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-5" class="outline-3">
|
||||
<h3 id="sec-2-5"><code># expand-env:</code> expand environment</h3>
|
||||
<div class="outline-text-3" id="text-2-5">
|
||||
<div id="outline-container-orga37203f" class="outline-3">
|
||||
<h3 id="orga37203f"><code># expand-env:</code> expand environment</h3>
|
||||
<div class="outline-text-3" id="text-orga37203f">
|
||||
<p>
|
||||
This is another piece of Emacs-lisp code in the form of a <code>let</code> <i>varlist
|
||||
form</i>, i.e. a list of lists assigning values to variables. It can be
|
||||
@@ -415,7 +512,6 @@ You can then use:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet"><span class="org-comment"># name: ASCII home</span>
|
||||
<span class="org-comment"># expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))</span>
|
||||
<span class="org-comment"># --</span>
|
||||
@@ -434,9 +530,9 @@ You can then use:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-6" class="outline-3">
|
||||
<h3 id="sec-2-6"><code># binding:</code> direct keybinding</h3>
|
||||
<div class="outline-text-3" id="text-2-6">
|
||||
<div id="outline-container-org67f4e69" class="outline-3">
|
||||
<h3 id="org67f4e69"><code># binding:</code> direct keybinding</h3>
|
||||
<div class="outline-text-3" id="text-org67f4e69">
|
||||
<p>
|
||||
You can use this directive to expand a snippet directly from a normal
|
||||
Emacs keybinding. The keybinding will be registered in the Emacs keymap
|
||||
@@ -450,11 +546,10 @@ same snippet, for example in this "html-mode" snippet.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet"><span class="org-comment"># name: <p>...</p></span>
|
||||
<span class="org-comment"># binding: C-c C-c C-m</span>
|
||||
<span class="org-comment"># --</span>
|
||||
<p>`(<span class="org-keyword">when</span> yas-prefix "\n")`<span class="org-keyword">$</span><span class="org-string">0</span>`(<span class="org-keyword">when</span> yas-prefix "\n")`</p>
|
||||
<p>`(<span class="org-keyword">when</span> yas-prefix <span class="org-string">"\n"</span>)`<span class="org-keyword">$</span><span class="org-string">0</span>`(<span class="org-keyword">when</span> yas-prefix <span class="org-string">"\n"</span>)`</p>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -466,9 +561,9 @@ will expand the paragraph tag without newlines.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-7" class="outline-3">
|
||||
<h3 id="sec-2-7"><code># type:</code> <code>snippet</code> or <code>command</code></h3>
|
||||
<div class="outline-text-3" id="text-2-7">
|
||||
<div id="outline-container-org24f6fba" class="outline-3">
|
||||
<h3 id="org24f6fba"><code># type:</code> <code>snippet</code> or <code>command</code></h3>
|
||||
<div class="outline-text-3" id="text-org24f6fba">
|
||||
<p>
|
||||
If the <code>type</code> directive is set to <code>command</code>, the body of the snippet
|
||||
is interpreted as lisp code to be evaluated when the snippet is
|
||||
@@ -477,15 +572,15 @@ triggered.
|
||||
|
||||
<p>
|
||||
If it's <code>snippet</code> (the default when there is no <code>type</code> directive), the
|
||||
snippet body will be parsed according to the <a href="#sec-3">Template Syntax</a>,
|
||||
snippet body will be parsed according to the <a href="#org9801aa7">Template Syntax</a>,
|
||||
described below.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-8" class="outline-3">
|
||||
<h3 id="sec-2-8"><code># uuid:</code> unique identifier</h3>
|
||||
<div class="outline-text-3" id="text-2-8">
|
||||
<div id="outline-container-orgd0516f9" class="outline-3">
|
||||
<h3 id="orgd0516f9"><code># uuid:</code> unique identifier</h3>
|
||||
<div class="outline-text-3" id="text-orgd0516f9">
|
||||
<p>
|
||||
This provides to a way to identify a snippet, independent of its name.
|
||||
Loading a second snippet file with the same uuid would replace the
|
||||
@@ -494,9 +589,9 @@ previous snippet.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-2-9" class="outline-3">
|
||||
<h3 id="sec-2-9"><code># contributor:</code> snippet author</h3>
|
||||
<div class="outline-text-3" id="text-2-9">
|
||||
<div id="outline-container-orge2b38b9" class="outline-3">
|
||||
<h3 id="orge2b38b9"><code># contributor:</code> snippet author</h3>
|
||||
<div class="outline-text-3" id="text-orge2b38b9">
|
||||
<p>
|
||||
This is optional and has no effect whatsoever on snippet functionality,
|
||||
but it looks nice.
|
||||
@@ -505,18 +600,18 @@ but it looks nice.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3" class="outline-2">
|
||||
<h2 id="sec-3">Template Syntax</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
<div id="outline-container-org9801aa7" class="outline-2">
|
||||
<h2 id="org9801aa7">Template Syntax</h2>
|
||||
<div class="outline-text-2" id="text-org9801aa7">
|
||||
<p>
|
||||
The syntax of the snippet template is simple but powerful, very similar
|
||||
to TextMate's.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-1" class="outline-3">
|
||||
<h3 id="sec-3-1">Plain Text</h3>
|
||||
<div class="outline-text-3" id="text-3-1">
|
||||
<div id="outline-container-org0e7ccf8" class="outline-3">
|
||||
<h3 id="org0e7ccf8">Plain Text</h3>
|
||||
<div class="outline-text-3" id="text-org0e7ccf8">
|
||||
<p>
|
||||
Arbitrary text can be included as the content of a template. They are
|
||||
usually interpreted as plain text, except <code>$</code> and <code>`</code>. You need to
|
||||
@@ -526,9 +621,9 @@ escaped as <code>\\</code> sometimes.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-2" class="outline-3">
|
||||
<h3 id="sec-3-2">Embedded Emacs-lisp code</h3>
|
||||
<div class="outline-text-3" id="text-3-2">
|
||||
<div id="outline-container-orgcde188c" class="outline-3">
|
||||
<h3 id="orgcde188c">Embedded Emacs-lisp code</h3>
|
||||
<div class="outline-text-3" id="text-orgcde188c">
|
||||
<p>
|
||||
Emacs-Lisp code can be embedded inside the template, written inside
|
||||
back-quotes (<code>`</code>). The lisp forms are evaluated when the snippet is
|
||||
@@ -542,7 +637,6 @@ dynamically:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet"><span class="org-comment">#ifndef ${</span><span class="org-warning">1</span><span class="org-comment">:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_}</span>
|
||||
<span class="org-comment">#define $</span><span class="org-string">1</span>
|
||||
|
||||
@@ -559,7 +653,6 @@ therefore define a snippet like:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet">for (<span class="org-keyword">$</span><span class="org-string">1</span>;<span class="org-keyword">$</span><span class="org-string">2</span>;<span class="org-keyword">$</span><span class="org-string">3</span>) {
|
||||
`yas-selected-text`<span class="org-keyword">$</span><span class="org-string">0</span>
|
||||
<span class="org-keyword">}</span>
|
||||
@@ -573,9 +666,9 @@ Alternatively, you can also customize the variable
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-2-1" class="outline-4">
|
||||
<h4 id="sec-3-2-1">Note: backquote expressions should not modify the buffer</h4>
|
||||
<div class="outline-text-4" id="text-3-2-1">
|
||||
<div id="outline-container-org9804f4c" class="outline-4">
|
||||
<h4 id="org9804f4c">Note: backquote expressions should not modify the buffer</h4>
|
||||
<div class="outline-text-4" id="text-org9804f4c">
|
||||
<p>
|
||||
Please note that the lisp forms in backquotes should <b>not</b> modify the
|
||||
buffer, doing so will trigger a warning. For example, instead of
|
||||
@@ -583,7 +676,6 @@ doing
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet">Timestamp: `(insert (current-time-string))`
|
||||
</pre>
|
||||
</div>
|
||||
@@ -592,7 +684,6 @@ doing
|
||||
do this:
|
||||
</p>
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet">Timestamp: `(current-time-string)`
|
||||
</pre>
|
||||
</div>
|
||||
@@ -601,7 +692,6 @@ do this:
|
||||
The warning may be suppressed with the following code in your init file:
|
||||
</p>
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp">(add-to-list 'warning-suppress-types '(yasnippet backquote-change))
|
||||
</pre>
|
||||
</div>
|
||||
@@ -610,9 +700,9 @@ The warning may be suppressed with the following code in your init file:
|
||||
</div>
|
||||
|
||||
|
||||
<div id="outline-container-sec-3-3" class="outline-3">
|
||||
<h3 id="sec-3-3">Tab stop fields</h3>
|
||||
<div class="outline-text-3" id="text-3-3">
|
||||
<div id="outline-container-org41a4ac7" class="outline-3">
|
||||
<h3 id="org41a4ac7">Tab stop fields</h3>
|
||||
<div class="outline-text-3" id="text-org41a4ac7">
|
||||
<p>
|
||||
Tab stops are fields that you can navigate back and forth by <code>TAB</code> and
|
||||
<code>S-TAB</code>. They are written by <code>$</code> followed with a number. <code>$0</code> has the
|
||||
@@ -621,7 +711,6 @@ to go when you've traveled all the fields. Here's a typical example:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet"><div<span class="org-keyword">$</span><span class="org-string">1</span>>
|
||||
<span class="org-keyword">$</span><span class="org-string">0</span>
|
||||
</div>
|
||||
@@ -629,40 +718,38 @@ to go when you've traveled all the fields. Here's a typical example:
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-sec-3-4" class="outline-3">
|
||||
<h3 id="sec-3-4">Placeholder fields</h3>
|
||||
<div class="outline-text-3" id="text-3-4">
|
||||
<div id="outline-container-org844d0b2" class="outline-3">
|
||||
<h3 id="org844d0b2">Placeholder fields</h3>
|
||||
<div class="outline-text-3" id="text-org844d0b2">
|
||||
<p>
|
||||
Tab stops can have default values – a.k.a placeholders. The syntax is
|
||||
like this:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet">${N:default value<span class="org-keyword">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
They acts as the default value for a tab stop. But when you firstly
|
||||
They act as the default value for a tab stop. But when you first
|
||||
type at a tab stop, the default value will be replaced by your typing.
|
||||
The number can be omitted if you don't want to create <a href="#mirrors-fields">mirrors</a> or
|
||||
<a href="#mirror-transformations">transformations</a> for this field.
|
||||
The number can be omitted if you don't want to create <a href="#orge0a8493">mirrors</a> or
|
||||
<a href="#org6c77fba">transformations</a> for this field.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-5" class="outline-3">
|
||||
<h3 id="sec-3-5">Mirrors <a id="mirrors-fields" name="mirrors-fields"></a></h3>
|
||||
<div class="outline-text-3" id="text-3-5">
|
||||
<div id="outline-container-org087775c" class="outline-3">
|
||||
<h3 id="org087775c">Mirrors <a id="orge0a8493"></a></h3>
|
||||
<div class="outline-text-3" id="text-org087775c">
|
||||
<p>
|
||||
We refer the tab stops with placeholders as a <i>field</i>. A field can have
|
||||
mirrors. Its mirrors will get updated when you change the text of a
|
||||
field. Here's an example:
|
||||
We refer the tab stops with placeholders as a <i>field</i>. A field can
|
||||
have mirrors. <b>All</b> mirrors get updated whenever you update any field
|
||||
text. Here's an example:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet">\begin{<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span>enumerate<span class="org-keyword">}}</span>
|
||||
<span class="org-keyword">$</span><span class="org-string">0</span>
|
||||
\end{<span class="org-keyword">$</span><span class="org-string">1</span><span class="org-keyword">}</span>
|
||||
@@ -683,9 +770,9 @@ the field and others mirrors.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-6" class="outline-3">
|
||||
<h3 id="sec-3-6">Mirrors with transformations <a id="mirror-transformations" name="mirror-transformations"></a></h3>
|
||||
<div class="outline-text-3" id="text-3-6">
|
||||
<div id="outline-container-orge2c1f71" class="outline-3">
|
||||
<h3 id="orge2c1f71">Mirrors with transformations <a id="org6c77fba"></a></h3>
|
||||
<div class="outline-text-3" id="text-orge2c1f71">
|
||||
<p>
|
||||
If the value of an <code>${n:</code>-construct starts with and contains <code>$(</code>,
|
||||
then it is interpreted as a mirror for field <code>n</code> with a
|
||||
@@ -697,7 +784,6 @@ Objective-C:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet">- (<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span>id<span class="org-keyword">}</span>)<span class="org-keyword">${</span><span class="org-warning">2</span><span class="org-keyword">:</span>foo<span class="org-keyword">}</span>
|
||||
{
|
||||
return <span class="org-keyword">$</span><span class="org-string">2</span>;
|
||||
@@ -729,7 +815,6 @@ should be at least as long as the text. So
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-rst"><span class="org-rst-adornment">=====</span>
|
||||
<span class="org-rst-level-1">Title</span>
|
||||
<span class="org-rst-adornment">=====</span>
|
||||
@@ -741,7 +826,6 @@ is a valid title but
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-rst"><span class="org-rst-adornment">===</span>
|
||||
<span class="org-rst-level-1">Title</span>
|
||||
<span class="org-rst-adornment">===</span>
|
||||
@@ -753,7 +837,6 @@ is not. Here's an snippet for rst title:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet"><span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span><span class="org-preprocessor">$(</span>make-string (string-width yas-text) ?\=)<span class="org-keyword">}</span>
|
||||
<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span>Title<span class="org-keyword">}</span>
|
||||
<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span><span class="org-preprocessor">$(</span>make-string (string-width yas-text) ?\=)<span class="org-keyword">}</span>
|
||||
@@ -761,17 +844,36 @@ is not. Here's an snippet for rst title:
|
||||
<span class="org-keyword">$</span><span class="org-string">0</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Note that a mirror with a transform is not restricted to the text of
|
||||
the field it is mirroring. By making use of <a href="snippet-reference.html#yas-field-value"><code>yas-field-value</code></a>, a
|
||||
mirror can look at any of the snippet's field (as mentioned above, all
|
||||
mirrors are updated when any field is updated). Here is an example
|
||||
which shows a "live" result of calling format:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-snippet">(format <span class="org-string">"${</span><span class="org-warning">1</span><span class="org-string">:formatted %s}"</span> <span class="org-string">"${</span><span class="org-warning">2</span><span class="org-string">:value}"</span>)
|
||||
=> <span class="org-string">"${</span><span class="org-warning">1</span><span class="org-string">:$(ignore-errors (format (yas-field-value 1) (yas-field-value 2)))}"</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
To keep the example simple, it uses <code>ignore-errors</code> to suppress errors
|
||||
due to incomplete format codes.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-7" class="outline-3">
|
||||
<h3 id="sec-3-7">Fields with transformations</h3>
|
||||
<div class="outline-text-3" id="text-3-7">
|
||||
<div id="outline-container-org4efa067" class="outline-3">
|
||||
<h3 id="org4efa067">Fields with transformations</h3>
|
||||
<div class="outline-text-3" id="text-org4efa067">
|
||||
<p>
|
||||
From version 0.6 on, you can also have lisp transformation inside
|
||||
fields. These work mostly mirror transformations but are evaluated when
|
||||
you first enter the field, after each change you make to the field and
|
||||
also just before you exit the field.
|
||||
fields. These work mostly like mirror transformations. However, they
|
||||
are evaluated when you first enter the field, after each change you
|
||||
make to the field and also just before you exit the field.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -781,6 +883,7 @@ distinguish between fields and mirrors. In the following example
|
||||
|
||||
<pre class="example">
|
||||
#define "${1:mydefine$(upcase yas-text)}"
|
||||
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
@@ -798,6 +901,7 @@ transformation's <code>$</code>. If you don't want this extra-text, you can use
|
||||
|
||||
<pre class="example">
|
||||
#define "${1:$$(upcase yas-text)}"
|
||||
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
@@ -809,9 +913,9 @@ does not take place. This is by design.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-8" class="outline-3">
|
||||
<h3 id="sec-3-8">Choosing fields value from a list and other tricks</h3>
|
||||
<div class="outline-text-3" id="text-3-8">
|
||||
<div id="outline-container-org73e1209" class="outline-3">
|
||||
<h3 id="org73e1209">Choosing fields value from a list and other tricks</h3>
|
||||
<div class="outline-text-3" id="text-org73e1209">
|
||||
<p>
|
||||
As mentioned, the field transformation is invoked just after you enter
|
||||
the field, and with some useful variables bound, notably
|
||||
@@ -825,8 +929,7 @@ The <a href="snippet-reference.html#yas-choose-value"><code>yas-choose-value</co
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet"><div align="<span class="org-keyword">${</span><span class="org-warning">2</span><span class="org-keyword">:</span>$<span class="org-preprocessor">$(</span>yas-choose-value '("right" "center" "left"))<span class="org-keyword">}</span>">
|
||||
<pre class="src src-snippet"><div align=<span class="org-string">"${</span><span class="org-warning">2</span><span class="org-string">:$$(yas-choose-value '("</span>right<span class="org-string">" "</span>center<span class="org-string">" "</span>left<span class="org-string">"))}"</span>>
|
||||
<span class="org-keyword">$</span><span class="org-string">0</span>
|
||||
</div>
|
||||
</pre>
|
||||
@@ -843,10 +946,9 @@ enter snippet field 2. This one makes use of <a href="snippet-reference.html#yas
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet">\section{<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span>"Titel der Tour"<span class="org-keyword">}}</span>%
|
||||
<pre class="src src-snippet">\section{<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span><span class="org-string">"Titel der Tour"</span><span class="org-keyword">}}</span>%
|
||||
\index{<span class="org-keyword">$</span><span class="org-string">1</span><span class="org-keyword">}</span>%
|
||||
\label{{2:"waiting for reftex-label call..."<span class="org-preprocessor">$(</span><span class="org-keyword">unless</span> yas-modified-p (reftex-label nil 'dont-
|
||||
\label{{2:<span class="org-string">"waiting for reftex-label call..."</span><span class="org-preprocessor">$(</span><span class="org-keyword">unless</span> yas-modified-p (reftex-label nil 'dont-
|
||||
insert))<span class="org-keyword">}}</span>%
|
||||
</pre>
|
||||
</div>
|
||||
@@ -858,22 +960,21 @@ of <a href="snippet-reference.html#yas-moving-away-p"><code>yas-moving-away-p</c
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-9" class="outline-3">
|
||||
<h3 id="sec-3-9">Nested placeholder fields</h3>
|
||||
<div class="outline-text-3" id="text-3-9">
|
||||
<div id="outline-container-orgca40be6" class="outline-3">
|
||||
<h3 id="orgca40be6">Nested placeholder fields</h3>
|
||||
<div class="outline-text-3" id="text-orgca40be6">
|
||||
<p>
|
||||
From version 0.6 on, you can also have nested placeholders of the type:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-snippet"><div<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span> id="<span class="org-keyword">${</span><span class="org-warning">2</span><span class="org-keyword">:</span>some_id<span class="org-keyword">}</span>"<span class="org-keyword">}</span>><span class="org-keyword">$</span><span class="org-string">0</span></div>
|
||||
<pre class="src src-snippet"><div<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span> id=<span class="org-string">"${</span><span class="org-warning">2</span><span class="org-string">:some_id}"</span><span class="org-keyword">}</span>><span class="org-keyword">$</span><span class="org-string">0</span></div>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
This allows you to choose if you want to give this <code>div</code> an <code>id</code>
|
||||
attribute. If you tab forward after expanding it will let you change
|
||||
attribute. If you tab forward after expanding, it will let you change
|
||||
"some\<sub>id</sub>" to whatever you like. Alternatively, you can just press <code>C-d</code>
|
||||
(which executes <a href="snippet-reference.html#yas-skip-and-clear-or-delete-char"><code>yas-skip-and-clear-or-delete-char</code></a>) and go straight to
|
||||
the exit marker.
|
||||
@@ -887,9 +988,9 @@ performs the normal Emacs <code>delete-char</code> command.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-sec-3-10" class="outline-3">
|
||||
<h3 id="sec-3-10">Indentation markers</h3>
|
||||
<div class="outline-text-3" id="text-3-10">
|
||||
<div id="outline-container-org92b7360" class="outline-3">
|
||||
<h3 id="org92b7360">Indentation markers</h3>
|
||||
<div class="outline-text-3" id="text-org92b7360">
|
||||
<p>
|
||||
If <a href="snippet-reference.html#yas-indent-line"><code>yas-indent-line</code></a> is <b>not</b> set to '<code>auto</code>, it's still possible to
|
||||
indent specific lines by adding an indentation marker, <code>$></code>, somewhere
|
||||
@@ -900,7 +1001,7 @@ on the line.
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.2.50.5 (<a href="http://orgmode.org">Org</a> mode 8.2.10) from 0.12.2 (2017-08-29 02:08:58)</p>
|
||||
<hr><p class='creator'>Generated by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 26.1 (<a href="https://orgmode.org">Org</a> mode 9.1.9) from 0.13.0 (2018-05-13 16:12:51)</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user