comparison runtime/doc/vim9.txt @ 19473:b09afbebffee v8.2.0294

patch 8.2.0294: cannot use Ex command that is also a function name Commit: https://github.com/vim/vim/commit/5b1c8fe3d588ab450d4646a0088db4efda88200a Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 21 18:42:43 2020 +0100 patch 8.2.0294: cannot use Ex command that is also a function name Problem: Cannot use Ex command that is also a function name. Solution: Recognize an Ex command by a colon prefix.
author Bram Moolenaar <Bram@vim.org>
date Fri, 21 Feb 2020 18:45:06 +0100
parents 7be3663e2f2b
children c27837cbe922
comparison
equal deleted inserted replaced
19472:fa1ea6285f80 19473:b09afbebffee
1 *vim9.txt* For Vim version 8.2. Last change: 2020 Feb 13 1 *vim9.txt* For Vim version 8.2. Last change: 2020 Feb 21
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
138 #{a: 1, b: 2}->Process() " works 138 #{a: 1, b: 2}->Process() " works
139 {'a': 1, 'b': 2}->Process() " works 139 {'a': 1, 'b': 2}->Process() " works
140 "foobar"->Process() " does NOT work 140 "foobar"->Process() " does NOT work
141 eval "foobar"->Process() " works 141 eval "foobar"->Process() " works
142 142
143 In case there is ambiguity between a function name and an Ex command, use ":"
144 to make clear you want to use the Ex command. For example, there is both the
145 `:substitute` command and the `substitute()` function. When the line starts
146 with `substitute(` this will use the function, prepend a colon to use the
147 command instead: >
148 :substitute(pattern(replacement(
149
143 150
144 No curly braces expansion ~ 151 No curly braces expansion ~
145 152
146 |curly-braces-names| cannot be used. 153 |curly-braces-names| cannot be used.
147 154
173 call Func 180 call Func
174 \ (arg) " Error! 181 \ (arg) " Error!
175 call Func(arg) " OK 182 call Func(arg) " OK
176 call Func( 183 call Func(
177 \ arg) " OK 184 \ arg) " OK
185 call Func(
186 \ arg " OK
187 \ )
178 188
179 189
180 Conditions and expressions ~ 190 Conditions and expressions ~
181 191
182 Conditions and expression are mostly working like they do in JavaScript. A 192 Conditions and expression are mostly working like they do in JavaScript. A
252 262
253 *:enddef* 263 *:enddef*
254 :enddef End of a function defined with `:def`. 264 :enddef End of a function defined with `:def`.
255 265
256 266
267 If the script the function is defined in is Vim9 script, then script-local
268 variables can be accessed without the "s:" prefix. They must be defined
269 before the function. If the script the function is defined in is legacy
270 script, then script-local variables must be accessed with the "s:" prefix.
271
272
257 *:disa* *:disassemble* 273 *:disa* *:disassemble*
258 :disa[ssemble] {func} Show the instructions generated for {func}. 274 :disa[ssemble] {func} Show the instructions generated for {func}.
259 This is for debugging and testing. 275 This is for debugging and testing.
260 276
261 ============================================================================== 277 ==============================================================================