Put docs with updated css under new-style/ dir
373
new-style/ck-ref.html
Normal file
@ -0,0 +1,373 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Reference</title>
|
||||||
|
<meta name="generator" content="Org mode" />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
.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 { 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; }
|
||||||
|
.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%; }
|
||||||
|
pre {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
box-shadow: 3px 3px 3px #eee;
|
||||||
|
padding: 8pt;
|
||||||
|
font-family: monospace;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 1.2em;
|
||||||
|
}
|
||||||
|
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;}
|
||||||
|
/* 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-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.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 { display: inline; }
|
||||||
|
.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; }
|
||||||
|
.org-svg { width: 90%; }
|
||||||
|
/*]]>*/-->
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
@licstart The following is the entire license notice for the
|
||||||
|
JavaScript code in this tag.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2017 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The JavaScript code in this tag is free software: you can
|
||||||
|
redistribute it and/or modify it under the terms of the GNU
|
||||||
|
General Public License (GNU GPL) as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||||
|
|
||||||
|
As additional permission under GNU GPL version 3 section 7, you
|
||||||
|
may distribute non-source (e.g., minimized or compacted) forms of
|
||||||
|
that code without the copy of the GNU GPL normally required by
|
||||||
|
section 4, provided you include this license notice and a URL
|
||||||
|
through which recipients can access the Corresponding Source.
|
||||||
|
|
||||||
|
|
||||||
|
@licend The above is the entire license notice
|
||||||
|
for the JavaScript code in this tag.
|
||||||
|
*/
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
function CodeHighlightOn(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(null != target) {
|
||||||
|
elem.cacheClassElem = elem.className;
|
||||||
|
elem.cacheClassTarget = target.className;
|
||||||
|
target.className = "code-highlighted";
|
||||||
|
elem.className = "code-highlighted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function CodeHighlightOff(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(elem.cacheClassElem)
|
||||||
|
elem.className = elem.cacheClassElem;
|
||||||
|
if(elem.cacheClassTarget)
|
||||||
|
target.className = elem.cacheClassTarget;
|
||||||
|
}
|
||||||
|
/*]]>*///-->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="content">
|
||||||
|
<h1 class="title">Reference</h1>
|
||||||
|
<div id="table-of-contents">
|
||||||
|
<h2>Table of Contents</h2>
|
||||||
|
<div id="text-table-of-contents">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org5cfce8d">Interactive functions</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#yas-load-snippet-buffer-and-close"><code>yas-load-snippet-buffer-and-close</code> (<code>table</code> <i>&optional</i> <code>kill</code>)</a></li>
|
||||||
|
<li><a href="#yas-load-directory"><code>yas-load-directory</code> (<code>top-level-dir</code> <i>&optional</i> <code>use-jit</code> <code>interactive</code>)</a></li>
|
||||||
|
<li><a href="#yas-describe-table-by-namehash"><code>yas-describe-table-by-namehash</code> ()</a></li>
|
||||||
|
<li><a href="#yas-tryout-snippet"><code>yas-tryout-snippet</code> (<i>&optional</i> <code>debug</code>)</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#org21ee0a9">Customization variables</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#yas-expand-only-for-last-commands"><code>yas-expand-only-for-last-commands</code></a></li>
|
||||||
|
<li><a href="#yas-wrap-around-region"><code>yas-wrap-around-region</code></a></li>
|
||||||
|
<li><a href="#yas-new-snippet-default"><code>yas-new-snippet-default</code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org5cfce8d" class="outline-2">
|
||||||
|
<h2 id="org5cfce8d">Interactive functions</h2>
|
||||||
|
<div class="outline-text-2" id="text-org5cfce8d">
|
||||||
|
</div>
|
||||||
|
<div id="outline-container-orgd2c9872" class="outline-3">
|
||||||
|
<h3 id="yas-load-snippet-buffer-and-close"><a id="orgd2c9872"></a><code>yas-load-snippet-buffer-and-close</code> (<code>table</code> <i>&optional</i> <code>kill</code>)</h3>
|
||||||
|
<div class="outline-text-3" id="text-yas-load-snippet-buffer-and-close">
|
||||||
|
<p>
|
||||||
|
Load and save the snippet, then <code>quit-window</code> if saved.
|
||||||
|
Loading is performed by <code>yas-load-snippet-buffer</code>. If the
|
||||||
|
snippet is new, ask the user whether (and where) to save it. If
|
||||||
|
the snippet already has a file, just save it.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The prefix argument <code>kill</code> is passed to <code>quit-window</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Don't use this from a Lisp program, call <code>yas-load-snippet-buffer</code>
|
||||||
|
and <code>kill-buffer</code> instead.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org0cb4084" class="outline-3">
|
||||||
|
<h3 id="yas-load-directory"><a id="org0cb4084"></a><code>yas-load-directory</code> (<code>top-level-dir</code> <i>&optional</i> <code>use-jit</code> <code>interactive</code>)</h3>
|
||||||
|
<div class="outline-text-3" id="text-yas-load-directory">
|
||||||
|
<p>
|
||||||
|
Load snippets in directory hierarchy <code>top-level-dir</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Below <code>top-level-dir</code> each directory should be a mode name.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
With prefix argument <code>use-jit</code> do jit-loading of snippets.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org9d7d656" class="outline-3">
|
||||||
|
<h3 id="yas-describe-table-by-namehash"><a id="org9d7d656"></a><code>yas-describe-table-by-namehash</code> ()</h3>
|
||||||
|
<div class="outline-text-3" id="text-yas-describe-table-by-namehash">
|
||||||
|
<p>
|
||||||
|
Display snippet tables by <i>namehash</i>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgee0ce42" class="outline-3">
|
||||||
|
<h3 id="yas-tryout-snippet"><a id="orgee0ce42"></a><code>yas-tryout-snippet</code> (<i>&optional</i> <code>debug</code>)</h3>
|
||||||
|
<div class="outline-text-3" id="text-yas-tryout-snippet">
|
||||||
|
<p>
|
||||||
|
Test current buffer's snippet template in other buffer.
|
||||||
|
<code>debug</code> is for debugging the YASnippet engine itself.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="outline-container-org21ee0a9" class="outline-2">
|
||||||
|
<h2 id="org21ee0a9">Customization variables</h2>
|
||||||
|
<div class="outline-text-2" id="text-org21ee0a9">
|
||||||
|
</div>
|
||||||
|
<div id="outline-container-org05b5868" class="outline-3">
|
||||||
|
<h3 id="yas-expand-only-for-last-commands"><a id="org05b5868"></a><code>yas-expand-only-for-last-commands</code></h3>
|
||||||
|
<div class="outline-text-3" id="text-yas-expand-only-for-last-commands">
|
||||||
|
<p>
|
||||||
|
List of <code>last-command</code> values to restrict tab-triggering to, or nil.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Leave this set at nil (the default) to be able to trigger an
|
||||||
|
expansion simply by placing the cursor after a valid tab trigger,
|
||||||
|
using whichever commands.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Optionally, set this to something like (self-insert-command) if
|
||||||
|
you to wish restrict expansion to only happen when the last
|
||||||
|
letter of the snippet tab trigger was typed immediately before
|
||||||
|
the trigger key itself.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org7d04b93" class="outline-3">
|
||||||
|
<h3 id="yas-wrap-around-region"><a id="org7d04b93"></a><code>yas-wrap-around-region</code></h3>
|
||||||
|
<div class="outline-text-3" id="text-yas-wrap-around-region">
|
||||||
|
<p>
|
||||||
|
What to insert for snippet's $0 field.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If set to a character, insert contents of corresponding register.
|
||||||
|
If non-nil insert region contents. This can be overridden on a
|
||||||
|
per-snippet basis. A value of <code>cua</code> is considered equivalent to
|
||||||
|
`?0' for backwards compatibility.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org1bf5e87" class="outline-3">
|
||||||
|
<h3 id="yas-new-snippet-default"><a id="org1bf5e87"></a><code>yas-new-snippet-default</code></h3>
|
||||||
|
<div class="outline-text-3" id="text-yas-new-snippet-default">
|
||||||
|
<p>
|
||||||
|
Default snippet to use when creating a new snippet.
|
||||||
|
If nil, don't use any snippet.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="postamble" class="status">
|
||||||
|
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
40
new-style/example-snippet.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||||
|
<!-- Created by htmlize-1.47 in css mode. -->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>*Org Src snippet-development.org[ snippet ]*</title>
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
body {
|
||||||
|
color: #000000;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
.comment {
|
||||||
|
/* font-lock-comment-face */
|
||||||
|
color: #b22222;
|
||||||
|
}
|
||||||
|
.keyword {
|
||||||
|
/* font-lock-keyword-face */
|
||||||
|
color: #a020f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
background-color: inherit;
|
||||||
|
font: inherit;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre>
|
||||||
|
<span class="comment"># contributor: pluskid <a href="mailto:pluskid%40gmail.com"><pluskid@gmail.com></a></span>
|
||||||
|
<span class="comment"># name: __...__</span>
|
||||||
|
<span class="comment"># --</span>
|
||||||
|
__${init<span class="keyword">}</span>__</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
395
new-style/faq.html
Normal file
@ -0,0 +1,395 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Frequently Asked Questions</title>
|
||||||
|
<meta name="generator" content="Org mode" />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
.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 { 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; }
|
||||||
|
.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%; }
|
||||||
|
pre {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
box-shadow: 3px 3px 3px #eee;
|
||||||
|
padding: 8pt;
|
||||||
|
font-family: monospace;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 1.2em;
|
||||||
|
}
|
||||||
|
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;}
|
||||||
|
/* 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-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.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 { display: inline; }
|
||||||
|
.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; }
|
||||||
|
.org-svg { width: 90%; }
|
||||||
|
/*]]>*/-->
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
@licstart The following is the entire license notice for the
|
||||||
|
JavaScript code in this tag.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2017 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The JavaScript code in this tag is free software: you can
|
||||||
|
redistribute it and/or modify it under the terms of the GNU
|
||||||
|
General Public License (GNU GPL) as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||||
|
|
||||||
|
As additional permission under GNU GPL version 3 section 7, you
|
||||||
|
may distribute non-source (e.g., minimized or compacted) forms of
|
||||||
|
that code without the copy of the GNU GPL normally required by
|
||||||
|
section 4, provided you include this license notice and a URL
|
||||||
|
through which recipients can access the Corresponding Source.
|
||||||
|
|
||||||
|
|
||||||
|
@licend The above is the entire license notice
|
||||||
|
for the JavaScript code in this tag.
|
||||||
|
*/
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
function CodeHighlightOn(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(null != target) {
|
||||||
|
elem.cacheClassElem = elem.className;
|
||||||
|
elem.cacheClassTarget = target.className;
|
||||||
|
target.className = "code-highlighted";
|
||||||
|
elem.className = "code-highlighted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function CodeHighlightOff(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(elem.cacheClassElem)
|
||||||
|
elem.className = elem.cacheClassElem;
|
||||||
|
if(elem.cacheClassTarget)
|
||||||
|
target.className = elem.cacheClassTarget;
|
||||||
|
}
|
||||||
|
/*]]>*///-->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="preamble" class="status">
|
||||||
|
<nav>
|
||||||
|
<ul class="center">
|
||||||
|
<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 border">Snippet
|
||||||
|
<ul id="snippet-submenu">
|
||||||
|
<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> <a href="snippet-menu.html">Menu</a>
|
||||||
|
</ul>
|
||||||
|
<li> <span class='current'>FAQ</span>
|
||||||
|
<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">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org64f1b8c">Why is there an extra newline?</a></li>
|
||||||
|
<li><a href="#org3e0ab30">Why doesn't TAB navigation work with flyspell</a></li>
|
||||||
|
<li><a href="#org5f4a84d">How do I use alternative keys, i.e. not TAB?</a></li>
|
||||||
|
<li><a href="#orgf731e45">How do I turn off the minor mode where in some buffers?</a></li>
|
||||||
|
<li><a href="#org096bf1a">How do I define an abbrev key containing characters not supported by the filesystem?</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org64f1b8c" class="outline-2">
|
||||||
|
<h2 id="org64f1b8c">Why is there an extra newline?</h2>
|
||||||
|
<div class="outline-text-2" id="text-org64f1b8c">
|
||||||
|
<p>
|
||||||
|
If there is a newline at the end of a snippet definition file,
|
||||||
|
YASnippet will add a newline when expanding that snippet. When editing
|
||||||
|
or saving a snippet file, please be careful not to accidentally add a
|
||||||
|
terminal newline.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Note that 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 automatically.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org3e0ab30" class="outline-2">
|
||||||
|
<h2 id="org3e0ab30">Why doesn't TAB navigation work with flyspell</h2>
|
||||||
|
<div class="outline-text-2" id="text-org3e0ab30">
|
||||||
|
<p>
|
||||||
|
A workaround is to inhibit flyspell overlays while the snippet is
|
||||||
|
active:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-emacs-lisp">(add-hook 'flyspell-incorrect-hook
|
||||||
|
#'(lambda (dummy1 dummy2 dymmy3)
|
||||||
|
(<span class="org-keyword">and</span> yas-active-field-overlay
|
||||||
|
(overlay-buffer yas-active-field-overlay))))
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This is apparently related to overlay priorities. For some reason, the
|
||||||
|
<code>keymap</code> property of flyspell's overlays always takes priority over the
|
||||||
|
same property in YASnippet's overlays, even if one sets the latter's
|
||||||
|
<code>priority</code> property to something big. If you know emacs-lisp and can
|
||||||
|
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-org5f4a84d" class="outline-2">
|
||||||
|
<h2 id="org5f4a84d">How do I use alternative keys, i.e. not TAB?</h2>
|
||||||
|
<div class="outline-text-2" id="text-org5f4a84d">
|
||||||
|
<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="src src-emacs-lisp">(define-key yas-minor-mode-map (kbd <span class="org-string">"<tab>"</span>) nil)
|
||||||
|
(define-key yas-minor-mode-map (kbd <span class="org-string">"TAB"</span>) nil)
|
||||||
|
(define-key yas-minor-mode-map (kbd <span class="org-string">"<the new key>"</span>) yas-maybe-expand)
|
||||||
|
|
||||||
|
<span class="org-comment-delimiter">;;</span><span class="org-comment">keys for navigation</span>
|
||||||
|
(define-key yas-keymap [(tab)] nil)
|
||||||
|
(define-key yas-keymap (kbd <span class="org-string">"TAB"</span>) nil)
|
||||||
|
(define-key yas-keymap [(shift tab)] nil)
|
||||||
|
(define-key yas-keymap [backtab] nil)
|
||||||
|
(define-key yas-keymap (kbd <span class="org-string">"<new-next-field-key>"</span>) 'yas-next-field-or-maybe-expand)
|
||||||
|
(define-key yas-keymap (kbd <span class="org-string">"<new-prev-field-key>"</span>) 'yas-prev)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgf731e45" class="outline-2">
|
||||||
|
<h2 id="orgf731e45">How do I turn off the minor mode where in some buffers?</h2>
|
||||||
|
<div class="outline-text-2" id="text-orgf731e45">
|
||||||
|
<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="src src-emacs-lisp">(set-default 'yas-dont-activate
|
||||||
|
#'(lambda ()
|
||||||
|
(<span class="org-keyword">and</span> yas-root-directory
|
||||||
|
(null (yas-get-snippet-tables)))))
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This is also the default value starting for that version. It skips the
|
||||||
|
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-org096bf1a" class="outline-2">
|
||||||
|
<h2 id="org096bf1a">How do I define an abbrev key containing characters not supported by the filesystem?</h2>
|
||||||
|
<div class="outline-text-2" id="text-org096bf1a">
|
||||||
|
<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…</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
|
||||||
|
filename, <code>lt.YASnippet</code> for example, using <code><</code> for the <code># key:</code>
|
||||||
|
directive:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-snippet"><span class="org-comment"># key: <</span>
|
||||||
|
<span class="org-comment"># name: <...></...></span>
|
||||||
|
<span class="org-comment"># --</span>
|
||||||
|
<<span class="org-keyword">${</span><span class="org-warning">1</span><span class="org-keyword">:</span>div<span class="org-keyword">}</span>><span class="org-keyword">$</span><span class="org-string">0</span></<span class="org-keyword">$</span><span class="org-string">1</span>>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="postamble" class="status">
|
||||||
|
<hr><p class='creator'>Generated by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 26.0.90 (<a href="http://orgmode.org">Org</a> mode 9.1.2) from 0.12.2-37-gdc6d7d2 (2018-02-18 12:46:06)</p>
|
||||||
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
BIN
new-style/images/bg-content-left.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
new-style/images/bg-content-right.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
new-style/images/bg-content.png
Normal file
After Width: | Height: | Size: 485 B |
BIN
new-style/images/bg-navigation-item-hover.png
Normal file
After Width: | Height: | Size: 441 B |
BIN
new-style/images/bg-navigation-item.png
Normal file
After Width: | Height: | Size: 502 B |
BIN
new-style/images/bg-navigation.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
new-style/images/body.png
Normal file
After Width: | Height: | Size: 712 B |
BIN
new-style/images/customization-group.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
new-style/images/dropdown-menu.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
new-style/images/external.png
Normal file
After Width: | Height: | Size: 165 B |
BIN
new-style/images/ido-menu.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
new-style/images/menu-1.png
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
new-style/images/menu-2.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
new-style/images/menu-groups.png
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
new-style/images/menu-parent.png
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
new-style/images/minor-mode-indicator.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
new-style/images/x-menu.png
Normal file
After Width: | Height: | Size: 34 KiB |
327
new-style/index.html
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Yet another snippet extension</title>
|
||||||
|
<meta name="generator" content="Org mode" />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
.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 { 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; }
|
||||||
|
.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%; }
|
||||||
|
pre {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
box-shadow: 3px 3px 3px #eee;
|
||||||
|
padding: 8pt;
|
||||||
|
font-family: monospace;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 1.2em;
|
||||||
|
}
|
||||||
|
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;}
|
||||||
|
/* 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-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.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 { display: inline; }
|
||||||
|
.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; }
|
||||||
|
.org-svg { width: 90%; }
|
||||||
|
/*]]>*/-->
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
@licstart The following is the entire license notice for the
|
||||||
|
JavaScript code in this tag.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2017 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The JavaScript code in this tag is free software: you can
|
||||||
|
redistribute it and/or modify it under the terms of the GNU
|
||||||
|
General Public License (GNU GPL) as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||||
|
|
||||||
|
As additional permission under GNU GPL version 3 section 7, you
|
||||||
|
may distribute non-source (e.g., minimized or compacted) forms of
|
||||||
|
that code without the copy of the GNU GPL normally required by
|
||||||
|
section 4, provided you include this license notice and a URL
|
||||||
|
through which recipients can access the Corresponding Source.
|
||||||
|
|
||||||
|
|
||||||
|
@licend The above is the entire license notice
|
||||||
|
for the JavaScript code in this tag.
|
||||||
|
*/
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
function CodeHighlightOn(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(null != target) {
|
||||||
|
elem.cacheClassElem = elem.className;
|
||||||
|
elem.cacheClassTarget = target.className;
|
||||||
|
target.className = "code-highlighted";
|
||||||
|
elem.className = "code-highlighted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function CodeHighlightOff(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(elem.cacheClassElem)
|
||||||
|
elem.className = elem.cacheClassElem;
|
||||||
|
if(elem.cacheClassTarget)
|
||||||
|
target.className = elem.cacheClassTarget;
|
||||||
|
}
|
||||||
|
/*]]>*///-->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="preamble" class="status">
|
||||||
|
<nav>
|
||||||
|
<ul class="center">
|
||||||
|
<li> <span class='current'>Overview</span>
|
||||||
|
<li> <a href="https://github.com/joaotavora/yasnippet/blob/master/README.mdown">
|
||||||
|
Intro and Tutorial</a>
|
||||||
|
<li class="center border">Snippet
|
||||||
|
<ul id="snippet-submenu">
|
||||||
|
<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> <a href="snippet-menu.html">Menu</a>
|
||||||
|
</ul>
|
||||||
|
<li> <a href="faq.html">FAQ</a>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ol class="org-ol">
|
||||||
|
<li><p>
|
||||||
|
<a href="https://github.com/joaotavora/yasnippet/blob/master/README.mdown">README</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Contains an introduction, installation instructions and other important
|
||||||
|
notes.
|
||||||
|
</p></li>
|
||||||
|
|
||||||
|
<li><p>
|
||||||
|
<a href="snippet-organization.html">Organizing Snippets</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Describes ways to organize your snippets in the hard disk.
|
||||||
|
</p></li>
|
||||||
|
|
||||||
|
<li><p>
|
||||||
|
<a href="snippet-expansion.html">Expanding Snippets</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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…
|
||||||
|
</p></li>
|
||||||
|
|
||||||
|
<li><p>
|
||||||
|
<a href="snippet-development.html">Writing Snippets</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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><p>
|
||||||
|
<a href="snippet-menu.html">The YASnippet menu</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Explains how to use the YASnippet menu to explore, learn and modify
|
||||||
|
snippets.
|
||||||
|
</p></li>
|
||||||
|
|
||||||
|
<li><p>
|
||||||
|
<a href="faq.html">Frequently asked questions</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Answers to frequently asked questions.
|
||||||
|
</p></li>
|
||||||
|
|
||||||
|
<li><p>
|
||||||
|
<a href="snippet-reference.html">YASnippet Symbol Reference</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
An automatically generated listing of all YASnippet commands,
|
||||||
|
(customization) variables, and functions.
|
||||||
|
</p></li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div id="postamble" class="status">
|
||||||
|
<hr><p class='creator'>Generated by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 26.0.90 (<a href="http://orgmode.org">Org</a> mode 9.1.2) from 0.12.2-37-gdc6d7d2 (2018-02-18 12:46:06)</p>
|
||||||
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
989
new-style/snippet-development.html
Normal file
@ -0,0 +1,989 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<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 name="generator" content="Org mode" />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
.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 { 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; }
|
||||||
|
.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%; }
|
||||||
|
pre {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
box-shadow: 3px 3px 3px #eee;
|
||||||
|
padding: 8pt;
|
||||||
|
font-family: monospace;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 1.2em;
|
||||||
|
}
|
||||||
|
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;}
|
||||||
|
/* 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-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.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 { display: inline; }
|
||||||
|
.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; }
|
||||||
|
.org-svg { width: 90%; }
|
||||||
|
/*]]>*/-->
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
@licstart The following is the entire license notice for the
|
||||||
|
JavaScript code in this tag.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2017 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The JavaScript code in this tag is free software: you can
|
||||||
|
redistribute it and/or modify it under the terms of the GNU
|
||||||
|
General Public License (GNU GPL) as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||||
|
|
||||||
|
As additional permission under GNU GPL version 3 section 7, you
|
||||||
|
may distribute non-source (e.g., minimized or compacted) forms of
|
||||||
|
that code without the copy of the GNU GPL normally required by
|
||||||
|
section 4, provided you include this license notice and a URL
|
||||||
|
through which recipients can access the Corresponding Source.
|
||||||
|
|
||||||
|
|
||||||
|
@licend The above is the entire license notice
|
||||||
|
for the JavaScript code in this tag.
|
||||||
|
*/
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
function CodeHighlightOn(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(null != target) {
|
||||||
|
elem.cacheClassElem = elem.className;
|
||||||
|
elem.cacheClassTarget = target.className;
|
||||||
|
target.className = "code-highlighted";
|
||||||
|
elem.className = "code-highlighted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function CodeHighlightOff(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(elem.cacheClassElem)
|
||||||
|
elem.className = elem.cacheClassElem;
|
||||||
|
if(elem.cacheClassTarget)
|
||||||
|
target.className = elem.cacheClassTarget;
|
||||||
|
}
|
||||||
|
/*]]>*///-->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="preamble" class="status">
|
||||||
|
<nav>
|
||||||
|
<ul class="center">
|
||||||
|
<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 border">Snippet
|
||||||
|
<ul id="snippet-submenu">
|
||||||
|
<li> <a href="snippet-organization.html">Organization</a>
|
||||||
|
<li> <a href="snippet-expansion.html">Expansion</a>
|
||||||
|
<li> <span class='current'>Development</span>
|
||||||
|
<li> <a href="snippet-menu.html">Menu</a>
|
||||||
|
</ul>
|
||||||
|
<li> <a href="faq.html">FAQ</a>
|
||||||
|
<li> <a href="snippet-reference.html">Reference</a>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div id="content">
|
||||||
|
<h1 class="title">Writing snippets</h1>
|
||||||
|
<div id="table-of-contents">
|
||||||
|
<h2>Table of Contents</h2>
|
||||||
|
<div id="text-table-of-contents">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org6796ab7">Snippet development</a>
|
||||||
|
<ul>
|
||||||
|
<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="#org5e87ae3">File content</a>
|
||||||
|
<ul>
|
||||||
|
<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="#org9801aa7">Template Syntax</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org0e7ccf8">Plain Text</a></li>
|
||||||
|
<li><a href="#orgcde188c">Embedded Emacs-lisp code</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org9804f4c">Note: backquote expressions should not modify the buffer</a></li>
|
||||||
|
</ul>
|
||||||
|
</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-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><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="#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><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>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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-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
|
||||||
|
useful syntax highlighting.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Three commands are defined in this mode:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul class="org-ul">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<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
|
||||||
|
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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
There are also <i>snippets for writing snippets</i>: <code>vars</code>, <code>$f</code> and <code>$m</code>
|
||||||
|
:-).
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Optionally, if the file contains a line of <code># --</code>, the lines above it
|
||||||
|
count as comments, some of which can be <i>directives</i> (or meta data).
|
||||||
|
Snippet directives look like <code># property: value</code> and tweak certain
|
||||||
|
snippets properties described below. If no <code># --</code> is found, the whole
|
||||||
|
file is considered the snippet template.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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>
|
||||||
|
__${init<span class="org-keyword">}</span>__
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Here's a list of currently supported directives:
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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,
|
||||||
|
the snippet will not be expandable through the trigger mechanism.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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 –
|
||||||
|
especially distinguishable among similar snippets.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you omit this name, it will default to the file name the snippet
|
||||||
|
was loaded from.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
non-nil value.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
See also <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a> in
|
||||||
|
<a href="./snippet-expansion.html">Expanding snippets</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
many snippets for a mode which will make the menu too long.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The <code># group:</code> property only affect menu construction (See
|
||||||
|
<a href="./snippet-menu.html">the YASnippet menu</a>) and the same effect can be
|
||||||
|
achieved by grouping snippets into sub-directories and using the
|
||||||
|
<code>.yas-make-groups</code> special file (for this see
|
||||||
|
<a href="./snippet-organization.html">Organizing Snippets</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Refer to the bundled snippets for <code>ruby-mode</code> for examples on the
|
||||||
|
<code># group:</code> directive. Group can also be nested, e.g.
|
||||||
|
<code>control structure.loops</code> tells that the snippet is under the <code>loops</code>
|
||||||
|
group which is under the <code>control structure</code> group.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
used to override variable values while the snippet is being expanded.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Interesting variables to override are <a href="snippet-reference.html#yas-wrap-around-region"><code>yas-wrap-around-region</code></a> and
|
||||||
|
<a href="snippet-reference.html#yas-indent-line"><code>yas-indent-line</code></a> (see <a href="./snippet-expansion.html">Expanding Snippets</a>).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
As an example, you might normally have <a href="snippet-reference.html#yas-indent-line"><code>yas-indent-line</code></a> set to '<code>auto</code>
|
||||||
|
and <a href="snippet-reference.html#yas-wrap-around-region"><code>yas-wrap-around-region</code></a> set to <code>t</code>, but for this particularly
|
||||||
|
brilliant piece of ASCII art these values would mess up your hard work.
|
||||||
|
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>
|
||||||
|
welcome to my
|
||||||
|
X humble
|
||||||
|
/ \ home,
|
||||||
|
/ \ <span class="org-keyword">$</span><span class="org-string">0</span>
|
||||||
|
/ \
|
||||||
|
/-------\
|
||||||
|
| |
|
||||||
|
| +-+ |
|
||||||
|
| | | |
|
||||||
|
+--+-+--+
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
named after the major mode the snippet is active for.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Additionally a variable <a href="snippet-reference.html#yas-prefix"><code>yas-prefix</code></a> is set to to the prefix argument
|
||||||
|
you normally use for a command. This allows for small variations on the
|
||||||
|
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 <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>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This binding will be recorded in the keymap <code>html-mode-map</code>. To expand a
|
||||||
|
paragraph tag newlines, just press <code>C-u C-c C-c C-m</code>. Omitting the <code>C-u</code>
|
||||||
|
will expand the paragraph tag without newlines.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
triggered.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<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="#org9801aa7">Template Syntax</a>,
|
||||||
|
described below.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
previous snippet.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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-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
|
||||||
|
use <code>\</code> to escape them: <code>\$</code> and <code>\`</code>. The <code>\</code> itself may also needed to be
|
||||||
|
escaped as <code>\\</code> sometimes.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
being expanded. The evaluation is done in the same buffer as the
|
||||||
|
snippet being expanded.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Here's an example for c-mode to calculate the header file guard
|
||||||
|
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>
|
||||||
|
|
||||||
|
<span class="org-keyword">$</span><span class="org-string">0</span>
|
||||||
|
|
||||||
|
<span class="org-comment">#endif /* $</span><span class="org-string">1</span><span class="org-comment"> */</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
From version 0.6, snippets expansions are run with some special
|
||||||
|
Emacs-lisp variables bound. One of this is <a href="snippet-reference.html#yas-selected-text"><code>yas-selected-text</code></a>. You can
|
||||||
|
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>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
to "wrap" the selected region inside your recently inserted snippet.
|
||||||
|
Alternatively, you can also customize the variable
|
||||||
|
<a href="snippet-reference.html#yas-wrap-around-region"><code>yas-wrap-around-region</code></a> to <code>t</code> which will do this automatically.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
doing
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-snippet">Timestamp: `(insert (current-time-string))`
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
do this:
|
||||||
|
</p>
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-snippet">Timestamp: `(current-time-string)`
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<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
|
||||||
|
special meaning of the <i>exit point</i> of a snippet. That is the last place
|
||||||
|
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>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<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 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="#orge0a8493">mirrors</a> or
|
||||||
|
<a href="#org6c77fba">transformations</a> for this field.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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:
|
||||||
|
</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>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
When you type "document" at <code>${1:enumerate}</code>, the word "document" will
|
||||||
|
also be inserted at <code>\end{$1}</code>. The best explanation is to see the
|
||||||
|
screencast(<a href="http://www.youtube.com/watch?v=vOj7btx3ATg">YouTube</a> or <a href="http://yasnippet.googlecode.com/files/yasnippet.avi">avi video</a>).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The tab stops with the same number to the field act as its mirrors. If
|
||||||
|
none of the tab stops has an initial value, the first one is selected as
|
||||||
|
the field and others mirrors.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
transformation. The mirror's text content is calculated according to
|
||||||
|
this transformation, which is Emacs-lisp code that gets evaluated in
|
||||||
|
an environment where the variable <a href="snippet-reference.html#yas-text"><code>yas-text</code></a> is bound to the text
|
||||||
|
content (string) contained in the field <code>n</code>. Here's an example for
|
||||||
|
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>;
|
||||||
|
<span class="org-keyword">}</span>
|
||||||
|
|
||||||
|
- (void)set<span class="org-keyword">${</span><span class="org-warning">2</span><span class="org-keyword">:</span><span class="org-preprocessor">$(</span>capitalize yas-text)<span class="org-keyword">}</span>:(<span class="org-keyword">$</span><span class="org-string">1</span>)aValue
|
||||||
|
{
|
||||||
|
[<span class="org-keyword">$</span><span class="org-string">2</span> autorelease];
|
||||||
|
<span class="org-keyword">$</span><span class="org-string">2</span> = [aValue retain];
|
||||||
|
<span class="org-keyword">}</span>
|
||||||
|
<span class="org-keyword">$</span><span class="org-string">0</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Look at <code>${2:$(capitalize yas-text)}</code>, it is a mirror with
|
||||||
|
transformation instead of a field. The actual field is at the first
|
||||||
|
line: <code>${2:foo}</code>. When you type text in <code>${2:foo}</code>, the transformation
|
||||||
|
will be evaluated and the result will be placed there as the
|
||||||
|
transformed text. So in this example, if you type "baz" in the field,
|
||||||
|
the transformed text will be "Baz". This example is also available in
|
||||||
|
the screencast.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Another example is for <code>rst-mode</code>. In reStructuredText, the document
|
||||||
|
title can be some text surrounded by "<code>=</code>" below and above. The "<code>=</code>"
|
||||||
|
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>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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>
|
||||||
|
|
||||||
|
<span class="org-keyword">$</span><span class="org-string">0</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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 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>
|
||||||
|
The syntax is also a tiny bit different, so that the parser can
|
||||||
|
distinguish between fields and mirrors. In the following example
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre class="example">
|
||||||
|
#define "${1:mydefine$(upcase yas-text)}"
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<code>mydefine</code> gets automatically upcased to <code>MYDEFINE</code> once you enter the
|
||||||
|
field. As you type text, it gets filtered through the transformation
|
||||||
|
every time.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Note that to tell this kind of expression from a mirror with a
|
||||||
|
transformation, YASnippet needs extra text between the <code>:</code> and the
|
||||||
|
transformation's <code>$</code>. If you don't want this extra-text, you can use two
|
||||||
|
<code>$</code>'s instead.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre class="example">
|
||||||
|
#define "${1:$$(upcase yas-text)}"
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Please note that as soon as a transformation takes place, it changes the
|
||||||
|
value of the field and sets it its internal modification state to
|
||||||
|
<code>true</code>. As a consequence, the auto-deletion behaviour of normal fields
|
||||||
|
does not take place. This is by design.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
<a href="snippet-reference.html#yas-modified-p"><code>yas-modified-p</code></a> and <a href="snippet-reference.html#yas-moving-away-p"><code>yas-moving-away-p</code></a>. Because of this feature you
|
||||||
|
can place a transformation in the primary field that lets you select
|
||||||
|
default values for it.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The <a href="snippet-reference.html#yas-choose-value"><code>yas-choose-value</code></a> does this work for you. For example:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
See the definition of <a href="snippet-reference.html#yas-choose-value"><code>yas-choose-value</code></a> to see how it was written using
|
||||||
|
the two variables.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Here's another use, for LaTeX-mode, which calls reftex-label just as you
|
||||||
|
enter snippet field 2. This one makes use of <a href="snippet-reference.html#yas-modified-p"><code>yas-modified-p</code></a> directly.
|
||||||
|
</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><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:<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>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The function <a href="snippet-reference.html#yas-verify-value"><code>yas-verify-value</code></a> has another neat trick, and makes use
|
||||||
|
of <a href="snippet-reference.html#yas-moving-away-p"><code>yas-moving-away-p</code></a>. Try it and see! Also, check out this <a href="http://groups.google.com/group/smart-snippet/browse_thread/thread/282a90a118e1b662">thread</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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-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
|
||||||
|
"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.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
By the way, <code>C-d</code> will only clear the field if you cursor is at the
|
||||||
|
beginning of the field <i>and</i> it hasn't been changed yet. Otherwise, it
|
||||||
|
performs the normal Emacs <code>delete-char</code> command.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
on the line.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="postamble" class="status">
|
||||||
|
<hr><p class='creator'>Generated by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 26.0.90 (<a href="http://orgmode.org">Org</a> mode 9.1.2) from 0.12.2-37-gdc6d7d2 (2018-02-18 12:46:06)</p>
|
||||||
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
747
new-style/snippet-expansion.html
Normal file
@ -0,0 +1,747 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Expanding snippets</title>
|
||||||
|
<meta name="generator" content="Org mode" />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
.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 { 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; }
|
||||||
|
.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%; }
|
||||||
|
pre {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
box-shadow: 3px 3px 3px #eee;
|
||||||
|
padding: 8pt;
|
||||||
|
font-family: monospace;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 1.2em;
|
||||||
|
}
|
||||||
|
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;}
|
||||||
|
/* 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-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.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 { display: inline; }
|
||||||
|
.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; }
|
||||||
|
.org-svg { width: 90%; }
|
||||||
|
/*]]>*/-->
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
@licstart The following is the entire license notice for the
|
||||||
|
JavaScript code in this tag.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2017 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The JavaScript code in this tag is free software: you can
|
||||||
|
redistribute it and/or modify it under the terms of the GNU
|
||||||
|
General Public License (GNU GPL) as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||||
|
|
||||||
|
As additional permission under GNU GPL version 3 section 7, you
|
||||||
|
may distribute non-source (e.g., minimized or compacted) forms of
|
||||||
|
that code without the copy of the GNU GPL normally required by
|
||||||
|
section 4, provided you include this license notice and a URL
|
||||||
|
through which recipients can access the Corresponding Source.
|
||||||
|
|
||||||
|
|
||||||
|
@licend The above is the entire license notice
|
||||||
|
for the JavaScript code in this tag.
|
||||||
|
*/
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
function CodeHighlightOn(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(null != target) {
|
||||||
|
elem.cacheClassElem = elem.className;
|
||||||
|
elem.cacheClassTarget = target.className;
|
||||||
|
target.className = "code-highlighted";
|
||||||
|
elem.className = "code-highlighted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function CodeHighlightOff(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(elem.cacheClassElem)
|
||||||
|
elem.className = elem.cacheClassElem;
|
||||||
|
if(elem.cacheClassTarget)
|
||||||
|
target.className = elem.cacheClassTarget;
|
||||||
|
}
|
||||||
|
/*]]>*///-->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="preamble" class="status">
|
||||||
|
<nav>
|
||||||
|
<ul class="center">
|
||||||
|
<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 border">Snippet
|
||||||
|
<ul id="snippet-submenu">
|
||||||
|
<li> <a href="snippet-organization.html">Organization</a>
|
||||||
|
<li> <span class='current'>Expansion</span>
|
||||||
|
<li> <a href="snippet-development.html">Development</a>
|
||||||
|
<li> <a href="snippet-menu.html">Menu</a>
|
||||||
|
</ul>
|
||||||
|
<li> <a href="faq.html">FAQ</a>
|
||||||
|
<li> <a href="snippet-reference.html">Reference</a>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div id="content">
|
||||||
|
<h1 class="title">Expanding snippets</h1>
|
||||||
|
<div id="table-of-contents">
|
||||||
|
<h2>Table of Contents</h2>
|
||||||
|
<div id="text-table-of-contents">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org12170ff">Triggering expansion</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org87a6f68">Trigger key</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org161aff0">Fallback behaviour</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#org454e5fd">Insert at point</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org05cd89a">Inserting region or register contents into snippet</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#orgc3c8799">Snippet keybinding</a></li>
|
||||||
|
<li><a href="#orgf5cd066">Expanding from the menu</a></li>
|
||||||
|
<li><a href="#orgaf084f4">Expanding with <code>hippie-expand</code></a></li>
|
||||||
|
<li><a href="#orgb8b9e8f">Expanding from emacs-lisp code</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#org61654fd">Controlling expansion</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#orga555023">Eligible snippets</a></li>
|
||||||
|
<li><a href="#org075c5ff">The condition system </a></li>
|
||||||
|
<li><a href="#org2f6a9be">Multiples snippet with the same key</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org020d7e4">Use the X window system</a></li>
|
||||||
|
<li><a href="#org8c16a13">Minibuffer prompting</a></li>
|
||||||
|
<li><a href="#orgb151bf6">Use <code>dropdown-menu.el</code></a></li>
|
||||||
|
<li><a href="#orgda9ea36">Roll your own</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<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="outline-container-org12170ff" class="outline-2">
|
||||||
|
<h2 id="org12170ff">Triggering expansion</h2>
|
||||||
|
<div class="outline-text-2" id="text-org12170ff">
|
||||||
|
<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 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>
|
||||||
|
</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>).</li>
|
||||||
|
|
||||||
|
<li>Use m2m's excellent auto-complete
|
||||||
|
TODO: example for this</li>
|
||||||
|
|
||||||
|
<li>Expanding from emacs-lisp code</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org87a6f68" class="outline-3">
|
||||||
|
<h3 id="org87a6f68">Trigger key</h3>
|
||||||
|
<div class="outline-text-3" id="text-org87a6f68">
|
||||||
|
<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. YASnippet also provides a <i>conditional
|
||||||
|
binding</i> for this command: the variable <a href="snippet-reference.html#yas-expand"><code>yas-maybe-expand</code></a> contains a
|
||||||
|
special value which, when bound in a keymap, tells Emacs to call
|
||||||
|
<a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> if and only if there is a snippet abbrev before point.
|
||||||
|
If there is no snippet to expand, Emacs will behave as if <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a>
|
||||||
|
is unbound and so will run whatever command is bound to that key
|
||||||
|
normally.
|
||||||
|
</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-maybe-expand"><code>yas-maybe-expand</code></a> to <code>TAB</code>
|
||||||
|
and <code><tab></code> by default, however, you can freely remove those bindings:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-emacs-lisp">(define-key yas-minor-mode-map (kbd <span class="org-string">"<tab>"</span>) nil)
|
||||||
|
(define-key yas-minor-mode-map (kbd <span class="org-string">"TAB"</span>) nil)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
And set your own:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-emacs-lisp"><span class="org-comment-delimiter">;; </span><span class="org-comment">Bind `</span><span class="org-comment"><span class="org-constant">SPC</span></span><span class="org-comment">' to `</span><span class="org-comment"><span class="org-constant">yas-expand</span></span><span class="org-comment">' when snippet expansion available (it</span>
|
||||||
|
<span class="org-comment-delimiter">;; </span><span class="org-comment">will still call `</span><span class="org-comment"><span class="org-constant">self-insert-command</span></span><span class="org-comment">' otherwise).</span>
|
||||||
|
(define-key yas-minor-mode-map (kbd <span class="org-string">"SPC"</span>) yas-maybe-expand)
|
||||||
|
<span class="org-comment-delimiter">;; </span><span class="org-comment">Bind `C-c y' to `</span><span class="org-comment"><span class="org-constant">yas-expand</span></span><span class="org-comment">' ONLY.</span>
|
||||||
|
(define-key yas-minor-mode-map (kbd <span class="org-string">"C-c y"</span>) #'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>
|
||||||
|
|
||||||
|
|
||||||
|
<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 calling <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> with a negative
|
||||||
|
argument in the buffer's mode hook.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org161aff0" class="outline-4">
|
||||||
|
<h4 id="org161aff0">Fallback behaviour</h4>
|
||||||
|
<div class="outline-text-4" id="text-org161aff0">
|
||||||
|
<p>
|
||||||
|
YASnippet used to support a more complicated way of sharing
|
||||||
|
keybindings before <a href="snippet-reference.html#yas-expand"><code>yas-maybe-expand</code></a> was added. This is now
|
||||||
|
obsolete.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org454e5fd" class="outline-3">
|
||||||
|
<h3 id="org454e5fd">Insert at point</h3>
|
||||||
|
<div class="outline-text-3" id="text-org454e5fd">
|
||||||
|
<p>
|
||||||
|
The command <a href="snippet-reference.html#yas-insert-snippet"><code>yas-insert-snippet</code></a> 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 id="outline-container-org05cd89a" class="outline-4">
|
||||||
|
<h4 id="org05cd89a">Inserting region or register contents into snippet</h4>
|
||||||
|
<div class="outline-text-4" id="text-org05cd89a">
|
||||||
|
<p>
|
||||||
|
It's often useful to inject already written text in the middle of a
|
||||||
|
snippet. The variable <a href="snippet-reference.html#yas-wrap-around-region"><code>yas-wrap-around-region</code></a> when to t substitute
|
||||||
|
the region contents into the <code>$0</code> placeholder of a snippet expanded by
|
||||||
|
<a href="snippet-reference.html#yas-insert-snippet"><code>yas-insert-snippet</code></a>. Setting it to a character value (e.g. <code>?0</code>)
|
||||||
|
will insert the contents of corresponding register.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Older (versions 0.9.1 and below) of Yasnippet, supported a setting of
|
||||||
|
<code>cua</code> that is equivalent to <code>?0</code> but only worked with <code>cua-mode</code>
|
||||||
|
turned on. This setting is still supported for backwards
|
||||||
|
compatibility, but is now entirely equivalent to <code>?0</code>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgc3c8799" class="outline-3">
|
||||||
|
<h3 id="orgc3c8799">Snippet keybinding</h3>
|
||||||
|
<div class="outline-text-3" id="text-orgc3c8799">
|
||||||
|
<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-orgf5cd066" class="outline-3">
|
||||||
|
<h3 id="orgf5cd066">Expanding from the menu</h3>
|
||||||
|
<div class="outline-text-3" id="text-orgf5cd066">
|
||||||
|
<p>
|
||||||
|
See <a href="./snippet-menu.html">the YASnippet Menu</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgaf084f4" class="outline-3">
|
||||||
|
<h3 id="orgaf084f4">Expanding with <code>hippie-expand</code></h3>
|
||||||
|
<div class="outline-text-3" id="text-orgaf084f4">
|
||||||
|
<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
|
||||||
|
<code>hippie-expand-try-functions-list</code>. This probably makes more sense
|
||||||
|
when placed at the top of the list, but it can be put anywhere you
|
||||||
|
prefer.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgb8b9e8f" class="outline-3">
|
||||||
|
<h3 id="orgb8b9e8f">Expanding from emacs-lisp code</h3>
|
||||||
|
<div class="outline-text-3" id="text-orgb8b9e8f">
|
||||||
|
<p>
|
||||||
|
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 (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="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> 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-org61654fd" class="outline-2">
|
||||||
|
<h2 id="org61654fd">Controlling expansion</h2>
|
||||||
|
<div class="outline-text-2" id="text-org61654fd">
|
||||||
|
</div>
|
||||||
|
<div id="outline-container-orga555023" class="outline-3">
|
||||||
|
<h3 id="orga555023">Eligible snippets</h3>
|
||||||
|
<div class="outline-text-3" id="text-orga555023">
|
||||||
|
<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 class="org-ul">
|
||||||
|
<li><p>
|
||||||
|
Currently loaded snippets tables
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<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…
|
||||||
|
</p></li>
|
||||||
|
|
||||||
|
<li><p>
|
||||||
|
Major mode of the current buffer
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<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.
|
||||||
|
</p></li>
|
||||||
|
|
||||||
|
<li><p>
|
||||||
|
Parent tables
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<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.
|
||||||
|
</p></li>
|
||||||
|
|
||||||
|
<li><p>
|
||||||
|
Buffer-local list of extra modes
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Use <a href="snippet-reference.html#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>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-emacs-lisp"><span class="org-comment-delimiter">;; </span><span class="org-comment">When entering rinari-minor-mode, consider also the snippets in the</span>
|
||||||
|
<span class="org-comment-delimiter">;; </span><span class="org-comment">snippet table "rails-mode"</span>
|
||||||
|
(add-hook 'rinari-minor-mode-hook
|
||||||
|
#'(lambda ()
|
||||||
|
(yas-activate-extra-mode 'rails-mode)))
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="org-ul">
|
||||||
|
<li><p>
|
||||||
|
Buffer-local <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a> variable
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This variable provides finer grained control over what snippets can
|
||||||
|
be expanded in the current buffer. For example, the constant
|
||||||
|
<a href="snippet-reference.html#yas-not-string-or-comment-condition"><code>yas-not-string-or-comment-condition</code></a> has a value that disables
|
||||||
|
snippet expansion inside comments or string literals. See <a href="#orgfd922ab">the
|
||||||
|
condition system</a> for more info.
|
||||||
|
</p></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org075c5ff" class="outline-3">
|
||||||
|
<h3 id="org075c5ff">The condition system <a id="orgfd922ab"></a></h3>
|
||||||
|
<div class="outline-text-3" id="text-org075c5ff">
|
||||||
|
<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 the condition for <code>if</code> to be <code>(not
|
||||||
|
(python-syntax-comment-or-string-p))</code>. But how about <code>while</code>, <code>for</code>,
|
||||||
|
etc? Writing the same condition for all the snippets is just boring.
|
||||||
|
So you can instead set <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a> to <code>(not
|
||||||
|
(python-syntax-comment-or-string-p))</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="src src-emacs-lisp">(add-hook 'python-mode-hook
|
||||||
|
(<span class="org-keyword">lambda</span> ()
|
||||||
|
(<span class="org-keyword">setq</span> yas-buffer-local-condition
|
||||||
|
'(<span class="org-keyword">if</span> (python-syntax-comment-or-string-p)
|
||||||
|
'(require-snippet-condition . force-in-comment)
|
||||||
|
t))))
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
… and for a snippet that you want to expand in comments, specify a
|
||||||
|
condition which evaluates 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 comments.
|
||||||
|
</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-org2f6a9be" class="outline-3">
|
||||||
|
<h3 id="org2f6a9be">Multiples snippet with the same key</h3>
|
||||||
|
<div class="outline-text-3" id="text-org2f6a9be">
|
||||||
|
<p>
|
||||||
|
The rules outlined <a href="#orga555023">above</a> 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="src src-emacs-lisp">(<span class="org-keyword">setq</span> 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-org020d7e4" class="outline-4">
|
||||||
|
<h4 id="org020d7e4">Use the X window system</h4>
|
||||||
|
<div class="outline-text-4" id="text-org020d7e4">
|
||||||
|
|
||||||
|
<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 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.</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.</li>
|
||||||
|
<li>This function can't be used when in a terminal.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org8c16a13" class="outline-4">
|
||||||
|
<h4 id="org8c16a13">Minibuffer prompting</h4>
|
||||||
|
<div class="outline-text-4" id="text-org8c16a13">
|
||||||
|
|
||||||
|
<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-orgb151bf6" class="outline-4">
|
||||||
|
<h4 id="orgb151bf6">Use <code>dropdown-menu.el</code></h4>
|
||||||
|
<div class="outline-text-4" id="text-orgb151bf6">
|
||||||
|
|
||||||
|
<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-orgda9ea36" class="outline-4">
|
||||||
|
<h4 id="orgda9ea36">Roll your own</h4>
|
||||||
|
<div class="outline-text-4" id="text-orgda9ea36">
|
||||||
|
<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" class="status">
|
||||||
|
<hr><p class='creator'>Generated by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 26.0.90 (<a href="http://orgmode.org">Org</a> mode 9.1.2) from 0.12.2-37-gdc6d7d2 (2018-02-18 12:46:06)</p>
|
||||||
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
379
new-style/snippet-menu.html
Normal file
@ -0,0 +1,379 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>YASnippet menu</title>
|
||||||
|
<meta name="generator" content="Org mode" />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
.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 { 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; }
|
||||||
|
.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%; }
|
||||||
|
pre {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
box-shadow: 3px 3px 3px #eee;
|
||||||
|
padding: 8pt;
|
||||||
|
font-family: monospace;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 1.2em;
|
||||||
|
}
|
||||||
|
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;}
|
||||||
|
/* 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-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.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 { display: inline; }
|
||||||
|
.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; }
|
||||||
|
.org-svg { width: 90%; }
|
||||||
|
/*]]>*/-->
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
@licstart The following is the entire license notice for the
|
||||||
|
JavaScript code in this tag.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2017 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The JavaScript code in this tag is free software: you can
|
||||||
|
redistribute it and/or modify it under the terms of the GNU
|
||||||
|
General Public License (GNU GPL) as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||||
|
|
||||||
|
As additional permission under GNU GPL version 3 section 7, you
|
||||||
|
may distribute non-source (e.g., minimized or compacted) forms of
|
||||||
|
that code without the copy of the GNU GPL normally required by
|
||||||
|
section 4, provided you include this license notice and a URL
|
||||||
|
through which recipients can access the Corresponding Source.
|
||||||
|
|
||||||
|
|
||||||
|
@licend The above is the entire license notice
|
||||||
|
for the JavaScript code in this tag.
|
||||||
|
*/
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
function CodeHighlightOn(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(null != target) {
|
||||||
|
elem.cacheClassElem = elem.className;
|
||||||
|
elem.cacheClassTarget = target.className;
|
||||||
|
target.className = "code-highlighted";
|
||||||
|
elem.className = "code-highlighted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function CodeHighlightOff(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(elem.cacheClassElem)
|
||||||
|
elem.className = elem.cacheClassElem;
|
||||||
|
if(elem.cacheClassTarget)
|
||||||
|
target.className = elem.cacheClassTarget;
|
||||||
|
}
|
||||||
|
/*]]>*///-->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="preamble" class="status">
|
||||||
|
<nav>
|
||||||
|
<ul class="center">
|
||||||
|
<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 border">Snippet
|
||||||
|
<ul id="snippet-submenu">
|
||||||
|
<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'>Menu</span>
|
||||||
|
</ul>
|
||||||
|
<li> <a href="faq.html">FAQ</a>
|
||||||
|
<li> <a href="snippet-reference.html">Reference</a>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div id="content">
|
||||||
|
<h1 class="title">YASnippet menu</h1>
|
||||||
|
<div id="table-of-contents">
|
||||||
|
<h2>Table of Contents</h2>
|
||||||
|
<div id="text-table-of-contents">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org6005667">Loading snippets from menu</a></li>
|
||||||
|
<li><a href="#orgc3fcfa2">Snippet menu behavior</a></li>
|
||||||
|
<li><a href="#org047b0f9">Controlling indenting</a></li>
|
||||||
|
<li><a href="#orgd55cb43">Prompting method</a></li>
|
||||||
|
<li><a href="#orgb8689fa">Misc</a></li>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<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-org6005667" class="outline-2">
|
||||||
|
<h2 id="org6005667">Loading snippets from menu</h2>
|
||||||
|
<div class="outline-text-2" id="text-org6005667">
|
||||||
|
<p>
|
||||||
|
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="snippet-reference.html#yas-reload-all"><code>yas-reload-all</code></a>
|
||||||
|
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-orgc3fcfa2" class="outline-2">
|
||||||
|
<h2 id="orgc3fcfa2">Snippet menu behavior</h2>
|
||||||
|
<div class="outline-text-2" id="text-orgc3fcfa2">
|
||||||
|
<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-org047b0f9" class="outline-2">
|
||||||
|
<h2 id="org047b0f9">Controlling indenting</h2>
|
||||||
|
<div class="outline-text-2" id="text-org047b0f9">
|
||||||
|
<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>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgd55cb43" class="outline-2">
|
||||||
|
<h2 id="orgd55cb43">Prompting method</h2>
|
||||||
|
<div class="outline-text-2" id="text-orgd55cb43">
|
||||||
|
<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>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgb8689fa" class="outline-2">
|
||||||
|
<h2 id="orgb8689fa">Misc</h2>
|
||||||
|
<div class="outline-text-2" id="text-orgb8689fa">
|
||||||
|
<p>
|
||||||
|
The "Misc" submenu contains options to control the values of more
|
||||||
|
variables.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="postamble" class="status">
|
||||||
|
<hr><p class='creator'>Generated by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 26.0.90 (<a href="http://orgmode.org">Org</a> mode 9.1.2) from 0.12.2-37-gdc6d7d2 (2018-02-18 12:46:06)</p>
|
||||||
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
455
new-style/snippet-organization.html
Normal file
@ -0,0 +1,455 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Organizing snippets</title>
|
||||||
|
<meta name="generator" content="Org mode" />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
.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 { 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; }
|
||||||
|
.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%; }
|
||||||
|
pre {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
box-shadow: 3px 3px 3px #eee;
|
||||||
|
padding: 8pt;
|
||||||
|
font-family: monospace;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 1.2em;
|
||||||
|
}
|
||||||
|
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;}
|
||||||
|
/* 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-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.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 { display: inline; }
|
||||||
|
.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; }
|
||||||
|
.org-svg { width: 90%; }
|
||||||
|
/*]]>*/-->
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheets/manual.css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
@licstart The following is the entire license notice for the
|
||||||
|
JavaScript code in this tag.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2017 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The JavaScript code in this tag is free software: you can
|
||||||
|
redistribute it and/or modify it under the terms of the GNU
|
||||||
|
General Public License (GNU GPL) as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||||
|
|
||||||
|
As additional permission under GNU GPL version 3 section 7, you
|
||||||
|
may distribute non-source (e.g., minimized or compacted) forms of
|
||||||
|
that code without the copy of the GNU GPL normally required by
|
||||||
|
section 4, provided you include this license notice and a URL
|
||||||
|
through which recipients can access the Corresponding Source.
|
||||||
|
|
||||||
|
|
||||||
|
@licend The above is the entire license notice
|
||||||
|
for the JavaScript code in this tag.
|
||||||
|
*/
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
function CodeHighlightOn(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(null != target) {
|
||||||
|
elem.cacheClassElem = elem.className;
|
||||||
|
elem.cacheClassTarget = target.className;
|
||||||
|
target.className = "code-highlighted";
|
||||||
|
elem.className = "code-highlighted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function CodeHighlightOff(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(elem.cacheClassElem)
|
||||||
|
elem.className = elem.cacheClassElem;
|
||||||
|
if(elem.cacheClassTarget)
|
||||||
|
target.className = elem.cacheClassTarget;
|
||||||
|
}
|
||||||
|
/*]]>*///-->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="preamble" class="status">
|
||||||
|
<nav>
|
||||||
|
<ul class="center">
|
||||||
|
<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 border">Snippet
|
||||||
|
<ul id="snippet-submenu">
|
||||||
|
<li> <span class='current'>Organization</span>
|
||||||
|
<li> <a href="snippet-expansion.html">Expansion</a>
|
||||||
|
<li> <a href="snippet-development.html">Development</a>
|
||||||
|
<li> <a href="snippet-menu.html">Menu</a>
|
||||||
|
</ul>
|
||||||
|
<li> <a href="faq.html">FAQ</a>
|
||||||
|
<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">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org91b0471">Basic structure</a></li>
|
||||||
|
<li><a href="#org10ee311">Setting up <code>yas-snippet-dirs</code></a></li>
|
||||||
|
<li><a href="#org7468fa9">The <code>.yas-parents</code> file</a></li>
|
||||||
|
<li><a href="#orgac3b0a5"><span class="todo TODO">TODO</span> The <code>.yas-make-groups</code> file</a></li>
|
||||||
|
<li><a href="#orge57abf6">The <code>.yas-setup.el</code> file</a></li>
|
||||||
|
<li><a href="#org40a5619">The <code>.yas-compiled-snippet.el</code> file</a></li>
|
||||||
|
<li><a href="#org2f7147a">The <code>.yas-skip</code> file</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org91b0471" class="outline-2">
|
||||||
|
<h2 id="org91b0471">Basic structure</h2>
|
||||||
|
<div class="outline-text-2" id="text-org91b0471">
|
||||||
|
<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 mode names.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre class="example">
|
||||||
|
.
|
||||||
|
|-- c-mode
|
||||||
|
| `-- printf
|
||||||
|
|-- java-mode
|
||||||
|
| `-- println
|
||||||
|
`-- text-mode
|
||||||
|
|-- email
|
||||||
|
`-- 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.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org10ee311" class="outline-2">
|
||||||
|
<h2 id="org10ee311">Setting up <code>yas-snippet-dirs</code></h2>
|
||||||
|
<div class="outline-text-2" id="text-org10ee311">
|
||||||
|
<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 default considers:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<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:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-emacs-lisp"><span class="org-comment-delimiter">;; </span><span class="org-comment">Develop in ~/emacs.d/mysnippets, but also</span>
|
||||||
|
<span class="org-comment-delimiter">;; </span><span class="org-comment">try out snippets in ~/Downloads/interesting-snippets</span>
|
||||||
|
(<span class="org-keyword">setq</span> yas-snippet-dirs '(<span class="org-string">"~/emacs.d/mysnippets"</span>
|
||||||
|
<span class="org-string">"~/Downloads/interesting-snippets"</span>))
|
||||||
|
|
||||||
|
<span class="org-comment-delimiter">;; </span><span class="org-comment">OR, keeping YASnippet defaults try out ~/Downloads/interesting-snippets</span>
|
||||||
|
(<span class="org-keyword">setq</span> yas-snippet-dirs (append yas-snippet-dirs
|
||||||
|
'(<span class="org-string">"~/Downloads/interesting-snippets"</span>)))
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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-org7468fa9" class="outline-2">
|
||||||
|
<h2 id="org7468fa9">The <code>.yas-parents</code> file</h2>
|
||||||
|
<div class="outline-text-2" id="text-org7468fa9">
|
||||||
|
<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.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre class="example">
|
||||||
|
.
|
||||||
|
|-- c-mode
|
||||||
|
| |-- .yas-parents # contains "cc-mode text-mode"
|
||||||
|
| `-- printf
|
||||||
|
|-- cc-mode
|
||||||
|
| |-- for
|
||||||
|
| `-- while
|
||||||
|
|-- java-mode
|
||||||
|
| |-- .yas-parents # contains "cc-mode text-mode"
|
||||||
|
| `-- println
|
||||||
|
`-- text-mode
|
||||||
|
|-- email
|
||||||
|
`-- time
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="outline-container-orgac3b0a5" class="outline-2">
|
||||||
|
<h2 id="orgac3b0a5"><span class="todo TODO">TODO</span> The <code>.yas-make-groups</code> file</h2>
|
||||||
|
<div class="outline-text-2" id="text-orgac3b0a5">
|
||||||
|
<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.html">the menu</a> is organized much more
|
||||||
|
cleanly:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="figure">
|
||||||
|
<p><img src="./images/menu-groups.png" alt="menu-groups.png" />
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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
|
||||||
|
| |-- each
|
||||||
|
| `-- ...
|
||||||
|
|-- control structure
|
||||||
|
| |-- forin
|
||||||
|
| `-- ...
|
||||||
|
|-- definitions
|
||||||
|
| `-- ...
|
||||||
|
`-- general
|
||||||
|
`-- ...
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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-orge57abf6" class="outline-2">
|
||||||
|
<h2 id="orge57abf6">The <code>.yas-setup.el</code> file</h2>
|
||||||
|
<div class="outline-text-2" id="text-orge57abf6">
|
||||||
|
<p>
|
||||||
|
If there is file named <code>.yas-setup.el</code> in a mode's snippet
|
||||||
|
subdirectory, it is loaded along with the snippets. Utility
|
||||||
|
functions used by the snippets can be put here.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org40a5619" class="outline-2">
|
||||||
|
<h2 id="org40a5619">The <code>.yas-compiled-snippet.el</code> file</h2>
|
||||||
|
<div class="outline-text-2" id="text-org40a5619">
|
||||||
|
<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>
|
||||||
|
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-org2f7147a" class="outline-2">
|
||||||
|
<h2 id="org2f7147a">The <code>.yas-skip</code> file</h2>
|
||||||
|
<div class="outline-text-2" id="text-org2f7147a">
|
||||||
|
<p>
|
||||||
|
A <code>.yas-skip</code> file in a mode's snippet subdirectory tells YASnippet
|
||||||
|
not to load snippets from there.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="postamble" class="status">
|
||||||
|
<hr><p class='creator'>Generated by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 26.0.90 (<a href="http://orgmode.org">Org</a> mode 9.1.2) from 0.12.2-37-gdc6d7d2 (2018-02-18 12:46:06)</p>
|
||||||
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
1934
new-style/snippet-reference.html
Normal file
70
new-style/stylesheets/manual.css
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
.center { margin-left: auto; margin-right: auto; text-align: center; }
|
||||||
|
.current {
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #E0E8F0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body { background-color: #E4F0F4 }
|
||||||
|
div#content {
|
||||||
|
max-width: 20cm;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav li {
|
||||||
|
vertical-align: top;
|
||||||
|
|
||||||
|
display: inline;
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
nav > ul > li {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
#snippet-submenu {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
li.border {
|
||||||
|
border: solid;
|
||||||
|
border-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre, code{ background-color: #F3F5F7; }
|
||||||
|
code {
|
||||||
|
/* http://neugierig.org/software/chromium/notes/2009/09/monospace-fonts-workaround.html */
|
||||||
|
font-family: WorkAroundWebKitAndMozilla, monospace;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Styles for htmlize.el fontification. */
|
||||||
|
|
||||||
|
.org-comment { color: #005000; } /* font-lock-comment-face */
|
||||||
|
.org-keyword { font-weight: bold; } /* font-lock-keyword-face */
|
||||||
|
.org-string { color: #8b0000; } /* font-lock-string-face */
|
||||||
|
.org-warning { color: #ff8c00;
|
||||||
|
font-weight: bold; } /* warning */
|
||||||
|
.org-warning-1 { color: #ff0000;
|
||||||
|
font-weight: bold; } /* font-lock-warning-face */
|
||||||
|
.org-preprocessor { color: #483d8b; } /* font-lock-preprocessor-face */
|
||||||
|
.org-constant { color: #008b8b; } /* font-lock-constant-face */
|
||||||
|
.org-function-name { color: #0000ff; } /* font-lock-function-name-face */
|
||||||
|
.org-type { color: #228b22; } /* font-lock-type-face */
|
||||||
|
.org-variable-name { color: #a0522d; } /* font-lock-variable-name-face */
|
||||||
|
|
||||||
|
.org-rst-adornment { color: #a020f0; } /* rst-adornment */
|
||||||
|
.org-rst-block { color: #a020f0; } /* rst-block */
|
||||||
|
.org-rst-comment { color: #b22222; } /* rst-comment */
|
||||||
|
.org-rst-definition { color: #0000ff; } /* rst-definition */
|
||||||
|
.org-rst-directive { color: #483d8b; } /* rst-directive */
|
||||||
|
.org-rst-emphasis1 { font-style: italic; } /* rst-emphasis1 */
|
||||||
|
.org-rst-emphasis2 { font-weight: bold; } /* rst-emphasis2 */
|
||||||
|
.org-rst-external { color: #228b22; } /* rst-external */
|
||||||
|
.org-rst-level-1 { background-color: #d9d9d9; } /* rst-level-1 */
|
||||||
|
.org-rst-level-2 { background-color: #c7c7c7; } /* rst-level-2 */
|
||||||
|
.org-rst-level-3 { background-color: #b5b5b5; } /* rst-level-3 */
|
||||||
|
.org-rst-level-4 { background-color: #a3a3a3; } /* rst-level-4 */
|
||||||
|
.org-rst-level-5 { background-color: #919191; } /* rst-level-5 */
|
||||||
|
.org-rst-level-6 { background-color: #7f7f7f; } /* rst-level-6 */
|
||||||
|
.org-rst-literal { color: #8b2252; } /* rst-literal */
|
||||||
|
.org-rst-reference { color: #a0522d; } /* rst-reference */
|
||||||
|
.org-rst-transition { color: #a020f0; } /* rst-transition */
|