Add vim defer plugin

This commit is contained in:
Talia 2020-08-19 14:23:39 +02:00
parent 85d8cae172
commit dc7f109746

10
vim/plugin/defer.vim Normal file
View file

@ -0,0 +1,10 @@
function Defer(command, callback)
let l:buffer = []
call job_start(a:command, {
\ "out_io": "pipe",
\ "out_cb": { pipe, text -> add(l:buffer, text) },
\ "close_cb": { pipe -> a:callback(l:buffer) }
\ })
endfun
comm -nargs=* Defer call Defer(<q-args>, { buffer -> 0 })