summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-10-13 15:04:34 +0100
committerBram Moolenaar <Bram@vim.org>2021-10-13 15:04:34 +0100
commit7b829268921e8fc1c63c34d245063c1c4e7d21af (patch)
treea98bfde122c275ec816159fadb69b7280d1dc380 /runtime
parentfff10d9a76099aa9b944f3c33a911127ca1a0c72 (diff)
patch 8.2.3503: Vim9: using g:pat:cmd is confusingv8.2.3503
Problem: Vim9: using g:pat:cmd is confusing. Solution: Do not recognize g: as the :global command. Also for s:pat:repl. (closes #8982)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/vim9.txt15
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index b6feebf84f..b661097805 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -942,9 +942,22 @@ Ex command ranges need to be prefixed with a colon. >
Some Ex commands can be confused with assignments in Vim9 script: >
g:name = value # assignment
- g:pattern:cmd # invalid command - ERROR
:g:pattern:cmd # :global command
+To avoid confusion between a `:global` or `:substitute` command and an
+expression or assignment, a few separators cannot be used when these commands
+are abbreviated to a single character: ':', '-' and '.'. >
+ g:pattern:cmd # invalid command - ERROR
+ s:pattern:repl # invalid command - ERROR
+ g-pattern-cmd # invalid command - ERROR
+ s-pattern-repl # invalid command - ERROR
+ g.pattern.cmd # invalid command - ERROR
+ s.pattern.repl # invalid command - ERROR
+
+Also, there cannot be a space between the command and the separator: >
+ g /pattern/cmd # invalid command - ERROR
+ s /pattern/repl # invalid command - ERROR
+
Functions defined with `:def` compile the whole function. Legacy functions
can bail out, and the following lines are not parsed: >
func Maybe()