From 5ed11535e0695163cec71033b98bb97356cf0113 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Jul 2022 13:18:11 +0100 Subject: Update runtime files --- runtime/doc/map.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 5efc5076f8..e4332b8d4a 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -374,15 +374,17 @@ command: it is executed as if an (unrestricted) |autocommand| was invoked. is like but sets the context to the script the mapping was defined in, for the duration of the command execution. This is especially useful for |Vim9| script. It also works to access an import, which is useful -in a plugin using an autoload script: > +in a plugin using a, possibly autoloaded, script: > vim9script import autoload 'implementation.vim' as impl nnoremap impl.DoTheWork() - +< No matter where is typed, the "impl" import will be found in the script -context of where the mapping was defined. And since it's an autoload import, -the "implementation.vim" script will only be loaded once is typed, not -when the mapping is defined. +context of where the mapping was defined. When it's an autoload import, as in +the example, the "implementation.vim" script will only be loaded once is +typed, not when the mapping is defined. + +Without using "s:impl" would result in "E121: Undefined variable". Note: - Because and avoid mode-changes it does not trigger -- cgit v1.2.3