diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 7 | ||||
-rw-r--r-- | runtime/doc/job_control.txt | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 869c416b88..fca8ac1291 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4014,8 +4014,15 @@ items({dict}) *items()* jobsend({job}, {data}) {Nvim} *jobsend()* Send data to {job} by writing it to the stdin of the process. + Returns 1 if the write succeeded, 0 otherwise. See |job-control| for more information. + {data} may be a string, string convertible, or a list. If + {data} is a list, the items will be separated by newlines and + any newlines in an item will be sent as a NUL. For example: > + :call jobsend(j, ["abc", "123\n456"]) +< will send "abc<NL>123<NUL>456<NL>". + jobstart({name}, {prog}[, {argv}]) {Nvim} *jobstart()* Spawns {prog} as a job and associate it with the {name} string, which will be used to match the "filename pattern" in diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt index 49ee3889bc..226244875d 100644 --- a/runtime/doc/job_control.txt +++ b/runtime/doc/job_control.txt @@ -47,9 +47,9 @@ event. The best way to understand is with a complete example: function JobHandler() if v:job_data[1] == 'stdout' - let str = 'shell '. v:job_data[0].' stdout: '.v:job_data[2] + let str = 'shell '. v:job_data[0].' stdout: '.join(v:job_data[2]) elseif v:job_data[1] == 'stderr' - let str = 'shell '.v:job_data[0].' stderr: '.v:job_data[2] + let str = 'shell '.v:job_data[0].' stderr: '.join(v:job_data[2]) else let str = 'shell '.v:job_data[0].' exited' endif @@ -80,8 +80,8 @@ Here's what is happening: following elements: 0: The job id 1: The kind of activity: one of "stdout", "stderr" or "exit" - 2: When "activity" is "stdout" or "stderr", this will contain the data read - from stdout or stderr + 2: When "activity" is "stdout" or "stderr", this will contain a list of + lines read from stdout or stderr To send data to the job's stdin, one can use the |jobsend()| function, like this: |