diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-11-07 13:35:31 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-11-07 13:35:49 -0300 |
commit | 05ae9781b5d1dbff7bf82051e9ba6f8e3a68953b (patch) | |
tree | d6d72199053903f3aafe0a6752c1bbb75a99a0c9 /runtime | |
parent | 07775c07c0c269fe70effa0489f65fb98143c12c (diff) | |
parent | ea3296ad856fcf6124fbac9c05888745caa5bbab (diff) | |
download | rneovim-05ae9781b5d1dbff7bf82051e9ba6f8e3a68953b.tar.gz rneovim-05ae9781b5d1dbff7bf82051e9ba6f8e3a68953b.tar.bz2 rneovim-05ae9781b5d1dbff7bf82051e9ba6f8e3a68953b.zip |
Merge PR #1255 '[RDY] Set `v:job_data[2]` line-wise and `jobsend(,[list]). (#1243)'
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: |