comparison 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
comparison
equal deleted inserted replaced
24568:3671ff322103 24569:e3ec2ec8841a
1 *map.txt* For Vim version 8.2. Last change: 2021 Mar 17 1 *map.txt* For Vim version 8.2. Last change: 2021 Apr 23
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
242 242
243 *:map-<expr>* *:map-expression* 243 *:map-<expr>* *:map-expression*
244 If the first argument to one of these commands is "<expr>" and it is used to 244 If the first argument to one of these commands is "<expr>" and it is used to
245 define a new mapping or abbreviation, the argument is an expression. The 245 define a new mapping or abbreviation, the argument is an expression. The
246 expression is evaluated to obtain the {rhs} that is used. Example: > 246 expression is evaluated to obtain the {rhs} that is used. Example: >
247 :inoremap <expr> . InsertDot() 247 :inoremap <expr> . <SID>InsertDot()
248 The result of the InsertDot() function will be inserted. It could check the 248 The result of the s:InsertDot() function will be inserted. It could check the
249 text before the cursor and start omni completion when some condition is met. 249 text before the cursor and start omni completion when some condition is met.
250 Using a script-local function is preferred, to avoid polluting the global
251 namespace. Use <SID> in the RHS so that the script that the mapping was
252 defined in can be found.
250 253
251 For abbreviations |v:char| is set to the character that was typed to trigger 254 For abbreviations |v:char| is set to the character that was typed to trigger
252 the abbreviation. You can use this to decide how to expand the {lhs}. You 255 the abbreviation. You can use this to decide how to expand the {lhs}. You
253 should not either insert or change the v:char. 256 should not either insert or change the v:char.
254 257
259 input. Example: > 262 input. Example: >
260 func s:OpenPopup() 263 func s:OpenPopup()
261 call popup_create(... arguments ...) 264 call popup_create(... arguments ...)
262 return "\<Ignore>" 265 return "\<Ignore>"
263 endfunc 266 endfunc
264 nnoremap <expr> <F3> <Sid>OpenPopup() 267 nnoremap <expr> <F3> <SID>OpenPopup()
265 268
266 Also, keep in mind that the expression may be evaluated when looking for 269 Also, keep in mind that the expression may be evaluated when looking for
267 typeahead, before the previous command has been executed. For example: > 270 typeahead, before the previous command has been executed. For example: >
268 func StoreColumn() 271 func StoreColumn()
269 let g:column = col('.') 272 let g:column = col('.')