Update runtime files
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
*vim9.txt* For Vim version 9.0. Last change: 2022 Sep 10
|
||||
*vim9.txt* For Vim version 9.0. Last change: 2022 Sep 15
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -107,7 +107,7 @@ script and `:def` functions; details are below:
|
||||
`:t`
|
||||
`:xit`
|
||||
- Some commands, especially those used for flow control, cannot be shortened.
|
||||
E.g., `:throw` cannot be written as `:th`.
|
||||
E.g., `:throw` cannot be written as `:th`. *vim9-no-shorten*
|
||||
- You cannot use curly-braces names.
|
||||
- A range before a command must be prefixed with a colon: >
|
||||
:%s/this/that
|
||||
@ -1336,16 +1336,15 @@ This will generate error |E1302|: >
|
||||
})
|
||||
endfor
|
||||
|
||||
You need to create a closure to store the current value of "n", so that it is
|
||||
evaluated at the time the closure is created: >
|
||||
def GetClosure(nr: number): func
|
||||
return (_) => {
|
||||
echowindow nr
|
||||
}
|
||||
enddef
|
||||
|
||||
You need to use a block and define a variable there, and use that one in the
|
||||
closure: >
|
||||
for n in range(4)
|
||||
timer_start(500 * n, GetClosure(n))
|
||||
{
|
||||
var nr = n
|
||||
timer_start(500 * n, (_) => {
|
||||
echowin nr
|
||||
})
|
||||
}
|
||||
endfor
|
||||
|
||||
Using `echowindow` is useful in a timer, the messages go into a popup and will
|
||||
@ -1684,7 +1683,7 @@ deleted.
|
||||
|
||||
In Vim9 script the global "g:" namespace can still be used as before. And the
|
||||
"w:", "b:" and "t:" namespaces. These have in common that variables are not
|
||||
declared and they can be deleted.
|
||||
declared, have no specific type and they can be deleted. *E1304*
|
||||
|
||||
A side effect of `:vim9script` is that the 'cpoptions' option is set to the
|
||||
Vim default value, like with: >
|
||||
@ -1825,7 +1824,7 @@ And using the "as name" form: >
|
||||
import "otherfile.vim9script" as that
|
||||
call s:that.OtherFunc()
|
||||
|
||||
However, the namespace cannot be resolved on it's own: >
|
||||
However, the namespace cannot be resolved on its own: >
|
||||
import "that.vim"
|
||||
echo s:that
|
||||
" ERROR: E1060: Expected dot after name: s:that
|
||||
|
||||
Reference in New Issue
Block a user