|
1 |
| -*map.txt* For Vim version 9.0. Last change: 2022 May 09 |
| 1 | +*map.txt* For Vim version 9.0. Last change: 2022 Jun 18 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar
|
|
63 | 63 | allows for nested and recursive use of mappings.
|
64 | 64 | Note: Trailing spaces are included in the {rhs},
|
65 | 65 | because space is a valid Normal mode command.
|
| 66 | + See |map-trailing-white|. |
66 | 67 |
|
67 | 68 | *:nore* *:norem*
|
68 | 69 | :no[remap] {lhs} {rhs} |mapmode-nvo| *:no* *:noremap* *:nor*
|
@@ -100,10 +101,8 @@ modes.
|
100 | 101 | for other modes where it applies.
|
101 | 102 | It also works when {lhs} matches the {rhs} of a
|
102 | 103 | mapping. This is for when an abbreviation applied.
|
103 |
| - Note: Trailing spaces are included in the {lhs}. This |
104 |
| - unmap does NOT work: > |
105 |
| - :map @@ foo |
106 |
| - :unmap @@ | print |
| 104 | + Note: Trailing spaces are included in the {lhs}. |
| 105 | + See |map-trailing-white|. |
107 | 106 |
|
108 | 107 | :mapc[lear] |mapmode-nvo| *:mapc* *:mapclear*
|
109 | 108 | :nmapc[lear] |mapmode-n| *:nmapc* *:nmapclear*
|
@@ -168,14 +167,36 @@ that mapping won't get expanded yet, Vim is waiting for another character.
|
168 | 167 | If you type a space, then "foo" will get inserted, plus the space. If you
|
169 | 168 | type "a", then "bar" will get inserted.
|
170 | 169 |
|
| 170 | +Trailing white space ~ |
| 171 | + *map-trailing-white* |
| 172 | +This unmap command does NOT work: > |
| 173 | + :map @@ foo |
| 174 | + :unmap @@ | print |
| 175 | +
|
| 176 | +Because it tries to unmap "@@ ", including the white space before the command |
| 177 | +separator "|". Other examples with trailing white space: > |
| 178 | + unmap @@ |
| 179 | + unmap @@ # Vim9 script comment |
| 180 | + unmap @@ " legacy script comment |
| 181 | +
|
| 182 | +An error will be issued, which is very hard to identify, because the ending |
| 183 | +whitespace character in `unmap @@ ` is not visible. |
| 184 | + |
| 185 | +A generic solution is to put the command separator "|" right after the mapped |
| 186 | +keys. After that white space and a comment may follow: > |
| 187 | +
|
| 188 | + unmap @@| # Vim9 script comment |
| 189 | + unmap @@| " legacy script comment |
| 190 | +
|
171 | 191 |
|
172 | 192 | 1.2 SPECIAL ARGUMENTS *:map-arguments*
|
173 | 193 |
|
174 | 194 | "<buffer>", "<nowait>", "<silent>", "<special>", "<script>", "<expr>" and
|
175 | 195 | "<unique>" can be used in any order. They must appear right after the
|
176 | 196 | command, before any other arguments.
|
177 | 197 |
|
178 |
| - *:map-local* *:map-<buffer>* *:map-buffer* *E224* *E225* |
| 198 | + *:map-local* *:map-<buffer>* *:map-buffer* |
| 199 | + *E224* *E225* |
179 | 200 | If the first argument to one of these commands is "<buffer>" the mapping will
|
180 | 201 | be effective in the current buffer only. Example: >
|
181 | 202 | :map <buffer> ,w /[.,;]<CR>
|
@@ -374,8 +395,6 @@ Note:
|
374 | 395 | mapping is recursive.
|
375 | 396 | - In Visual mode you can use `line('v')` and `col('v')` to get one end of the
|
376 | 397 | Visual area, the cursor is at the other end.
|
377 |
| -- In Select mode, |:map| and |:vmap| command mappings are executed in |
378 |
| - Visual mode. Use |:smap| to handle Select mode differently. |
379 | 398 |
|
380 | 399 | *E1255* *E1136*
|
381 | 400 | <Cmd> and <ScriptCmd> commands must terminate, that is, they must be followed
|
@@ -701,6 +720,7 @@ not to be matched with any key sequence. This is useful in plugins
|
701 | 720 | *<MouseMove>*
|
702 | 721 | The special key name "<MouseMove>" can be used to handle mouse movement. It
|
703 | 722 | needs to be enabled with 'mousemoveevent'. Currently only works in the GUI.
|
| 723 | +The |getmousepos()| function can be used to obtain the mouse position. |
704 | 724 |
|
705 | 725 | *<Char>* *<Char->*
|
706 | 726 | To map a character by its decimal, octal or hexadecimal number the <Char>
|
|
0 commit comments