Update runtime files
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2022 Mar 28
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2022 Mar 30
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -185,7 +185,7 @@ For now you will need to pass the dictionary explicitly: >
|
||||
echo d[arg]
|
||||
enddef
|
||||
var ad = {item: 'value', func: DictFunc}
|
||||
ad.func(d, 'item')
|
||||
ad.func(ad, 'item')
|
||||
|
||||
You can call a legacy dict function though: >
|
||||
func Legacy() dict
|
||||
@ -1745,7 +1745,8 @@ actually needed. Using the autoload mechanism is recommended:
|
||||
The "autoload" argument to `:import` means that the script is not loaded
|
||||
until one of the items is actually used. The script will be found under
|
||||
the "autoload" directory in 'runtimepath' instead of the "import"
|
||||
directory.
|
||||
directory. Alternatively a relative or absolute name can be used, see
|
||||
below.
|
||||
|
||||
2. In the autoload script put the bulk of the code. >
|
||||
vim9script
|
||||
@ -1765,6 +1766,14 @@ actually needed. Using the autoload mechanism is recommended:
|
||||
You can split up the functionality and import other scripts from the
|
||||
autoload script as you like. This way you can share code between plugins.
|
||||
|
||||
Searching for the autoload script in all entries in 'runtimepath' can be a bit
|
||||
slow. If the plugin knows where the script is located, quite often a relative
|
||||
path can be used. This avoids the search and should be quite a bit faster.
|
||||
Another advantage is that the script name does not need to be unique. An
|
||||
absolute path is also possible. Examples: >
|
||||
import autoload '../lib/implement.vim'
|
||||
import autoload MyScriptsDir .. '/lib/implement.vim'
|
||||
|
||||
For defining a mapping that uses the imported autoload script the special key
|
||||
|<ScriptCmd>| is useful. It allows for a command in a mapping to use the
|
||||
script context of where the mapping was defined.
|
||||
|
||||
Reference in New Issue
Block a user