summaryrefslogtreecommitdiff
path: root/runtime/doc/map.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/map.txt')
-rw-r--r--runtime/doc/map.txt11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 47e706bc2..13b2c2efc 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1,4 +1,4 @@
-*map.txt* For Vim version 8.2. Last change: 2021 Mar 17
+*map.txt* For Vim version 8.2. Last change: 2021 Apr 23
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -244,9 +244,12 @@ have a look at |maparg()|.
If the first argument to one of these commands is "<expr>" and it is used to
define a new mapping or abbreviation, the argument is an expression. The
expression is evaluated to obtain the {rhs} that is used. Example: >
- :inoremap <expr> . InsertDot()
-The result of the InsertDot() function will be inserted. It could check the
+ :inoremap <expr> . <SID>InsertDot()
+The result of the s:InsertDot() function will be inserted. It could check the
text before the cursor and start omni completion when some condition is met.
+Using a script-local function is preferred, to avoid polluting the global
+namespace. Use <SID> in the RHS so that the script that the mapping was
+defined in can be found.
For abbreviations |v:char| is set to the character that was typed to trigger
the abbreviation. You can use this to decide how to expand the {lhs}. You
@@ -261,7 +264,7 @@ input. Example: >
call popup_create(... arguments ...)
return "\<Ignore>"
endfunc
- nnoremap <expr> <F3> <Sid>OpenPopup()
+ nnoremap <expr> <F3> <SID>OpenPopup()
Also, keep in mind that the expression may be evaluated when looking for
typeahead, before the previous command has been executed. For example: >