]> git.donarmstrong.com Git - dactyl.git/blob - common/locale/en-US/autocommands.xml
260eb074b852ca775432a6fc63b62d09933f1862
[dactyl.git] / common / locale / en-US / autocommands.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>
3
4 <!DOCTYPE document SYSTEM "dactyl://content/dtd">
5
6 <document
7     name="autocommands"
8     title="&dactyl.appName; Autocommands"
9     xmlns="&xmlns.dactyl;"
10     xmlns:html="&xmlns.html;">
11
12 <h1 tag="autocommands">Automatic commands</h1>
13 <toc start="2"/>
14
15 <p>
16     Autocommands are a way to automatically execute code when
17     certain events happen.
18 </p>
19
20 <item>
21     <tags>:au :autocmd</tags>
22     <spec>:au<oa>tocmd</oa><oa>!</oa> <oa>events</oa> <oa>filter</oa> <oa>cmd</oa></spec>
23     <description>
24         <p>Execute commands automatically on events.</p>
25
26         <p>
27             When <oa>cmd</oa> is not given, list all commands
28             defined for the given <oa>events</oa> and <oa>filter</oa>.
29             When <oa>!</oa> is given, delete the matching commands
30             rather than listing them.
31         </p>
32
33         <p>
34             When <oa>cmd</oa> is given, add it to the list of commands to be
35             executed when <oa>events</oa> occur for pages matching the
36             comma-separated list of <t>site-filters</t>, <oa>filter</oa>. If the
37             <em>-javascript</em> (short name <em>-js</em>) option is given,
38             <oa>cmd</oa> is interpreted as JavaScript code. Otherwise, it is
39             interpreted as an Ex command.
40         </p>
41
42         <p>
43             If the <em>-group</em>=<a>group</a> flag is given, add this autocmd
44             to the named <t>group</t>. Any filters for <a>group</a> apply in
45             addition to <oa>filter</oa>.
46         </p>
47
48         <p>Available <oa>events</oa>:</p>
49
50         <dl tag="autocommand-list"/>
51
52         <p>
53             For Ex <oa>cmd</oa>s, the following keywords are
54             replaced with the appropriate value before the commands
55             are executed. For JavaScript commands, they may be
56             accessed as ordinary variables, sans angle brackets.
57         </p>
58
59         <dl tag="autocommand-args"/>
60     </description>
61 </item>
62
63 <item>
64 </item>
65
66 <item>
67     <tags>:doautoa :doautoall</tags>
68     <spec>:doautoa<oa>ll</oa> <a>event</a> <oa>url</oa></spec>
69     <description>
70         <p>
71             Apply all <a>event</a> autocommands matching the
72             specified <oa>url</oa> to all buffers. If no
73             <oa>url</oa> is specified use the current URL.
74         </p>
75     </description>
76 </item>
77
78 <item>
79     <tags>:do :doautocmd</tags>
80     <spec>:do<oa>autocmd</oa> <a>event</a> <oa>url</oa></spec>
81     <description>
82         <p>
83             Apply all autocommands matching the specified
84             <oa>url</oa> to the current buffer. If no <oa>url</oa>
85             is specified use the current URL.
86         </p>
87     </description>
88 </item>
89 <h2 tag="autocmd-examples">Examples</h2>
90
91 <p>Enable <em>passthrough</em> mode on all Google sites:</p>
92
93 <code><ex>:autocmd LocationChange</ex> <str delim="">google.com</str> <ex>:normal!</ex> <k name="C-z"/></code>
94
95 <p>Enable <em>passthrough</em> mode on <em>some</em> Google sites:</p>
96
97 <code><ex>:autocmd LocationChange</ex> <str delim="'">^https?://(www|mail)\.google\.com/</str> <ex>:normal!</ex> <k name="C-z"/></code>
98
99 <p>or</p>
100
101 <code><ex>:autocmd LocationChange</ex> <str delim="">www.google.com</str>,<str delim="">mail.google.com</str> <ex>:normal!</ex> <k name="C-z"/></code>
102
103 <p>Set the filetype to mail when editing email at Gmail:</p>
104
105 <code><ex>:autocmd LocationChange</ex> !<str delim="">mail.google.com</str>,<str delim="">*</str> <se opt="editor" op="&amp;"/>
106 <ex>:autocmd LocationChange</ex> <str delim="'">mail.google.com</str> <se opt="editor"><str>gvim -f -c 'set ft=mail' +&lt;line></str></se></code>
107
108 </document>
109
110 <!-- vim:se sts=4 sw=4 et: -->