Mercurial > vim
diff runtime/doc/map.txt @ 24569:e3ec2ec8841a
Update runtime files
Commit: https://github.com/vim/vim/commit/4c295027a426986566cd7a76c47a6d3a529727e7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 2 17:19:11 2021 +0200
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 02 May 2021 17:30:05 +0200 |
parents | 4ab4ef0c48b1 |
children | 840665e74421 |
line wrap: on
line diff
--- 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: >