mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-02-04 06:32:24 +00:00
@@ -4,7 +4,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>Expanding snippets</title>
|
||||
<!-- 2015-09-24 Thu 21:14 -->
|
||||
<!-- 2016-04-30 Sat 22:37 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="Org-mode" />
|
||||
<style type="text/css">
|
||||
@@ -167,7 +167,11 @@ for the JavaScript code in this tag.
|
||||
<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-2">Insert at point</a>
|
||||
<ul>
|
||||
<li><a href="#sec-1-2-1">Inserting region or register contents into snippet</a></li>
|
||||
</ul>
|
||||
</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>
|
||||
@@ -253,9 +257,9 @@ When <a href="snippet-reference.html#yas-minor-mode"><code>yas-minor-mode</code>
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp">(define-key yas-minor-mode-map (kbd "<tab>") nil)
|
||||
(define-key yas-minor-mode-map (kbd "TAB") nil)
|
||||
(define-key yas-minor-mode-map (kbd "<the new key>") 'yas-expand)
|
||||
<pre 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-expand)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -325,6 +329,26 @@ 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-sec-1-2-1" class="outline-4">
|
||||
<h4 id="sec-1-2-1">Inserting region or register contents into snippet</h4>
|
||||
<div class="outline-text-4" id="text-1-2-1">
|
||||
<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
|
||||
<i><code>yas-insert-snippet</code></i>. 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-sec-1-3" class="outline-3">
|
||||
@@ -447,11 +471,11 @@ mode. Typically, you call this from a minor mode hook, for example:
|
||||
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp">;; When entering rinari-minor-mode, consider also the snippets in the
|
||||
;; snippet table "rails-mode"
|
||||
<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)))
|
||||
#'(<span class="org-keyword">lambda</span> ()
|
||||
(yas-activate-extra-mode 'rails-mode)))
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -499,11 +523,11 @@ inside a comment? Set <a href="snippet-reference.html#yas-buffer-local-condition
|
||||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-emacs-lisp">(add-hook 'python-mode-hook
|
||||
(lambda ()
|
||||
(setq yas-buffer-local-condition
|
||||
'(if (python-in-string/comment)
|
||||
'(require-snippet-condition . force-in-comment)
|
||||
t))))
|
||||
(<span class="org-keyword">lambda</span> ()
|
||||
(setq yas-buffer-local-condition
|
||||
'(<span class="org-keyword">if</span> (python-in-string/comment)
|
||||
'(require-snippet-condition . force-in-comment)
|
||||
t))))
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -632,7 +656,7 @@ See the documentation on variable <a href="snippet-reference.html#yas-prompt-fun
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.4.91.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10) on from 7703a55ac416a131dec45fa6a1e0ec1e31adf760
|
||||
<hr><p class='creator'>Generated by <a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.5.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10) on from df229b9ab8db87fe5a1133365fdc299a65f9be86
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user