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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
|
heading:Key{nbsp}mappings,{nbsp}abbreviations,{nbsp}and{nbsp}user-defined{nbsp}commands.[]
section:Key{nbsp}mapping[key-mapping,mapping,macro]
The key mapping commands can be used to either redefine the standard key
bindings or define new ones. A mapping consists of a key, or sequence of keys,
which are translated to a string of characters. Example:
\{nbsp}[c]:map <F2> :echo new Date().toDateString()<CR>[c]
will echo the current date to the command line when [m]<F2>[m] is pressed.
There are separate key mapping tables for each of the Normal, Insert, and
Command-line modes.
Please note that, unlike Vim and other applications, mappings containing
the Shift key are specified with the capital letter, so e.g. [m]<C-n>[m] is
different from [m]<C-N>[m], the latter being the only way to map Shift-Ctrl-n.
subsection:Map{nbsp}commands[:map-commands]
|:map|
||:map {lhs} {rhs}|| +
|:nm| |:nmap|
||:nm[ap] {lhs} {rhs}|| +
|:vm| |:vmap|
||:vm[ap] {lhs} {rhs}|| +
|:im| |:imap|
||:im[ap] {lhs} {rhs}|| +
|:cm| |:cmap|
||:cm[ap] {lhs} {rhs}|| +
________________________________________________________________________________
Map the key sequence {lhs} to {rhs} for the applicable mode(s). The {rhs} is
remapped, allowing for nested and recursive mappings.
Warning: Mappings are NOT saved between sessions, make sure you put them in your
vimperatorrc file!
________________________________________________________________________________
|:no| |:noremap|
||:no[remap] {lhs} {rhs}|| +
|:nn| |:nnoremap|
||:nn[oremap] {lhs} {rhs}|| +
|:vn| |:vnoremap|
||:vn[oremap] {lhs} {rhs}|| +
|:ino| |:inoremap|
||:ino[remap] {lhs} {rhs}|| +
|:cno| |:cnoremap|
||:cno[remap] {lhs} {rhs}|| +
________________________________________________________________________________
Map the key sequence {lhs} to {rhs} for the applicable mode(s). No remapping of
the {rhs} is performed.
________________________________________________________________________________
|:unm| |:unmap|
||:map {lhs} {rhs}|| +
|:nun| |:nunmap|
||:nun[map] {lhs} {rhs}|| +
|:vun| |:vunmap|
||:vun[map] {lhs} {rhs}|| +
|:iu| |:iunmap|
||:iu[nmap] {lhs} {rhs}|| +
|:cu| |:cunmap|
||:cu[nmap] {lhs} {rhs}|| +
________________________________________________________________________________
Remove the mapping of {lhs} for the applicable mode(s).
________________________________________________________________________________
|:mapc| |:mapclear|
||:mapc[lear]|| +
|:nmapc| |:nmapclear|
||:nmapc[lear]|| +
|:vmapc| |:vmapclear|
||:vmapc[lear]|| +
|:imapc| |:imapclear|
||:imapc[lear]|| +
|:cmapc| |:cmapclear|
||:cmapc[lear]|| +
________________________________________________________________________________
Remove all mappings for the applicable mode(s). All user-defined mappings are
cleared.
________________________________________________________________________________
|:map|
||:map|| +
|:nm| |:nmap|
||:nm[ap]|| +
|:vm| |:vmap|
||:vm[ap]|| +
|:im| |:imap|
||:im[ap]|| +
|:cm| |:cmap|
||:cm[ap]|| +
________________________________________________________________________________
List all mappings for the applicable mode(s).
________________________________________________________________________________
|:map|
||:map {lhs}|| +
|:nm| |:nmap|
||:nm[ap] {lhs}|| +
|:vm| |:vmap|
||:vm[ap] {lhs}|| +
|:im| |:imap|
||:im[ap] {lhs}|| +
|:cm| |:cmap|
||:cm[ap] {lhs}|| +
________________________________________________________________________________
List all mappings starting with {lhs} for the applicable mode(s).
________________________________________________________________________________
subsection:Special{nbsp}arguments{nbsp}[:map-arguments]
|:map-<silent>| +
When the first argument to one of the mapping commands is [c]<silent>[c], {rhs}
is not echoed to the command line, nor, for that matter, anything else until
the command has completed.
subsection:Mapping{nbsp}and{nbsp}modes[:map-modes]
Keys can be mapped in four distinct modes:
* Normal mode
* Visual mode
* Insert mode
* Command-line mode
|map-overview| |map-modes| +
Below is an overview of which modes each map command applies to:
// TODO: table format
:map :noremap :unmap :mapclear - both Normal and Visual modes
:nmap :nnoremap :nunmap :nmapclear - Normal mode
:vmap :vnoremap :vunmap :vmapclear - Visual mode
:imap :inoremap :iunmap :imapclear - Insert mode
:cmap :cnoremap :cunmap :cmapclear - Command-line mode
subsection:Special{nbsp}characters[:map-special-chars]
|<Nop>| +
||<Nop>||
________________________________________________________________________________
Do nothing. This command is useful for disabling a specific mapping. [c]:map
<C-n> <Nop>[c] will prevent [m]<C-n>[m] from doing anything.
________________________________________________________________________________
|<CR>| |map_return| +
||<CR>||
________________________________________________________________________________
Expand to a line terminator in a key mapping. An Ex command in the {rhs} of a
mapping requires a line terminator after it so that it is executed when the
mapping is expanded. [m]<CR>[m] should be used for this purpose.
________________________________________________________________________________
|<Leader>| |mapleader| +
||<Leader>||
________________________________________________________________________________
Expands to the value of the "mapleader" variable in key mapping. If
"mapleader" is unset or empty then "\" is used. Example: +
\{nbsp}[c]:map <Leader>h :echo "Hello"<CR>[c] +
works like +
\{nbsp}[c]:map \h :echo "Hello"<CR>[c] +
but after +
\{nbsp}[c]let mapleader = ","[c] +
it works like +
\{nbsp}[c]:map ,h :echo "Hello"<CR>[c]
________________________________________________________________________________
section:Abbreviations[abbreviations]
Vimperator can automatically replace words identified as abbreviations,
which may be used to save typing or to correct commonly misspelled
words. An abbreviation can be one of three types that are defined by the
types of constituent characters. Whitespace and quotes are non-keyword
types, and all other characters are keyword types.
1. A "full-id" abbreviation consists entirely of keyword characters
(e.g., "teh", "msoft").
2. An "end-id" abbreviation ends in keyword character but otherwise
contains all non-keyword characters (e.g., "'i").
3. A "non-id" abbreviation ends in a non-keyword character but otherwise
contains any non-whitespace character (e.g., "def'").
Strings that cannot be abbreviations include "a'b" and "a b".
An abbreviation is recognized when a space, quote character, or
[m]<C-]>[m] is typed after the abbreviation. There are no default
abbreviations, and abbreviations are never recursive.
|:ab| |:abbreviate|
||:ab[breviate] {lhs} {rhs}|| +
||:ab[breviate] {lhs}|| +
||:ab[breviate]||
________________________________________________________________________________
Abbreviate a key sequence. Abbreviate {lhs} to {rhs}. If only {lhs} is given,
list all abbreviations that start with {lhs}. If no arguments are given,
list all abbreviations.
________________________________________________________________________________
|:ca| |:cabbrev|
||:ca[bbrev] {lhs} {rhs}|| +
||:ca[bbrev] {lhs}|| +
||:ca[bbrev]||
________________________________________________________________________________
Abbreviate a key sequence for Command-line mode. Same as [c]:ab[breviate][c],
but for Command-line mode only.
________________________________________________________________________________
|:ia| |:iabbrev|
||:ia[bbrev] {lhs} {rhs}|| +
||:ia[bbrev] {lhs}|| +
||:ia[bbrev]||
________________________________________________________________________________
Abbreviate a key sequence for Insert mode. Same as [c]:ab[breviate][c] but
for Insert mode only.
________________________________________________________________________________
|:una| |:unabbreviate|
||:una[bbreviate] {lhs}|| +
________________________________________________________________________________
Remove an abbreviation.
________________________________________________________________________________
|:cuna| |:cunabbrev|
||:cuna[bbrev] {lhs}|| +
________________________________________________________________________________
Remove an abbreviation for Command-line mode. Same as [c]:una[bbreviate][c],
but for Command-line mode only.
________________________________________________________________________________
|:iuna| |:iunabbrev|
||:iuna[bbrev] {lhs}|| +
________________________________________________________________________________
Remove an abbreviation for Insert mode. Same as [c]:una[bbreviate][c] but for
Insert mode only.
________________________________________________________________________________
|:abc| |:abclear| +
||:abc[lear]||
________________________________________________________________________________
Remove all abbreviations.
________________________________________________________________________________
|:cabc| |:cabclear| +
||:cabc[lear]||
________________________________________________________________________________
Remove all abbreviations for Command-line mode.
________________________________________________________________________________
|:iabc| |:iabclear| +
||:iabc[lear]||
________________________________________________________________________________
Remove all abbreviations for Insert mode.
________________________________________________________________________________
section:User-defined{nbsp}commands[user-commands]
|:com| |:command|
||:com[mand]|| +
________________________________________________________________________________
List all user-defined commands.
________________________________________________________________________________
||:com[mand] {cmd}|| +
________________________________________________________________________________
List all user-defined commands that start with {cmd}.
________________________________________________________________________________
||:com[mand][!] [{attr}...] {cmd} {rep}|| +
________________________________________________________________________________
Define a new user command. The name of the command is {cmd} and its replacement
text is {rep}. The command's attributes are {attr}. If a command with this name
already exists an error is reported unless [!] is specified, in which case the
command is redefined. Unlike Vim, the command may start with a lowercase
letter.
The command's behavior can be specified by providing attributes when the
command is defined.
|E175| |E176| |:command-nargs| +
Argument handling
By default user commands accept no arguments. This can be changed by specifying
the -nargs attribute.
The valid values are:
`----------`--------------------------------------------------------------------
*-nargs=0* No arguments are allowed (default)
*-nargs=1* One argument is allowed
*-nargs=** Zero or more arguments are allowed
*-nargs=?* Zero or one argument is allowed
*-nargs=+* One or more arguments are allowed
--------------------------------------------------------------------------------
|E180| |E181| |:command-complete| +
Argument completion
Completion for arguments to user defined commands is not available by default.
Completion can be enabled by specifying one of the following arguments to the
-complete option when defining the command.
`----------------`--------------------------------------------------------------
*altstyle* alternate author style sheets
*bookmark* bookmarks
*buffer* buffers
*color* color schemes
*command* Ex commands
*dialog* Firefox dialogs
*dir* directories
*environment* environment variables
*event* autocommand events
*file* files
*help* help tags
*highlight* highlight groups
*javascript* JavaScript expressions
*macro* named macros
*mapping* user mappings
*menu* menu items
*option* Vimperator options
*preference* Firefox preferences
*search* search engines and keywords
*shellcmd* shell commands
*sidebar* sidebar panels
*url* URLs
*usercommand* user commands
*custom,{func}* custom completion, provided by {func}
--------------------------------------------------------------------------------
|E467| |E468| |:command-completion-custom| +
Custom completion
Custom completion can be provided by specifying the "custom,{func}" argument to
-complete. The {func} is called with two arguments, a completion context, and
an object describing the command's arguments. It should set the context's
\'completions' property, or return an object, with \'items' and \'start'
properties, describing the completions and where the replacement is to start.
*start* is the index into the word being completed at which the returned values
should be applied and *completions* is a two dimensional array of the form:
[[arg1, description1], [arg2, description2], ...]
// TODO: add examples
|E177| |E178| |:command-count| +
Count handling
By default user commands do not accept a count. Use the -count attribute if
you'd like to have a count passed to your user command. This will then be
available for expansion as <count> in the argument.
|:command-bang| +
Special cases
By default a user command does not have a special version, i.e. a version
executed with the ! modifier. Providing the -bang attribute will enable this
and <bang> will be available in the argument.
|:command-replacement-text| +
Replacement text
The replacement text {rep} is scanned for escape sequences and these are
replaced with values from the user-entered command line. The resulting string
is then executed as an Ex command.
The valid escape sequences are:
`----------`--------------------------------------------------------------------
*<args>* The command arguments exactly as supplied
*<count>* Any supplied count, e.g. 5
*<bang>* ! if the command was executed with the ! modifier
*<lt>* A literal '<' character to allow for a literal copy of one of the escape sequences. E.g. <lt>args> will expand to a literal <args>
--------------------------------------------------------------------------------
"q-" can be prefixed to the escape sequence so that the value is quoted, making
it suitable for expression evaluation. Example: <q-args>
________________________________________________________________________________
|:comc| |:comclear| +
||:comc[lear]||
________________________________________________________________________________
Delete all user-defined commands.
________________________________________________________________________________
|:delc| |:delcommand|
||:delc[ommand] {cmd}|| +
________________________________________________________________________________
Delete the user-defined command {cmd}.
________________________________________________________________________________
section:Examples[command-examples]
Add a :Google command to search via google:
\{nbsp}[c]:command -nargs=* Google open google <args>[c]
// TODO: add decent examples
// vim: set filetype=asciidoc:
|