summaryrefslogtreecommitdiff
path: root/doc/snippet-menu.org
blob: fee3a196c434151ede33a64f78af6905d2a241cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#+SETUPFILE: org-setup.inc

#+TITLE: YASnippet menu

When [[sym:yas-minor-mode][=yas-minor-mode=]] is active, YASnippet will setup a menu just after
the "Buffers" menu in the menubar.

In this menu, you can find

-  The currently loaded snippet definitions, organized by major mode,
   and optional grouping.

-  A rundown of the most common commands, (followed by their
   keybindings) including commands to load directories and reload all
   snippet definitions.

-  A series of submenus for customizing and exploring YASnippet
   behavior.

[[./images/menu-1.png]]

* Loading snippets from menu

Invoking "Load snippets..." from the menu invokes [[sym:yas-load-directory][=yas-load-directory=]]
and prompts you for a snippet directory hierarchy to load.

Also useful is the "Reload everything" item to invoke [[sym:yas-reload-all][=yas-reload-all=]]
which uncondionally reloads all the snippets directories defined in
[[sym:yas-snippet-dirs][=yas-snippet-dirs=]] and rebuilds the menus.

* Snippet menu behavior

YASnippet will list in this section all the loaded snippet definitions
organized by snippet table name.

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.

You can however, customize variable [[sym:yas-visit-from-menu][=yas-visit-from-menu=]] to be =t=
which will take you to the snippet definition file when you select it
from the menu.

If you want the menu show only snippet tables whose name corresponds to
a "real" major mode. You do this by setting [[sym:yas-use-menu][=yas-use-menu=]] to
'=real-modes=.

Finally, to have the menu show only the tables for the currently active
mode, set [[sym:yas-use-menu][=yas-use-menu=]] to =abbreviate=.

These customizations can also be found in the menu itself, under the
"Snippet menu behavior" submenu.

* Controlling indenting

The "Indenting" submenu contains options to control the values of
[[sym:yas-indent-line][=yas-indent-line=]] and [[sym:yas-also-auto-indent-first-line][=yas-also-auto-indent-first-line=]]. See
[[./snippet-development.org][Writing snippets]].

* Prompting method

The "Prompting method" submenu contains options to control the value of
[[sym:yas-prompt-functions][=yas-prompt-functions=]]. See [[./snippet-expansion.org][Expanding snippets]].

* Misc

The "Misc" submenu contains options to control the values of more
variables.