mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
643 lines
20 KiB
HTML
643 lines
20 KiB
HTML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
<head>
|
|
<title>Expanding snippets</title>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
|
<meta name="title" content="Expanding snippets"/>
|
|
<meta name="generator" content="Org-mode"/>
|
|
<meta name="generated" content="2014-05-11T19:37-0400"/>
|
|
<meta name="author" content=""/>
|
|
<meta name="description" content=""/>
|
|
<meta name="keywords" content=""/>
|
|
<style type="text/css">
|
|
<!--/*--><![CDATA[/*><!--*/
|
|
html { font-family: Times, serif; font-size: 12pt; }
|
|
.title { text-align: center; }
|
|
.todo { color: red; }
|
|
.done { color: green; }
|
|
.tag { background-color: #add8e6; font-weight:normal }
|
|
.target { }
|
|
.timestamp { color: #bebebe; }
|
|
.timestamp-kwd { color: #5f9ea0; }
|
|
.right {margin-left:auto; margin-right:0px; text-align:right;}
|
|
.left {margin-left:0px; margin-right:auto; text-align:left;}
|
|
.center {margin-left:auto; margin-right:auto; text-align:center;}
|
|
p.verse { margin-left: 3% }
|
|
pre {
|
|
border: 1pt solid #AEBDCC;
|
|
background-color: #F3F5F7;
|
|
padding: 5pt;
|
|
font-family: courier, monospace;
|
|
font-size: 90%;
|
|
overflow:auto;
|
|
}
|
|
table { border-collapse: collapse; }
|
|
td, th { vertical-align: top; }
|
|
th.right { text-align:center; }
|
|
th.left { text-align:center; }
|
|
th.center { text-align:center; }
|
|
td.right { text-align:right; }
|
|
td.left { text-align:left; }
|
|
td.center { text-align:center; }
|
|
dt { font-weight: bold; }
|
|
div.figure { padding: 0.5em; }
|
|
div.figure p { text-align: center; }
|
|
div.inlinetask {
|
|
padding:10px;
|
|
border:2px solid gray;
|
|
margin:10px;
|
|
background: #ffffcc;
|
|
}
|
|
textarea { overflow-x: auto; }
|
|
.linenr { font-size:smaller }
|
|
.code-highlighted {background-color:#ffff00;}
|
|
.org-info-js_info-navigation { border-style:none; }
|
|
#org-info-js_console-label { font-size:10px; font-weight:bold;
|
|
white-space:nowrap; }
|
|
.org-info-js_search-highlight {background-color:#ffff00; color:#000000;
|
|
font-weight:bold; }
|
|
/*]]>*/-->
|
|
</style>
|
|
<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-2013 Free Software Foundation, Inc.
|
|
|
|
The JavaScript code in this tag is free software: you can
|
|
redistribute it and/or modify it under the terms of the GNU
|
|
General Public License (GNU GPL) as published by the Free Software
|
|
Foundation, either version 3 of the License, or (at your option)
|
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
|
|
|
As additional permission under GNU GPL version 3 section 7, you
|
|
may distribute non-source (e.g., minimized or compacted) forms of
|
|
that code without the copy of the GNU GPL normally required by
|
|
section 4, provided you include this license notice and a URL
|
|
through which recipients can access the Corresponding Source.
|
|
|
|
|
|
@licend The above is the entire license notice
|
|
for the JavaScript code in this tag.
|
|
*/
|
|
<!--/*--><![CDATA[/*><!--*/
|
|
function CodeHighlightOn(elem, id)
|
|
{
|
|
var target = document.getElementById(id);
|
|
if(null != target) {
|
|
elem.cacheClassElem = elem.className;
|
|
elem.cacheClassTarget = target.className;
|
|
target.className = "code-highlighted";
|
|
elem.className = "code-highlighted";
|
|
}
|
|
}
|
|
function CodeHighlightOff(elem, id)
|
|
{
|
|
var target = document.getElementById(id);
|
|
if(elem.cacheClassElem)
|
|
elem.className = elem.cacheClassElem;
|
|
if(elem.cacheClassTarget)
|
|
target.className = elem.cacheClassTarget;
|
|
}
|
|
/*]]>*///-->
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<div id="preamble">
|
|
<nav>
|
|
<ul class="center">
|
|
<li> <a href="index.html">Overview</a>
|
|
<li> <a href="https://github.com/capitaomorte/yasnippet/blob/master/README.mdown">
|
|
Intro and Tutorial</a>
|
|
<li class="center">Snippet
|
|
<ul>
|
|
<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">Expanding snippets</h1>
|
|
|
|
|
|
<p>
|
|
This section describes how YASnippet chooses snippets for expansion at point.
|
|
</p>
|
|
<p>
|
|
Maybe, you'll want some snippets to be expanded in a particular
|
|
mode, or only under certain conditions, or be prompted using
|
|
</p>
|
|
|
|
<div id="table-of-contents">
|
|
<h2>Table of Contents</h2>
|
|
<div id="text-table-of-contents">
|
|
<ul>
|
|
<li><a href="#sec-1">Triggering expansion</a>
|
|
<ul>
|
|
<li><a href="#sec-1-1">Trigger key</a>
|
|
<ul>
|
|
<li><a href="#sec-1-1-1">Fallback behaviour</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#sec-1-2">Insert at point</a></li>
|
|
<li><a href="#sec-1-3">Snippet keybinding</a></li>
|
|
<li><a href="#sec-1-4">Expanding from the menu</a></li>
|
|
<li><a href="#sec-1-5">Expanding with <code>hippie-expand</code></a></li>
|
|
<li><a href="#sec-1-6">Expanding from emacs-lisp code</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#sec-2">Controlling expansion</a>
|
|
<ul>
|
|
<li><a href="#sec-2-1">Eligible snippets</a></li>
|
|
<li><a href="#sec-2-2">The condition system</a></li>
|
|
<li><a href="#sec-2-3">Multiples snippet with the same key</a>
|
|
<ul>
|
|
<li><a href="#sec-2-3-1">Use the X window system</a></li>
|
|
<li><a href="#sec-2-3-2">Minibuffer prompting</a></li>
|
|
<li><a href="#sec-2-3-3">Use <code>dropdown-menu.el</code></a></li>
|
|
<li><a href="#sec-2-3-4">Roll your own</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-1" class="outline-2">
|
|
<h2 id="sec-1">Triggering expansion</h2>
|
|
<div class="outline-text-2" id="text-1">
|
|
|
|
|
|
<p>
|
|
You can use YASnippet to expand snippets in different ways:
|
|
</p>
|
|
<ul>
|
|
<li>When <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> is active:
|
|
<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-1-1" class="outline-3">
|
|
<h3 id="sec-1-1">Trigger key</h3>
|
|
<div class="outline-text-3" id="text-1-1">
|
|
|
|
|
|
<p>
|
|
<a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> tries to expand a <i>snippet abbrev</i> (also known as
|
|
<i>snippet key</i>) before point.
|
|
</p>
|
|
<p>
|
|
When <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code></a> is enabled, it binds <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> to <code>TAB</code> and
|
|
<code><tab></code> by default, however, you can freely set it to some other key:
|
|
</p>
|
|
|
|
|
|
|
|
<pre class="example">(define-key yas-minor-mode-map (kbd "<tab>") nil)
|
|
(define-key yas-minor-mode-map (kbd "TAB") nil)
|
|
(define-key yas-minor-mode-map (kbd "<the new key>") 'yas-expand)
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
To enable the YASnippet minor mode in all buffers globally use the
|
|
command <a href="snippet-reference.html#yas-global-mode"><code>yas-global-mode</code></a>. This will enable a modeline indicator,
|
|
<code>yas</code>:
|
|
</p>
|
|
<p>
|
|
<img src="./images/minor-mode-indicator.png" alt="./images/minor-mode-indicator.png" />
|
|
</p>
|
|
<p>
|
|
When you use <a href="snippet-reference.html#yas-global-mode"><code>yas-global-mode</code></a> you can also selectively disable
|
|
YASnippet in some buffers by setting the buffer-local variable
|
|
<a href="snippet-reference.html#yas-dont-active"><code>yas-dont-active</code></a> in the buffer's mode hook.
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-1-1" class="outline-4">
|
|
<h4 id="sec-1-1-1">Fallback behaviour</h4>
|
|
<div class="outline-text-4" id="text-1-1-1">
|
|
|
|
|
|
<p>
|
|
<a href="snippet-reference.html#yas-fallback-behaviour"><code>yas-fallback-behaviour</code></a> is a customization variable bound to
|
|
'<code>call-other-command</code> by default. If <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> failed to find any
|
|
suitable snippet to expand, it will disable the minor mode temporarily
|
|
and find if there's any other command bound to the same key.
|
|
</p>
|
|
<p>
|
|
If found, the command will be called. Usually this works very well
|
|
–when there's a snippet, expand it, otherwise, call whatever command
|
|
originally bind to the trigger key.
|
|
</p>
|
|
<p>
|
|
However, you can change this behavior by customizing the
|
|
<a href="snippet-reference.html#yas-fallback-behavior"><code>yas-fallback-behavior</code></a> variable. If you set this variable to
|
|
'<code>return-nil</code>, it will return <code>nil</code> instead of trying to call the
|
|
<i>original</i> command when no snippet is found.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-2" class="outline-3">
|
|
<h3 id="sec-1-2">Insert at point</h3>
|
|
<div class="outline-text-3" id="text-1-2">
|
|
|
|
|
|
<p>
|
|
The command <a href="#yas-insert-snippet"><code>yas-insert-snippet</code></a> lets you insert snippets at point
|
|
<i>for your current major mode</i>. It prompts you for the snippet key
|
|
first, and then for a snippet template if more than one template
|
|
exists for the same key.
|
|
</p>
|
|
<p>
|
|
The list presented contains the snippets that can be inserted at point,
|
|
according to the condition system. If you want to see all applicable
|
|
snippets for the major mode, prefix this command with <code>C-u</code>.
|
|
</p>
|
|
<p>
|
|
The prompting methods used are again controlled by
|
|
<a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-3" class="outline-3">
|
|
<h3 id="sec-1-3">Snippet keybinding</h3>
|
|
<div class="outline-text-3" id="text-1-3">
|
|
|
|
|
|
<p>
|
|
See the section of the <code># binding:</code> directive in
|
|
<a href="./snippet-development.html">Writing Snippets</a>.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-4" class="outline-3">
|
|
<h3 id="sec-1-4">Expanding from the menu</h3>
|
|
<div class="outline-text-3" id="text-1-4">
|
|
|
|
|
|
<p>
|
|
See <a href="./snippet-menu.html">the YASnippet Menu</a>.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-1-5" class="outline-3">
|
|
<h3 id="sec-1-5">Expanding with <code>hippie-expand</code></h3>
|
|
<div class="outline-text-3" id="text-1-5">
|
|
|
|
|
|
<p>
|
|
To integrate with <code>hippie-expand</code>, just put
|
|
<a href="snippet-reference.html#yas-hippie-try-expand"><code>yas-hippie-try-expand</code></a> in
|
|
<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-1-6" class="outline-3">
|
|
<h3 id="sec-1-6">Expanding from emacs-lisp code</h3>
|
|
<div class="outline-text-3" id="text-1-6">
|
|
|
|
|
|
<p>
|
|
Sometimes you might want to expand a snippet directly from you own
|
|
elisp code. You should call
|
|
<a href="snippet-reference.html#yas-expand-snippet"><code>yas-expand-snippet</code></a> instead of
|
|
<a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> in this case.
|
|
</p>
|
|
<p>
|
|
As with expanding from the menubar, the condition system and multiple
|
|
candidates doesn't affect expansion. In fact, expanding from the
|
|
YASnippet menu has the same effect of evaluating the follow code:
|
|
</p>
|
|
|
|
|
|
|
|
<pre class="example">(yas-expand-snippet template)
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
See the internal documentation on <a href="snippet-reference.html#yas-expand-snippet"><code>yas-expand-snippet</code></a> for more
|
|
information.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-2" class="outline-2">
|
|
<h2 id="sec-2">Controlling expansion</h2>
|
|
<div class="outline-text-2" id="text-2">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-2-1" class="outline-3">
|
|
<h3 id="sec-2-1">Eligible snippets</h3>
|
|
<div class="outline-text-3" id="text-2-1">
|
|
|
|
|
|
<p>
|
|
YASnippet does quite a bit of filtering to find out which snippets are
|
|
eligible for expanding at the current cursor position.
|
|
</p>
|
|
<p>
|
|
In particular, the following things matter:
|
|
</p>
|
|
<ul>
|
|
<li>Currently loaded snippets tables
|
|
|
|
<p>
|
|
These are loaded from a directory hierarchy in your file system. See
|
|
<a href="./snippet-organization.html">Organizing Snippets</a>. They are named
|
|
after major modes like <code>html-mode</code>, <code>ruby-mode</code>, etc…
|
|
</p>
|
|
</li>
|
|
<li>Major mode of the current buffer
|
|
|
|
<p>
|
|
If the currrent major mode matches one of the loaded snippet tables,
|
|
then all that table's snippets are considered for expansion. Use
|
|
<code>M-x describe-variable RET major-mode RET</code> to find out which major
|
|
mode you are in currently.
|
|
</p>
|
|
</li>
|
|
<li>Parent tables
|
|
|
|
<p>
|
|
Snippet tables defined as the parent of some other eligible table are
|
|
also considered. This works recursively, i.e. parents of parents of
|
|
eligible tables are also considered.
|
|
</p>
|
|
</li>
|
|
<li>Buffer-local list of extra modes
|
|
|
|
<p>
|
|
Use <a href="#yas-activate-extra-mode"><code>yas-activate-extra-mode</code></a> to
|
|
consider snippet tables whose name does not correspond to a major
|
|
mode. Typically, you call this from a minor mode hook, for example:
|
|
</p></li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
<pre class="example">;; When entering rinari-minor-mode, consider also the snippets in the
|
|
;; snippet table "rails-mode"
|
|
(add-hook 'rinari-minor-mode-hook
|
|
#'(lambda ()
|
|
(yas-activate-extra-mode 'rails-mode)))
|
|
</pre>
|
|
|
|
|
|
<ul>
|
|
<li>Buffer-local
|
|
<a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a>
|
|
variable
|
|
|
|
<p>
|
|
This variable provides finer grained control over what snippets can
|
|
be expanded in the current buffer. The default value won't let you
|
|
expand snippets inside comments or string literals for example. See
|
|
The condition system_ for more info.
|
|
</p></li>
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-2-2" class="outline-3">
|
|
<h3 id="sec-2-2">The condition system</h3>
|
|
<div class="outline-text-3" id="text-2-2">
|
|
|
|
|
|
<p>
|
|
Consider this scenario: you are an old Emacs hacker. You like the
|
|
abbrev-way and bind <a href="snippet-reference.html#yas-expand"><code>yas-expand</code></a> to <code>SPC</code>. However, you don't want
|
|
<code>if</code> to be expanded as a snippet when you are typing in a comment
|
|
block or a string (e.g. in <code>python-mode</code>).
|
|
</p>
|
|
<p>
|
|
If you use the <code># condition :</code> directive (see
|
|
<a href="./snippet-development.html">Writing Snippets</a>) you could just specify
|
|
the condition for <code>if</code> to be <code>(not (python-in-string/comment))</code>. But how
|
|
about <code>while</code>, <code>for</code>, etc. ? Writing the same condition for all the
|
|
snippets is just boring. So has a buffer local variable
|
|
<a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a>. You can set this variable to
|
|
<code>(not (python-in-string/comment))</code> in <code>python-mode-hook</code>.
|
|
</p>
|
|
<p>
|
|
Then, what if you really want some particular snippet to expand even
|
|
inside a comment? Set <a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a> like this
|
|
</p>
|
|
|
|
|
|
|
|
<pre class="example">(add-hook 'python-mode-hook
|
|
(lambda ()
|
|
(setq yas-buffer-local-condition
|
|
'(if (python-in-string/comment)
|
|
'(require-snippet-condition . force-in-comment)
|
|
t))))
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
… and specify the condition for a snippet that you're going to expand
|
|
in comment to be evaluated to the symbol <code>force-in-comment</code>. Then it can
|
|
be expanded as you expected, while other snippets like <code>if</code> still can't
|
|
expanded in comment.
|
|
</p>
|
|
<p>
|
|
For the full set of possible conditions, see the documentation for
|
|
<a href="snippet-reference.html#yas-buffer-local-condition"><code>yas-buffer-local-condition</code></a>.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-2-3" class="outline-3">
|
|
<h3 id="sec-2-3">Multiples snippet with the same key</h3>
|
|
<div class="outline-text-3" id="text-2-3">
|
|
|
|
|
|
<p>
|
|
The rules outlined <a href="#sec-2-1">above</a> can return more than
|
|
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>
|
|
|
|
|
|
|
|
<pre class="example">(setq yas-prompt-functions '(yas-x-prompt yas-dropdown-prompt))
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
Currently there are some alternatives solution with YASnippet.
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-2-3-1" class="outline-4">
|
|
<h4 id="sec-2-3-1">Use the X window system</h4>
|
|
<div class="outline-text-4" id="text-2-3-1">
|
|
|
|
|
|
<p>
|
|
<img src="./images/x-menu.png" alt="./images/x-menu.png" />
|
|
</p>
|
|
<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>
|
|
<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-2-3-2" class="outline-4">
|
|
<h4 id="sec-2-3-2">Minibuffer prompting</h4>
|
|
<div class="outline-text-4" id="text-2-3-2">
|
|
|
|
|
|
<p>
|
|
<img src="./images/ido-menu.png" alt="./images/ido-menu.png" />
|
|
</p>
|
|
<p>
|
|
You can use functions <a href="snippet-reference.html#yas-completing-prompt"><code>yas-completing-prompt</code></a> for the classic emacs
|
|
completion method or <a href="snippet-reference.html#yas-ido-prompt"><code>yas-ido-prompt</code></a> for a much nicer looking method.
|
|
The best way is to try it. This works in a terminal.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-2-3-3" class="outline-4">
|
|
<h4 id="sec-2-3-3">Use <code>dropdown-menu.el</code></h4>
|
|
<div class="outline-text-4" id="text-2-3-3">
|
|
|
|
|
|
<p>
|
|
<img src="./images/dropdown-menu.png" alt="./images/dropdown-menu.png" />
|
|
</p>
|
|
<p>
|
|
The function <a href="snippet-reference.html#yas-dropdown-prompt"><code>yas-dropdown-prompt</code></a> can also be placed in the
|
|
<a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a> list.
|
|
</p>
|
|
<p>
|
|
This works in both window system and terminal and is customizable, you
|
|
can use <code>C-n</code>, <code>C-p</code> to navigate, <code>q</code> to quit and even press <code>6</code> as a
|
|
shortcut to select the 6th candidate.
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="outline-container-2-3-4" class="outline-4">
|
|
<h4 id="sec-2-3-4">Roll your own</h4>
|
|
<div class="outline-text-4" id="text-2-3-4">
|
|
|
|
|
|
<p>
|
|
See the documentation on variable <a href="snippet-reference.html#yas-prompt-functions"><code>yas-prompt-functions</code></a>
|
|
</p></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="postamble">
|
|
<hr><p class='creator'>Generated by <a href="http://orgmode.org">Org</a> version 7.9.3f with <a href="http://www.gnu.org/software/emacs/">Emacs</a> version 24 on 2014-05-11T19:37-0400 from fe288a156c063666d9c6613b6eea0ed5a515a86b
|
|
</p>
|
|
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|