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)
This commit is contained in:
LemonBoy
2022-04-09 21:42:10 +01:00
committed by Bram Moolenaar
parent 2ce97ae6aa
commit 6013d0045d
7 changed files with 114 additions and 10 deletions

View File

@ -939,7 +939,7 @@ Note: these are typed literally, they are not special keys!
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 @@ Note: these are typed literally, they are not special keys!
".." 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*