@@ -71,16 +71,17 @@ comments start with #. >
7171
7272 The reason is that a double quote can also be the start of a string. In many
7373places, especially halfway an expression with a line break, it's hard to tell
74- what the meaning is. To avoid confusion only # comments are recognized.
75- This is the same as in shell scripts and Python programs.
74+ what the meaning is, since both a string and a comment can be followed by
75+ arbitrary text. To avoid confusion only # comments are recognized. This is
76+ the same as in shell scripts and Python programs.
7677
7778In Vi # is a command to list text with numbers. In Vim9 script you can use
7879`:number ` for that. >
79- 101number
80+ 101 number
8081
8182 To improve readability there must be a space between a command and the #
8283that starts a comment. Note that #{ is the start of a dictionary, therefore
83- it cannot start a comment.
84+ it does not start a comment.
8485
8586
8687Vim9 functions ~
@@ -93,7 +94,7 @@ The syntax is strict, to enforce code that is easy to read and understand.
9394
9495Compilation is done when the function is first called, or when the
9596`:defcompile ` command is encountered in the script where the function was
96- defined.
97+ defined. `: disassemble ` also compiles the function.
9798
9899`:def ` has no options like `:function ` does: "range", "abort", "dict" or
99100"closure". A `:def ` function always aborts on an error, does not get a range
@@ -104,7 +105,7 @@ be used, type checking will then be done at runtime, like with legacy
104105functions.
105106
106107Arguments are accessed by name, without "a:". There is no "a:" dictionary or
107- "a:000" list.
108+ "a:000" list. Just like any other language.
108109
109110Variable arguments are defined as the last argument, with a name and have a
110111list type, similar to Typescript. For example, a list of numbers: >
@@ -216,29 +217,29 @@ Functions can be called without `:call`: >
216217 Using `:call ` is still possible, but this is discouraged.
217218
218219A method call without `eval ` is possible, so long as the start is an
219- identifier or can't be an Ex command. It does NOT work for string constants : >
220- myList->add(123) # works
221- g:myList->add(123) # works
222- [1, 2, 3]->Process() # works
223- #{a: 1, b: 2}->Process() # works
224- {'a': 1, 'b': 2}->Process() # works
225- "foobar"->Process() # does NOT work
226- ("foobar")->Process() # works
227- 'foobar'->Process() # does NOT work
228- ('foobar')->Process() # works
229-
230- In case there is ambiguity between a function name and an Ex command, use ":"
231- to make clear you want to use the Ex command. For example, there is both the
232- `:substitute ` command and the `substitute ()` function. When the line starts
233- with `substitute (` this will use the function, prepend a colon to use the
234- command instead: >
220+ identifier or can't be an Ex command. Examples : >
221+ myList->add(123)
222+ g:myList->add(123)
223+ [1, 2, 3]->Process()
224+ #{a: 1, b: 2}->Process()
225+ {'a': 1, 'b': 2}->Process()
226+ "foobar"->Process()
227+ ("foobar")->Process()
228+ 'foobar'->Process()
229+ ('foobar')->Process()
230+
231+ In rare case there is ambiguity between a function name and an Ex command, use
232+ ":" to make clear you want to use the Ex command. For example, there is both
233+ the `:substitute ` command and the `substitute ()` function. When the line
234+ starts with `substitute (` this will use the function. Prepend a colon to use
235+ the command instead: >
235236 :substitute(pattern (replacement (
236237
237238 Note that while variables need to be defined before they can be used,
238239functions can be called before being defined. This is required to be able
239240have cyclic dependencies between functions. It is slightly less efficient,
240241since the function has to be looked up by name. And a typo in the function
241- name will only be found when the call is executed .
242+ name will only be found when the function is called .
242243
243244
244245Omitting function() ~
@@ -347,9 +348,10 @@ No curly braces expansion ~
347348| curly-braces-names | cannot be used.
348349
349350
350- No :append, :change or :insert ~
351+ No :xit, : append, :change or :insert ~
351352
352- These commands are too quickly confused with local variable names.
353+ These commands are too easily confused with local variable names. Instead of
354+ `:x ` or `:xit ` you can use `:exit ` .
353355
354356
355357Comparators ~
0 commit comments