Skip to content

Commit 40ec57a

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. Fixes #20.
1 parent fc1f5d4 commit 40ec57a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

autoload/laravel.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ endfunction
2626
""
2727
" Get Funcref from script-local function {name}.
2828
function! s:function(name) abort
29-
return function(substitute(a:name, '^s:', matchstr(expand('<sfile>'), '<SNR>\d\+_'), ''))
29+
let func_name = split(expand('<sfile>'), '\.\.')[-1]
30+
return function(substitute(a:name, '^s:', matchstr(func_name, '<SNR>\d\+_'), ''))
3031
endfunction
3132

3233
""

0 commit comments

Comments
 (0)