patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful

Problem:    Vim9: the "autoload" argument of ":vim9script" is not useful.
Solution:   Remove the argument. (closes #9555)
This commit is contained in:
Bram Moolenaar
2022-01-18 16:26:24 +00:00
parent 6079da7cfb
commit fd218c8a36
6 changed files with 28 additions and 36 deletions

View File

@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2022 Jan 15
*vim9.txt* For Vim version 8.2. Last change: 2022 Jan 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1523,17 +1523,18 @@ actually needed. Using the autoload mechanism is recommended:
directory.
2. In the autoload script put the bulk of the code. >
vim9script autoload
vim9script
export def Stuff(arg: string)
...
< This goes in .../autoload/for/search.vim.
Adding "autoload" to `:vim9script` has the effect that "for#search#" will
be prefixed to every exported item. The prefix is obtained from the file
name, as you would to manually in a legacy autoload script. Thus the
exported function can be found with "for#search#Stuff", but you would
normally use `import autoload` and not need to specify the prefix.
Putting the "search.vim" script under the "/autoload/for/" directory has
the effect that "for#search#" will be prefixed to every exported item. The
prefix is obtained from the file name, as you would to manually in a
legacy autoload script. Thus the exported function can be found with
"for#search#Stuff", but you would normally use `import autoload` and not
use the prefix.
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.