diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-21 18:42:43 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-21 18:42:43 +0100 |
commit | 5b1c8fe3d588ab450d4646a0088db4efda88200a (patch) | |
tree | dcfaed845bd66c02605092c0d75ebaba499c800b /runtime/doc | |
parent | 818fc9ad143911b2faa0d7cee86724aa70a02080 (diff) | |
download | vim-git-5b1c8fe3d588ab450d4646a0088db4efda88200a.tar.gz |
patch 8.2.0294: cannot use Ex command that is also a function namev8.2.0294
Problem: Cannot use Ex command that is also a function name.
Solution: Recognize an Ex command by a colon prefix.
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/vim9.txt | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index da4f1634b..c79ae62de 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1,4 +1,4 @@ -*vim9.txt* For Vim version 8.2. Last change: 2020 Feb 13 +*vim9.txt* For Vim version 8.2. Last change: 2020 Feb 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -140,6 +140,13 @@ identifier or can't be an Ex command. It does not work for string constants: > "foobar"->Process() " does NOT work eval "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( + No curly braces expansion ~ @@ -175,6 +182,9 @@ White space is not allowed: call Func(arg) " OK call Func( \ arg) " OK + call Func( + \ arg " OK + \ ) Conditions and expressions ~ @@ -254,6 +264,12 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE :enddef End of a function defined with `:def`. +If the script the function is defined in is Vim9 script, then script-local +variables can be accessed without the "s:" prefix. They must be defined +before the function. If the script the function is defined in is legacy +script, then script-local variables must be accessed with the "s:" prefix. + + *:disa* *:disassemble* :disa[ssemble] {func} Show the instructions generated for {func}. This is for debugging and testing. |