1
- *map.txt* For Vim version 8.0 . Last change: 2017 Mar 10
1
+ *map.txt* For Vim version 8.1 . Last change: 2018 May 13
2
2
3
3
4
4
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -29,7 +29,7 @@ manual.
29
29
1. Key mapping *key-mapping* *mapping* *macro*
30
30
31
31
Key mapping is used to change the meaning of typed keys. The most common use
32
- is to define a sequence commands for a function key. Example: >
32
+ is to define a sequence of commands for a function key. Example: >
33
33
34
34
:map <F2> a<C-R>=strftime("%c")<CR><Esc>
35
35
55
55
:im[ap] {lhs} {rhs} | mapmode-i | *:im* *:imap*
56
56
:lm[ap] {lhs} {rhs} | mapmode-l | *:lm* *:lmap*
57
57
:cm[ap] {lhs} {rhs} | mapmode-c | *:cm* *:cmap*
58
+ :tma[p] {lhs} {rhs} | mapmode-t | *:tma* *:tmap*
58
59
Map the key sequence {lhs} to {rhs} for the modes
59
60
where the map command applies. The result, including
60
61
{rhs} , is then further scanned for mappings. This
71
72
:ino[remap] {lhs} {rhs} | mapmode-i | *:ino* *:inoremap*
72
73
:ln[oremap] {lhs} {rhs} | mapmode-l | *:ln* *:lnoremap*
73
74
:cno[remap] {lhs} {rhs} | mapmode-c | *:cno* *:cnoremap*
75
+ :tno[remap] {lhs} {rhs} | mapmode-t | *:tno* *:tnoremap*
74
76
Map the key sequence {lhs} to {rhs} for the modes
75
77
where the map command applies. Disallow mapping of
76
78
{rhs} , to avoid nested and recursive mappings. Often
87
89
:iu[nmap] {lhs} | mapmode-i | *:iu* *:iunmap*
88
90
:lu[nmap] {lhs} | mapmode-l | *:lu* *:lunmap*
89
91
:cu[nmap] {lhs} | mapmode-c | *:cu* *:cunmap*
92
+ :tunma[p] {lhs} | mapmode-t | *:tunma* *:tunmap*
90
93
Remove the mapping of {lhs} for the modes where the
91
94
map command applies. The mapping may remain defined
92
95
for other modes where it applies.
@@ -105,6 +108,7 @@ modes.
105
108
:imapc[lear] | mapmode-i | *:imapc* *:imapclear*
106
109
:lmapc[lear] | mapmode-l | *:lmapc* *:lmapclear*
107
110
:cmapc[lear] | mapmode-c | *:cmapc* *:cmapclear*
111
+ :tmapc[lear] | mapmode-t | *:tmapc* *:tmapclear*
108
112
Remove ALL mappings for the modes where the map
109
113
command applies. {not in Vi}
110
114
Use the <buffer> argument to remove buffer-local
@@ -121,6 +125,7 @@ modes.
121
125
:im[ap] | mapmode-i |
122
126
:lm[ap] | mapmode-l |
123
127
:cm[ap] | mapmode-c |
128
+ :tma[p] | mapmode-t |
124
129
List all key mappings for the modes where the map
125
130
command applies. Note that ":map" and ":map!" are
126
131
used most often, because they include the other modes.
@@ -135,6 +140,7 @@ modes.
135
140
:im[ap] {lhs} | mapmode-i | *:imap_l*
136
141
:lm[ap] {lhs} | mapmode-l | *:lmap_l*
137
142
:cm[ap] {lhs} | mapmode-c | *:cmap_l*
143
+ :tma[p] {lhs} | mapmode-t | *:tmap_l*
138
144
List the key mappings for the key sequences starting
139
145
with {lhs} in the modes where the map command applies.
140
146
{not in Vi}
@@ -185,7 +191,7 @@ that starts with ",". Then you need to type another character for Vim to know
185
191
whether to use the "," mapping or the longer one. To avoid this add the
186
192
<nowait> argument. Then the mapping will be used when it matches, Vim does
187
193
not wait for more characters to be typed. However, if the characters were
188
- already type they are used.
194
+ already typed they are used.
189
195
190
196
*:map-<silent>* *:map-silent*
191
197
To define a mapping which will not be echoed on the command line, add
@@ -318,6 +324,7 @@ Overview of which map command works in which mode. More details below.
318
324
:imap :inoremap :iunmap Insert
319
325
:lmap :lnoremap :lunmap Insert, Command-line, Lang-Arg
320
326
:cmap :cnoremap :cunmap Command-line
327
+ :tmap :tnoremap :tunmap Terminal-Job
321
328
322
329
323
330
COMMANDS MODES ~
@@ -358,6 +365,10 @@ Therefore the ":map" and ":map!" commands enter and display mappings for
358
365
several modes. In Vim you can use the ":nmap", ":vmap", ":omap", ":cmap" and
359
366
":imap" commands to enter mappings for each mode separately.
360
367
368
+ *mapmode-t*
369
+ The terminal mappings are used in a terminal window, when typing keys for the
370
+ job running in the terminal. See | terminal-typing | .
371
+
361
372
*omap-info*
362
373
Operator-pending mappings can be used to define a movement command that can be
363
374
used with any operator. Simple example: ":omap { w" makes "y{" work like "yw"
@@ -418,6 +429,7 @@ When listing mappings the characters in the first two columns are:
418
429
i Insert
419
430
l ":lmap" mappings for Insert, Command-line and Lang-Arg
420
431
c Command-line
432
+ t Terminal-Job
421
433
422
434
Just before the {rhs} a special character can appear:
423
435
* indicates that it is not remappable
@@ -530,9 +542,9 @@ scenario: >
530
542
:imap <M-C> foo
531
543
:set encoding=utf-8
532
544
The mapping for <M-C> is defined with the latin1 encoding, resulting in a 0xc3
533
- byte. If you type the character á (0xe1 <M-a> ) in UTF-8 encoding this is the
545
+ byte. If you type the character á (0xe1 <M-a> ) in UTF-8 encoding this is the
534
546
two bytes 0xc3 0xa1. You don't want the 0xc3 byte to be mapped then or
535
- otherwise it would be impossible to type the á character.
547
+ otherwise it would be impossible to type the á character.
536
548
537
549
*<Leader>* *mapleader*
538
550
To define a mapping which uses the "mapleader" variable, the special string
@@ -682,7 +694,7 @@ option). After that it assumes that the 'q' is to be interpreted as such. If
682
694
you type slowly, or your system is slow, reset the 'timeout' option. Then you
683
695
might want to set the 'ttimeout' option.
684
696
685
- *map-precedence*
697
+ *map-precedence*
686
698
Buffer-local mappings (defined using | :map-<buffer> | ) take precedence over
687
699
global mappings. When a buffer-local mapping is the same as a global mapping,
688
700
Vim will use the buffer-local mapping. In addition, Vim will use a complete
@@ -798,7 +810,7 @@ Bear in mind that convert-meta has been reported to have troubles when used in
798
810
UTF-8 locales. On terminals like xterm, the "metaSendsEscape" resource can be
799
811
toggled on the fly through the "Main Options" menu, by pressing Ctrl-LeftClick
800
812
on the terminal; that's a good last resource in case you want to send ESC when
801
- using other applications but not when inside VIM .
813
+ using other applications but not when inside Vim .
802
814
803
815
804
816
1.11 MAPPING AN OPERATOR *:map-operator*
@@ -905,7 +917,9 @@ an additional rule:
905
917
full-id In front of the match is a non-keyword character, or this is where
906
918
the line or insertion starts. Exception: When the abbreviation is
907
919
only one character, it is not recognized if there is a non-keyword
908
- character in front of it, other than a space or a tab.
920
+ character in front of it, other than a space or a tab. However, for
921
+ the command line "'<,'>" (or any other marks) is ignored, as if the
922
+ command line starts after it.
909
923
910
924
end-id In front of the match is a keyword character, or a space or a tab,
911
925
or this is where the line or insertion starts.
@@ -1260,6 +1274,7 @@ By default, the arguments of user defined commands do not undergo completion.
1260
1274
However, by specifying one or the other of the following attributes, argument
1261
1275
completion can be enabled:
1262
1276
1277
+ -complete=arglist file names in argument list
1263
1278
-complete=augroup autocmd groups
1264
1279
-complete=buffer buffer names
1265
1280
-complete=behave :behave suboptions
@@ -1279,6 +1294,7 @@ completion can be enabled:
1279
1294
-complete=highlight highlight groups
1280
1295
-complete=history :history suboptions
1281
1296
-complete=locale locale names (as output of locale -a)
1297
+ -complete=mapclear buffer argument
1282
1298
-complete=mapping mapping name
1283
1299
-complete=menu menus
1284
1300
-complete=messages | :messages | suboptions
@@ -1414,6 +1430,8 @@ The valid escape sequences are
1414
1430
<line1> The starting line of the command range.
1415
1431
*<line2>*
1416
1432
<line2> The final line of the command range.
1433
+ *<range>*
1434
+ <range> The number of items in the command range: 0, 1 or 2
1417
1435
*<count>*
1418
1436
<count> Any count supplied (as described for the '-range'
1419
1437
and '-count' attributes).
0 commit comments