[vim/vim] Refined autoload mechanism explanation (PR #20833)
ubaldot (Vim Github Repository) <[email protected]>
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/[email protected]> |
Based on the discussion in https://github.com/vim/vim/issues/19205#issuecomment-5065053347, I took the freedom of clarifying an autoload related paragraph that read a bit too cryptic.
I also wanted to add a note by which Section `*52.4* Other mechanisms to use` only applied to legacy Vim.
In-fact, I tried something similar in Vim9 through the following script:
```vim
vim9script noclear
# Note that if you define var did_load inside the if-endif block, then the scope of did_load is confined inside the if-endif block.
export var did_load = false
echom "Initial did_load: " .. did_load
if !did_load
command -nargs=* BNRead BufNetRead(<f-args>)
map <F19> :call BufNetWrite('something')<CR>
did_load = true
echom "Final did_load: " .. did_load
exe 'au FuncUndefined BufNet* source ' .. expand('<sfile>')
finish
endif
def BufNetRead(a: string)
echo 'BufNetRead(' .. string(a) .. ')'
# read defality here
enddef
def BufNetWrite(a: string)
echo 'BufNetWrite(' .. string(a) .. ')'
# write defality here
enddef
```
and I expected to see
```vim
false
true
true
```
But I got:
```vim
false
true
false
true
```
which suggests that what is suggested there only apply to legacy vim script.
You can view, comment on, or merge this pull request online at:
https://github.com/vim/vim/pull/20833
-- Commit Summary --
* Refined autoload mechanism explanation
-- File Changes --
M runtime/doc/usr_52.txt (129)
-- Patch Links --
https://github.com/vim/vim/pull/20833.patch
https://github.com/vim/vim/pull/20833.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20833
You are receiving this because you are subscribed to this thread.
Message ID: <vim/vim/pull/[email protected]>
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20833%40github.com.