summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-22 18:36:32 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-22 18:36:32 +0100
commit0c6ceaf90389b41545d803458c4813013811c756 (patch)
tree885e0983a420271d5d98b58e7669252d972f8bd5 /runtime
parent8b430b4c1df74bde757a7e5ee0ee2854fdad6472 (diff)
downloadvim-git-0c6ceaf90389b41545d803458c4813013811c756.tar.gz
patch 8.2.0298: Vim9 script: cannot start command with a string constantv8.2.0298
Problem: Vim9 script: cannot start command with a string constant. Solution: Recognize expression starting with '('.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/vim9.txt8
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index c79ae62de..05c1c8e3d 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -131,21 +131,23 @@ Functions can be called without `:call`: >
Using `:call` is still possible, but this is discouraged.
A method call without `eval` is possible, so long as the start is an
-identifier or can't be an Ex command. It does not work for string constants: >
+identifier or can't be an Ex command. It does NOT work for string constants: >
myList->add(123) " works
g:myList->add(123) " works
[1, 2, 3]->Process() " works
#{a: 1, b: 2}->Process() " works
{'a': 1, 'b': 2}->Process() " works
"foobar"->Process() " does NOT work
- eval "foobar"->Process() " works
+ ("foobar")->Process() " works
+ 'foobar'->Process() " does NOT work
+ ('foobar')->Process() " works
In case there is ambiguity between a function name and an Ex command, use ":"
to make clear you want to use the Ex command. For example, there is both the
`:substitute` command and the `substitute()` function. When the line starts
with `substitute(` this will use the function, prepend a colon to use the
command instead: >
- :substitute(pattern(replacement(
+ :substitute(pattern (replacement (
No curly braces expansion ~