Mercurial > vim
comparison runtime/doc/userfunc.txt @ 32004:a9b5ffbc0428
Update runtime files.
Commit: https://github.com/vim/vim/commit/938ae280c79b8cdb0fca60336ec4c090ecd8bb5a
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 20 20:44:55 2023 +0000
Update runtime files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 Feb 2023 22:00:05 +0100 |
parents | 5ed19049b1e8 |
children | 635de73eeb4c |
comparison
equal
deleted
inserted
replaced
32003:aa9c0f0ebfd0 | 32004:a9b5ffbc0428 |
---|---|
1 *userfunc.txt* For Vim version 9.0. Last change: 2023 Jan 09 | 1 *userfunc.txt* For Vim version 9.0. Last change: 2023 Feb 02 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
209 nested ":try"s inside the function. The function | 209 nested ":try"s inside the function. The function |
210 returns at the outermost ":endtry". | 210 returns at the outermost ":endtry". |
211 | 211 |
212 *function-argument* *a:var* | 212 *function-argument* *a:var* |
213 An argument can be defined by giving its name. In the function this can then | 213 An argument can be defined by giving its name. In the function this can then |
214 be used as "a:name" ("a:" for argument). | 214 be used as "a:name" ("a:" for argument) (in a `:def` function "a:" is not |
215 used). | |
215 *a:0* *a:1* *a:000* *E740* *...* | 216 *a:0* *a:1* *a:000* *E740* *...* |
216 Up to 20 arguments can be given, separated by commas. After the named | 217 Up to 20 arguments can be given, separated by commas. After the named |
217 arguments an argument "..." can be specified, which means that more arguments | 218 arguments an argument "..." can be specified, which means that more arguments |
218 may optionally be following. In the function the extra arguments can be used | 219 may optionally be following. In the function the extra arguments can be used |
219 as "a:1", "a:2", etc. "a:0" is set to the number of extra arguments (which | 220 as "a:1", "a:2", etc. "a:0" is set to the number of extra arguments (which |
244 endfunction | 245 endfunction |
245 call Something('empty') "empty: 10" | 246 call Something('empty') "empty: 10" |
246 call Something('key', 20) "key: 20" | 247 call Something('key', 20) "key: 20" |
247 | 248 |
248 The argument default expressions are evaluated at the time of the function | 249 The argument default expressions are evaluated at the time of the function |
249 call, not definition. Thus it is possible to use an expression which is | 250 call, not when the function is defined. Thus it is possible to use an |
250 invalid the moment the function is defined. The expressions are also only | 251 expression which is invalid the moment the function is defined. The |
251 evaluated when arguments are not specified during a call. | 252 expressions are also only evaluated when arguments are not specified during a |
253 call. | |
252 *none-function_argument* | 254 *none-function_argument* |
253 You can pass |v:none| to use the default expression. Note that this means you | 255 You can pass |v:none| to use the default expression. Note that this means you |
254 cannot pass v:none as an ordinary value when an argument has a default | 256 cannot pass v:none as an ordinary value when an argument has a default |
255 expression. | 257 expression. |
256 | 258 |