comparison runtime/doc/vim9.txt @ 25939:377a7686a52f v8.2.3503

patch 8.2.3503: Vim9: using g:pat:cmd is confusing Commit: https://github.com/vim/vim/commit/7b829268921e8fc1c63c34d245063c1c4e7d21af Author: Bram Moolenaar <Bram@vim.org> Date: Wed Oct 13 15:04:34 2021 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Wed, 13 Oct 2021 16:15:04 +0200
parents 65de67669df3
children 3b34837f4538
comparison
equal deleted inserted replaced
25938:26aa27d37199 25939:377a7686a52f
940 'text'->func() Vim9: method call 940 'text'->func() Vim9: method call
941 :'t Vim9: jump to mark t 941 :'t Vim9: jump to mark t
942 942
943 Some Ex commands can be confused with assignments in Vim9 script: > 943 Some Ex commands can be confused with assignments in Vim9 script: >
944 g:name = value # assignment 944 g:name = value # assignment
945 :g:pattern:cmd # :global command
946
947 To avoid confusion between a `:global` or `:substitute` command and an
948 expression or assignment, a few separators cannot be used when these commands
949 are abbreviated to a single character: ':', '-' and '.'. >
945 g:pattern:cmd # invalid command - ERROR 950 g:pattern:cmd # invalid command - ERROR
946 :g:pattern:cmd # :global command 951 s:pattern:repl # invalid command - ERROR
952 g-pattern-cmd # invalid command - ERROR
953 s-pattern-repl # invalid command - ERROR
954 g.pattern.cmd # invalid command - ERROR
955 s.pattern.repl # invalid command - ERROR
956
957 Also, there cannot be a space between the command and the separator: >
958 g /pattern/cmd # invalid command - ERROR
959 s /pattern/repl # invalid command - ERROR
947 960
948 Functions defined with `:def` compile the whole function. Legacy functions 961 Functions defined with `:def` compile the whole function. Legacy functions
949 can bail out, and the following lines are not parsed: > 962 can bail out, and the following lines are not parsed: >
950 func Maybe() 963 func Maybe()
951 if !has('feature') 964 if !has('feature')