Skip to content

Instantly share code, notes, and snippets.

@mhinz
Created July 14, 2016 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhinz/1e332b4552130fdc5bf36234fe4da754 to your computer and use it in GitHub Desktop.
Save mhinz/1e332b4552130fdc5bf36234fe4da754 to your computer and use it in GitHub Desktop.
let s:buf = []
function! s:error(msgs)
redraw
echohl ErrorMsg
for line in a:msgs
echomsg line
endfor
echohl NONE
endfunction
function! s:on_stdout(id, data)
let s:buf += a:data
endfunction
function! s:on_exit(id)
call s:error(filter(s:buf, '!empty(v:val)'))
endfunction
call jobstart('echo foo && echo bar', {
\ 'on_stdout': function('s:on_stdout'),
\ 'on_exit': function('s:on_exit'),
\ })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment