Add vim defer plugin
This commit is contained in:
parent
85d8cae172
commit
dc7f109746
1 changed files with 10 additions and 0 deletions
10
vim/plugin/defer.vim
Normal file
10
vim/plugin/defer.vim
Normal 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 })
|
Loading…
Reference in a new issue