-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimdoc.diff
More file actions
86 lines (78 loc) · 3.62 KB
/
Copy pathvimdoc.diff
File metadata and controls
86 lines (78 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 5e77a8100..0436007ff 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -1,4 +1,4 @@
-*repeat.txt* For Vim version 9.2. Last change: 2026 Sep 25
+*repeat.txt* For Vim version 9.2. Last change: 2026 Sep 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -248,6 +248,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
Read the script without running it: only what defines
something is executed, then every |:def| function in
it is compiled and the errors are reported as usual.
+
What is executed: `vim9script`, `import`, `def`,
`function`, `class`, `interface`, `enum`, `type` and a
declaration with `var`, `const` or `final`. The
@@ -256,17 +257,27 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
expression is not evaluated. A static class variable
is treated the same way and an enum value is not
created.
+
Everything else is skipped, also `finish` and the
condition of an `if`, `while` or `for`; a definition
inside such a block is executed whether the condition
holds or not. A function may therefore be defined
twice, the last definition counts.
+
+ In a legacy script `let` is not executed, thus a
+ script variable created by it does not exist. A
+ |:def| function can use it with "s:", but reading it
+ or calling it without "s:" gives an error. Defining a
+ function in a Dictionary it holds, such as
+ `function s:obj.Method()`, fails as well.
+
A script that is imported is read the same way, but an
autoload script is not loaded. No |SourceCmd|,
|SourcePre| or |SourcePost| autocommand is triggered.
A class or enum in an autoload script is defined again
by a dry run, and after one by a normal load, since no
object was made from it; see |vim9-reload|.
+
Note: An error in a definition does not stop the
reading, the rest of the script is read as well. And
an error in a line of a function does not stop
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index fd0178896..f2145933c 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.2. Last change: 2026 Sep 25
+*version9.txt* For Vim version 9.2. Last change: 2026 Sep 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -52719,6 +52719,8 @@ Changed ~
- The highlighting groups |hl-CursorLineFold| and |hl-CursorLineSign| are
always used when 'cursorline' is set.
- Virtual text above a line is now counted by |screenpos()| and |virtcol()|.
+- A |:def| function in a legacy script can no longer create a script-local
+ variable by assigning to it, this gives |E1089|.
*added-9.3*
Added ~
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index bf4d0087e..dd7fef9dd 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1,4 +1,4 @@
-*vim9.txt* For Vim version 9.2. Last change: 2026 Sep 25
+*vim9.txt* For Vim version 9.2. Last change: 2026 Sep 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3610,7 +3610,9 @@ or within a `:function`. The three rules are:
regardless of the function's parent context. Similarly, it gives E1268 in
the script-local scope of a Vim9 script.
3. In a legacy Vim script, "s:" is optional in a `:def` function, regardless
- of the function's parent context.
+ of the function's parent context. A `:def` function cannot create a
+ script-local variable, assigning to one that does not exist when the
+ function is compiled gives |E1089|.
The following three scripts demonstrate these rules:
>vim