Created
April 26, 2014 16:06
-
-
Save DarrylDias/11323861 to your computer and use it in GitHub Desktop.
Neovim job control demo Original file: http://pastebin.com/hpiCP9Ae
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
:let srv1_id = jobstart('netcat-server-1', 'nc', ['-l', '9991']) | |
:let srv2_id = jobstart('netcat-server-2', 'nc', ['-l', '9991']) | |
function JobEvent() | |
" v:job_data[0] = the job id | |
" v:job_data[1] = the event type, one of "stdout", "stderr" or "exit" | |
" v:job_data[2] = data read from stdout or stderr | |
if v:job_data[1] == 'stdout' | |
let str = 'Message from job '.v:job_data[0].': '.v:job_data[2] | |
elseif v:job_data[1] == 'stderr' | |
let str = 'Error message from job '.v:job_data[0].': '.v:job_data[2] | |
else | |
" Exit | |
let str = 'Job '.v:job_data[0].' exited' | |
endif | |
call append(line('$'), str) | |
endfunction | |
au JobActivity netcat-server-* call JobEvent() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment