Skip to content

Commit a27e65c

Browse files
committed
Account for change in <sfile> in Vim 8.2
The output of expand('<sfile>') inside a function now differs in that it lists multiple function names for nested calls delimited by '..'. We need to extract the last function name to determine the current script number.
1 parent 78c2fa0 commit a27e65c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

autoload/composer.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ endfunction
5757
""
5858
" Get Funcref from script-local function {name}.
5959
function! s:function(name) abort
60-
return function(substitute(a:name, '^s:', matchstr(expand('<sfile>'), '<SNR>\d\+_'), ''))
60+
let func_name = split(expand('<sfile>'), '\.\.')[-1]
61+
return function(substitute(a:name, '^s:', matchstr(func_name, '<SNR>\d\+_'), ''))
6162
endfunction
6263

6364
""

0 commit comments

Comments
 (0)