Created
September 27, 2016 10:33
-
-
Save mhinz/a5d126e6c702a6ffd0347aa70c9ccb39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let data1 = [] | |
let data2 = [] | |
let cmd1 = ['sh', '-c', 'ag --vimgrep foo'] | |
let cmd2 = ['sh', '-c', 'rg --no-heading --vimgrep -i foo'] | |
function! s:stdout1(channel, data) | |
let g:data1 += [a:data] | |
endfunction | |
function! s:stdout2(channel, data) | |
let g:data2 += [a:data] | |
endfunction | |
function! s:exit1(channel) | |
echohl WarningMsg | |
echomsg 'RESULT AG: '. string(g:data1[:10]) | |
echohl NONE | |
endfunction | |
function! s:exit2(channel) | |
echohl ErrorMsg | |
echomsg 'RESULT RG: '. string(g:data2[:10]) | |
echohl NONE | |
endfunction | |
echomsg job_start(cmd1, { | |
\ 'err_io': 'out', | |
\ 'out_cb': function('s:stdout1'), | |
\ 'close_cb': function('s:exit1'), | |
\ }) | |
echomsg job_start(cmd2, { | |
\ 'err_io': 'out', | |
\ 'out_cb': function('s:stdout2'), | |
\ 'close_cb': function('s:exit2'), | |
\ }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment