diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-23 18:12:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 18:12:28 +0800 |
commit | df4709ddf6d1ed524adae9373ecb762b9db11814 (patch) | |
tree | d65ac06e9560138c20f09d6f8269b4d9e2d29713 /runtime | |
parent | 42e9fe7d958e0ba025034c330d8e29293d828b60 (diff) | |
parent | d459b6687704b7d1f230d0b14c0d59f87cf5f67d (diff) | |
download | rneovim-df4709ddf6d1ed524adae9373ecb762b9db11814.tar.gz rneovim-df4709ddf6d1ed524adae9373ecb762b9db11814.tar.bz2 rneovim-df4709ddf6d1ed524adae9373ecb762b9db11814.zip |
Merge pull request #19905 from zeertzjq/vim-8.2.4726
vim-patch:8.2.{4726,4740,4741,4749,4841,4842}: expand('<script>')
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 5 | ||||
-rw-r--r-- | runtime/doc/cmdline.txt | 8 | ||||
-rw-r--r-- | runtime/syntax/synload.vim | 2 | ||||
-rw-r--r-- | runtime/syntax/syntax.vim | 3 |
4 files changed, 15 insertions, 3 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index a47eae8274..df00c67082 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2013,6 +2013,8 @@ expand({string} [, {nosuf} [, {list}]]) *expand()* a function <SID> "<SNR>123_" where "123" is the current script ID |<SID>| + <script> sourced script file, or script file + where the current function was defined <stack> call stack <cword> word under the cursor <cWORD> WORD under the cursor @@ -2046,6 +2048,9 @@ expand({string} [, {nosuf} [, {list}]]) *expand()* is not defined, an empty string is used. Using "%:p" in a buffer with no name, results in the current directory, with a '/' added. + When 'verbose' is set then expanding '%', '#' and <> items + will result in an error message if the argument cannot be + expanded. When {string} does not start with '%', '#' or '<', it is expanded like a file name is expanded on the command line. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 29eff75bfa..f19671e713 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -881,7 +881,7 @@ Note: these are typed literally, they are not special keys! file name of the sourced file. *E498* When executing a function, is replaced with the call stack, as with <stack> (this is for backwards compatibility, using - <stack> is preferred). + <stack> or <script> is preferred). Note that filename-modifiers are useless when <sfile> is not used inside a script. *:<stack>* *<stack>* @@ -891,6 +891,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* diff --git a/runtime/syntax/synload.vim b/runtime/syntax/synload.vim index b88cd95103..056e38bf79 100644 --- a/runtime/syntax/synload.vim +++ b/runtime/syntax/synload.vim @@ -30,7 +30,7 @@ fun! s:SynSet() unlet b:current_syntax endif - let s = expand("<amatch>") + 0verbose let s = expand("<amatch>") if s == "ON" " :set syntax=ON if &filetype == "" diff --git a/runtime/syntax/syntax.vim b/runtime/syntax/syntax.vim index ac7dc314b9..55a2ee6d71 100644 --- a/runtime/syntax/syntax.vim +++ b/runtime/syntax/syntax.vim @@ -28,8 +28,9 @@ endif " Set up the connection between FileType and Syntax autocommands. " This makes the syntax automatically set when the file type is detected. +" Avoid an error when 'verbose' is set and <amatch> expansion fails. augroup syntaxset - au! FileType * exe "set syntax=" . expand("<amatch>") + au! FileType * 0verbose exe "set syntax=" . expand("<amatch>") augroup END |