vim计时器标识传在哪

原文

function! MyTest(...) abort
    echo a:000
endfunction

function! CustomGrep(...) abort
    call timer_start(0, function("MyTest", ["xxx"]))
endfunction

显示的是:xxx,18.
所以,计时器标识是在所有参数之后传递的.

function! CustomGrep(...) abort
    call timer_start(0, {-> call(function("MyTest"), ["xxx"])})
endfunction

1),在如下三种之一下释放计时器资源:
1,调用Vim中的timer_stop()函数,在C源代码中调用它的stop_timer()对应函数.
2,调用回调函数后,计时器重复数归0,此时check_due_timer调用free_timer().
3,计时器连续三次遇到错误时.
2),function()可以嵌套,即使用单个参数调用Funcref,它也可能是function绑定arglist或字典创建的Partial.

:h timer_stop()
:h Funcref
:h Partial
:h function()
posted @ 2022-12-11 17:01  zjh6  阅读(21)  评论(0)    收藏  举报  来源