comparison runtime/doc/vim9.txt @ 27215:5b54f413d132 v8.2.4136

patch 8.2.4136: Vim9: the "autoload" argument of ":vim9script" is not useful Commit: https://github.com/vim/vim/commit/fd218c8a36e7ed33f7a205163690c5b7d2f31f8a Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 18 16:26:24 2022 +0000 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 https://github.com/vim/vim/issues/9555)
author Bram Moolenaar <Bram@vim.org>
date Tue, 18 Jan 2022 17:30:05 +0100
parents b19230a8d40a
children 3649b5a6b1b6
comparison
equal deleted inserted replaced
27214:c2954285f431 27215:5b54f413d132
1 *vim9.txt* For Vim version 8.2. Last change: 2022 Jan 15 1 *vim9.txt* For Vim version 8.2. Last change: 2022 Jan 18
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1521 until one of the items is actually used. The script will be found under 1521 until one of the items is actually used. The script will be found under
1522 the "autoload" directory in 'runtimepath' instead of the "import" 1522 the "autoload" directory in 'runtimepath' instead of the "import"
1523 directory. 1523 directory.
1524 1524
1525 2. In the autoload script put the bulk of the code. > 1525 2. In the autoload script put the bulk of the code. >
1526 vim9script autoload 1526 vim9script
1527 export def Stuff(arg: string) 1527 export def Stuff(arg: string)
1528 ... 1528 ...
1529 1529
1530 < This goes in .../autoload/for/search.vim. 1530 < This goes in .../autoload/for/search.vim.
1531 1531
1532 Adding "autoload" to `:vim9script` has the effect that "for#search#" will 1532 Putting the "search.vim" script under the "/autoload/for/" directory has
1533 be prefixed to every exported item. The prefix is obtained from the file 1533 the effect that "for#search#" will be prefixed to every exported item. The
1534 name, as you would to manually in a legacy autoload script. Thus the 1534 prefix is obtained from the file name, as you would to manually in a
1535 exported function can be found with "for#search#Stuff", but you would 1535 legacy autoload script. Thus the exported function can be found with
1536 normally use `import autoload` and not need to specify the prefix. 1536 "for#search#Stuff", but you would normally use `import autoload` and not
1537 use the prefix.
1537 1538
1538 You can split up the functionality and import other scripts from the 1539 You can split up the functionality and import other scripts from the
1539 autoload script as you like. This way you can share code between plugins. 1540 autoload script as you like. This way you can share code between plugins.
1540 1541
1541 For defining a mapping that uses the imported autoload script the special key 1542 For defining a mapping that uses the imported autoload script the special key