Created
January 8, 2017 15:58
-
-
Save DaikiMaekawa/8819182f7375c223009a884892312d2c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function! s:JobHandler(job_id, data, event) dict | |
if a:event == 'stdout' | |
let str = self.shell.' stdout: '.join(a:data) | |
elseif a:event == 'stderr' | |
let str = self.shell.' stderr: '.join(a:data) | |
else | |
let str = self.shell.' exited' | |
endif | |
call append(line('$'), str) | |
endfunction | |
let s:callbacks = { | |
\ 'on_stdout': function('s:JobHandler'), | |
\ 'on_stderr': function('s:JobHandler'), | |
\ 'on_exit': function('s:JobHandler') | |
\ } | |
let job1 = jobstart(['bash'], extend({'shell': 'shell 1'}, s:callbacks)) | |
let job2 = jobstart(['bash', '-c', 'for i in {1..10}; do echo hello $i!; sleep 1; done'], extend({'shell': 'shell 2'}, s:callbacks)) | |
let job3 = jobstart(['/home/daikimaekawa/neovim.cpp/build/test'], extend({'shell': 'shell 3'}, s:callbacks)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
do this.
$ nvim -u NONE -S /path/to/jobcontrol.vim