Mercurial > vim
comparison runtime/doc/vim9.txt @ 26612:2586659245db v8.2.3835
patch 8.2.3835: the inline-function example does not work
Commit: https://github.com/vim/vim/commit/259f443a934c6f2447a14bfe54403903416a9af0
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 17 12:45:22 2021 +0000
patch 8.2.3835: the inline-function example does not work
Problem: The inline-function example does not work.
Solution: Drop ":let". Add EX_EXPR_ARG to CMD_var. (issue https://github.com/vim/vim/issues/9352)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 17 Dec 2021 14:00:04 +0100 |
parents | 3a63b1e4a6f4 |
children | f0d7cb510ce3 |
comparison
equal
deleted
inserted
replaced
26611:6da29744e94a | 26612:2586659245db |
---|---|
558 var timer = timer_start(500, (_) => { | 558 var timer = timer_start(500, (_) => { |
559 count += 1 | 559 count += 1 |
560 echom 'Handler called ' .. count | 560 echom 'Handler called ' .. count |
561 }, {repeat: 3}) | 561 }, {repeat: 3}) |
562 | 562 |
563 | |
564 The ending "}" must be at the start of a line. It can be followed by other | 563 The ending "}" must be at the start of a line. It can be followed by other |
565 characters, e.g.: > | 564 characters, e.g.: > |
566 var d = mapnew(dict, (k, v): string => { | 565 var d = mapnew(dict, (k, v): string => { |
567 return 'value' | 566 return 'value' |
568 }) | 567 }) |
569 No command can follow the "{", only a comment can be used there. | 568 No command can follow the "{", only a comment can be used there. |
570 | 569 |
570 *command-block* | |
571 The block can also be used for defining a user command. Inside the block Vim9 | |
572 syntax will be used. | |
573 | |
571 If the statements include a dictionary, its closing bracket must not be | 574 If the statements include a dictionary, its closing bracket must not be |
572 written at the start of a line. Otherwise, it would be parsed as the end of | 575 written at the start of a line. Otherwise, it would be parsed as the end of |
573 the block. This does not work: > | 576 the block. This does not work: > |
574 command NewCommand { | 577 command NewCommand { |
575 let g:mydict = { | 578 g:mydict = { |
576 'key': 'value', | 579 'key': 'value', |
577 } # ERROR: will be recognized as the end of the block | 580 } # ERROR: will be recognized as the end of the block |
578 } | 581 } |
579 Put the '}' after the last item to avoid this: > | 582 Put the '}' after the last item to avoid this: > |
580 command NewCommand { | 583 command NewCommand { |
581 let g:mydict = { | 584 g:mydict = { |
582 'key': 'value' } | 585 'key': 'value' } |
583 } | 586 } |
584 | 587 |
585 Rationale: The "}" cannot be after a command because it would require parsing | 588 Rationale: The "}" cannot be after a command because it would require parsing |
586 the commands to find it. For consistency with that no command can follow the | 589 the commands to find it. For consistency with that no command can follow the |