runtime(doc): mention using <script> instead of <sfile> in :autocmd
fixes: #17569
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 204a911..d11cb1f 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt* For Vim version 9.1. Last change: 2025 Apr 21
+*autocmd.txt* For Vim version 9.1. Last change: 2025 Jun 19
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -130,6 +130,10 @@
:au BufNewFile,BufRead *.html so <sfile>:h/html.vim
Here Vim expands <sfile> to the name of the file containing this line.
+However, <sfile> works differently in a function, in which case it's better to
+use `:execute` with <script> to achieve the same purpose:
+>
+ :exe $'au BufNewFile,BufRead *.html so {expand("<script>:h")}/html.vim'
`:autocmd` adds to the list of autocommands regardless of whether they are
already present. When your .vimrc file is sourced twice, the autocommands