From 259f443a934c6f2447a14bfe54403903416a9af0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 Dec 2021 12:45:22 +0000 Subject: 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 #9352) --- runtime/doc/vim9.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 990d759e6..39affbfc2 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -560,7 +560,6 @@ This can be useful for a timer, for example: > echom 'Handler called ' .. count }, {repeat: 3}) - The ending "}" must be at the start of a line. It can be followed by other characters, e.g.: > var d = mapnew(dict, (k, v): string => { @@ -568,17 +567,21 @@ characters, e.g.: > }) No command can follow the "{", only a comment can be used there. + *command-block* +The block can also be used for defining a user command. Inside the block Vim9 +syntax will be used. + If the statements include a dictionary, its closing bracket must not be written at the start of a line. Otherwise, it would be parsed as the end of the block. This does not work: > command NewCommand { - let g:mydict = { + g:mydict = { 'key': 'value', } # ERROR: will be recognized as the end of the block } Put the '}' after the last item to avoid this: > command NewCommand { - let g:mydict = { + g:mydict = { 'key': 'value' } } -- cgit v1.2.1