Mercurial > vim
comparison runtime/doc/vim9.txt @ 28447:6f753a8125f0 v8.2.4748
patch 8.2.4748: cannot use an imported function in a mapping
Commit: https://github.com/vim/vim/commit/8944551534b311a2d25acf6e8db235c6d906256c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 14 12:58:23 2022 +0100
patch 8.2.4748: cannot use an imported function in a mapping
Problem: Cannot use an imported function in a mapping.
Solution: Recognize <SID>name.Func.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 14 Apr 2022 14:00:05 +0200 |
parents | 473cfd79bcd8 |
children | f73a9bdff3a3 |
comparison
equal
deleted
inserted
replaced
28446:224455817fac | 28447:6f753a8125f0 |
---|---|
1718 line, there can be no line break: > | 1718 line, there can be no line break: > |
1719 echo that. | 1719 echo that. |
1720 name # Error! | 1720 name # Error! |
1721 echo that | 1721 echo that |
1722 .name # Error! | 1722 .name # Error! |
1723 < *:import-cycle* | 1723 |
1724 To refer to a function in an imported script in a mapping, |<SID>| can be | |
1725 used: > | |
1726 noremap <silent> ,a :call <SID>name.Function()<CR> | |
1727 | |
1728 When the mapping is defined "<SID>name." will be replaced with <SNR> and the | |
1729 script ID of the imported script. | |
1730 | |
1731 *:import-cycle* | |
1724 The `import` commands are executed when encountered. If script A imports | 1732 The `import` commands are executed when encountered. If script A imports |
1725 script B, and B (directly or indirectly) imports A, this will be skipped over. | 1733 script B, and B (directly or indirectly) imports A, this will be skipped over. |
1726 At this point items in A after "import B" will not have been processed and | 1734 At this point items in A after "import B" will not have been processed and |
1727 defined yet. Therefore cyclic imports can exist and not result in an error | 1735 defined yet. Therefore cyclic imports can exist and not result in an error |
1728 directly, but may result in an error for items in A after "import B" not being | 1736 directly, but may result in an error for items in A after "import B" not being |