patch 8.2.3503: Vim9: using g:pat:cmd is confusing
Problem: Vim9: using g:pat:cmd is confusing.
Solution: Do not recognize g: as the :global command. Also for s:pat:repl.
(closes #8982)
This commit is contained in:
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user