-
-
Save piec/ffa8b0707764bf6ae70d to your computer and use it in GitHub Desktop.
Revisions
-
piec revised this gist
Aug 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ set nocp " - The program name. Can be the full path to the program or a $PATH entry " - An array with the program arguments :let srv1_id = jobstart('netcat-server-1', 'nc', ['-l', '-p', '9991']) :let srv2_id = jobstart('netcat-server-2', 'nc', ['-l', '-p', '9991']) function JobEvent() " v:job_data[0] = the job id -
piec revised this gist
Aug 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ set nocp " - The program name. Can be the full path to the program or a $PATH entry " - An array with the program arguments :let srv1_id = jobstart('netcat-server-1', 'nc', ['-l', '-p', '9991']) :let srv2_id = jobstart('netcat-server-2', 'nc', ['-l', '-p', '9992']) function JobEvent() " v:job_data[0] = the job id -
piec revised this gist
Aug 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ " To play with this, use two terminals " " On terminal 1: `nvim -S jobcontrol.vim`. " Use `:call jobwrite(srv1_id, "string") to write " data to the netcat client " On terminal 2: `nc localhost 9991`. Type lines to send data to " nvim -
piec revised this gist
Aug 26, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,8 +19,8 @@ set nocp " - The job "name", this will be used mainly to filter JobActivity autocommands " - The program name. Can be the full path to the program or a $PATH entry " - An array with the program arguments :let srv1_id = jobstart('netcat-server-1', 'nc', ['-l', '-p', '9991']) :let srv2_id = jobstart('netcat-server-2', 'nc', ['-l', '-p', '9991']) function JobEvent() " v:job_data[0] = the job id -
tarruda created this gist
Jul 9, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ " Demo of Neovim job control feature. " " It starts two netcat processes listening on the same TCP port, " the second process will exit immediately since the port will be " unavailable(Used to demonstrate the stderr/exit events) " To play with this, use two terminals " " On terminal 1: `nvim -S jobcontrol.vim`. " Use `:call jobwrite(v:srv1_id, string) to write " data to the netcat client " On terminal 2: `nc localhost 9991`. Type lines to send data to " nvim " " Use `jobstop(job_id)` to stop a running job set nocp " Arguments to jobstart: " - The job "name", this will be used mainly to filter JobActivity autocommands " - The program name. Can be the full path to the program or a $PATH entry " - An array with the program arguments :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 " This autocommand will run whenever there's activity on jobs with names " starting with 'netcat-server-' au JobActivity netcat-server-* call JobEvent()