patch 8.2.4726: cannot use expand() to get the script name
Problem: Cannot use expand() to get the script name.
Solution: Support expand('<script>'). (closes #10121)
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index 0867c47..cd9b988 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -939,7 +939,7 @@
file name of the sourced file. *E498*
When executing a legacy function, is replaced with the call
stack, as with <stack> (this is for backwards
- compatibility, using <stack> is preferred).
+ compatibility, using <stack> or <script> is preferred).
In Vim9 script using <sfile> in a function gives error
*E1245* .
Note that filename-modifiers are useless when <sfile> is
@@ -951,6 +951,12 @@
".." in between items. E.g.:
"function {function-name1}[{lnum}]..{function-name2}[{lnum}]"
If there is no call stack you get error *E489* .
+ *:<script>* *<script>*
+ <script> When executing a `:source` command, is replaced with the file
+ name of the sourced file. When executing a function, is
+ replaced with the file name of the script where it is
+ defined.
+ If the file name cannot be determined you get error *E1274* .
*:<slnum>* *<slnum>*
<slnum> When executing a ":source" command, is replaced with the
line number. *E842*