summaryrefslogtreecommitdiffstats
path: root/runtime/doc/map.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-06-03 21:59:47 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-03 21:59:47 +0100
commitcfa8f9a3f285060152ebbdbf86fbc7aecf1dd756 (patch)
tree8aa47aedb1518be5e85a39a24afc93c80878eb7d /runtime/doc/map.txt
parent635f48010dcf6d97f3a65b4785e1726ad386d3eb (diff)
Update runtime files
Diffstat (limited to 'runtime/doc/map.txt')
-rw-r--r--runtime/doc/map.txt30
1 files changed, 25 insertions, 5 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 373f459aec..76a2f52290 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1,4 +1,4 @@
-*map.txt* For Vim version 8.2. Last change: 2022 May 16
+*map.txt* For Vim version 8.2. Last change: 2022 Jun 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -63,6 +63,7 @@ modes.
allows for nested and recursive use of mappings.
Note: Trailing spaces are included in the {rhs},
because space is a valid Normal mode command.
+ See |map-trailing-white|.
*:nore* *:norem*
:no[remap] {lhs} {rhs} |mapmode-nvo| *:no* *:noremap* *:nor*
@@ -100,10 +101,8 @@ modes.
for other modes where it applies.
It also works when {lhs} matches the {rhs} of a
mapping. This is for when an abbreviation applied.
- Note: Trailing spaces are included in the {lhs}. This
- unmap does NOT work: >
- :map @@ foo
- :unmap @@ | print
+ Note: Trailing spaces are included in the {lhs}.
+ See |map-trailing-white|.
:mapc[lear] |mapmode-nvo| *:mapc* *:mapclear*
:nmapc[lear] |mapmode-n| *:nmapc* *:nmapclear*
@@ -168,6 +167,27 @@ that mapping won't get expanded yet, Vim is waiting for another character.
If you type a space, then "foo" will get inserted, plus the space. If you
type "a", then "bar" will get inserted.
+Trailing white space ~
+ *map-trailing-white*
+This unmap command does NOT work: >
+ :map @@ foo
+ :unmap @@ | print
+
+Because it tries to unmap "@@ ", including the white space before the command
+separator "|". Other examples with trailing white space: >
+ unmap @@
+ unmap @@ # Vim9 script comment
+ unmap @@ " legacy comment
+
+An error will be issued, which is very hard to identify, because the ending
+whitespace character in `unmap @@ ` is not visible.
+
+A generic solution is to put the command separator "|" right after the mapped
+keys. After that white space and a comment may follow: >
+
+ unmap @@| # Vim9 scriptcomment
+ unmap @@| " legacy scriptcomment
+
1.2 SPECIAL ARGUMENTS *:map-arguments*