branch: master
commit c1b2cb7c5e108f68268f4cff1081aebce2cbbaf5
Author: Noam Postavsky <[email protected]>
Commit: Noam Postavsky <[email protected]>
Improve documentation for new register option
* doc/snippet-expansion.org: Add new section about
yas-wrap-around-region.
* yasnippet.el (yas-wrap-around-region): Improve docstring.
---
doc/snippet-expansion.org | 13 +++++++++++++
yasnippet.el | 4 +++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/doc/snippet-expansion.org b/doc/snippet-expansion.org
index fdc02cc..f57df95 100644
--- a/doc/snippet-expansion.org
+++ b/doc/snippet-expansion.org
@@ -83,6 +83,19 @@ snippets for the major mode, prefix this command with =C-u=.
The prompting methods used are again controlled by
[[sym:yas-prompt-functions][=yas-prompt-functions=]].
+*** Inserting region or register contents into snippet
+
+It's often useful to inject already written text in the middle of a
+snippet. The variable
[[sym:yas-wrap-around-region][=yas-wrap-around-region=]] when to t substitute
+the region contents into the =$0= placeholder of a snippet expanded by
+[[#yas-insert-snippet][=yas-insert-snippet=]]. Setting it to a character
value (e.g. =?0=)
+will insert the contents of corresponding register.
+
+Older (versions 0.9.1 and below) of Yasnippet, supported a setting of
+=cua= that is equivalent to =?0= but only worked with =cua-mode=
+turned on. This setting is still supported for backwards
+compatibility, but is now entirely equivalent to =?0=.
+
** Snippet keybinding
See the section of the =# binding:= directive in
diff --git a/yasnippet.el b/yasnippet.el
index 47618f9..423f58a 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -349,7 +349,9 @@ Any other non-nil value, every submenu is listed."
"What to insert for snippet's $0 field.
If set to a character, insert contents of corresponding register.
-If non-nil insert region contents."
+If non-nil insert region contents. This can be overridden on a
+per-snippet basis. A value of `cua' is considered equivalent to
+`?0' for backwards compatibility."
:type '(choice (character :tag "Insert from register")
(const t :tag "Insert region contents")
(const nil :tag "Don't insert anything")