1- *channel.txt* For Vim version 7.4. Last change: 2016 May 24
1+ *channel.txt* For Vim version 7.4. Last change: 2016 Jul 07
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -495,6 +495,9 @@ time a line is added to the buffer, the last-but-one line will be send to the
495495job stdin. This allows for editing the last line and sending it when pressing
496496Enter.
497497
498+ NUL bytes in the text will be passed to the job (internally Vim stores these
499+ as NL bytes).
500+
498501
499502Reading job output in the close callback ~
500503 *read-in-close-cb*
@@ -573,13 +576,13 @@ See |job_setoptions()| and |ch_setoptions()|.
573576 "err_cb" wasn't set the channel callback is used.
574577 *job-close_cb*
575578"close_cb": handler Callback for when the channel is closed. Same as
576- "close_cb" on ch_open().
579+ "close_cb" on | ch_open() | , see | close_cb | .
577580 *job-exit_cb*
578581"exit_cb": handler Callback for when the job ends. The arguments are the
579582 job and the exit status.
580583 Vim checks about every 10 seconds for jobs that ended.
581- The callback can also be triggered by calling
582- | job_status() | .
584+ The check also be triggered by calling | job_status() | ,
585+ which may then invoke the exit_cb handler .
583586 Note that data can be buffered, callbacks may still be
584587 called after the process ends.
585588 *job-timeout*
@@ -625,18 +628,22 @@ See |job_setoptions()| and |ch_setoptions()|.
625628"out_io": "null" disconnect stdout (goes to /dev/null)
626629"out_io": "pipe" stdout is connected to the channel (default)
627630"out_io": "file" stdout writes to a file
628- "out_io": "buffer" stdout appends to a buffer
631+ "out_io": "buffer" stdout appends to a buffer (see below)
629632"out_name": "/path/file" the name of the file or buffer to write to
630633"out_buf": number the number of the buffer to write to
634+ "out_modifiable": 0 when writing to a buffer, 'modifiable' will be off
635+ (see below)
631636
632637 *job-err_io* *err_name* *err_buf*
633638"err_io": "out" stderr messages to go to stdout
634639"err_io": "null" disconnect stderr (goes to /dev/null)
635640"err_io": "pipe" stderr is connected to the channel (default)
636641"err_io": "file" stderr writes to a file
637- "err_io": "buffer" stderr appends to a buffer
642+ "err_io": "buffer" stderr appends to a buffer (see below)
638643"err_name": "/path/file" the name of the file or buffer to write to
639644"err_buf": number the number of the buffer to write to
645+ "err_modifiable": 0 when writing to a buffer, 'modifiable' will be off
646+ (see below)
640647
641648"block_write": number only for testing: pretend every other write to stdin
642649 will block
@@ -655,19 +662,33 @@ When using JS or JSON mode with "buffer", only messages with zero or negative
655662ID will be added to the buffer, after decoding + encoding. Messages with a
656663positive number will be handled by a callback, commands are handled as usual.
657664
658- The name of the buffer is compared the full name of existing buffers. If
659- there is a match that buffer is used. Otherwise a new buffer is created.
660- Use an empty name to always create a new buffer. | ch_getbufnr() | can then be
661- used to get the buffer number.
665+ The name of the buffer from "out_name" or "err_name" is compared the full name
666+ of existing buffers, also after expanding the name for the current directory.
667+ E.g., when a buffer was created with ":edit somename" and the buffer name is
668+ "somename" it will use that buffer.
669+
670+ If there is no matching buffer a new buffer is created. Use an empty name to
671+ always create a new buffer. | ch_getbufnr() | can then be used to get the
672+ buffer number.
662673
663674For a new buffer 'buftype' is set to "nofile" and 'bufhidden' to "hide". If
664675you prefer other settings, create the buffer first and pass the buffer number.
665676
677+ The "out_modifiable" and "err_modifiable" options can be used to set the
678+ 'modifiable' option off, or write to a buffer that has 'modifiable' off. That
679+ means that lines will be appended to the buffer, but the user can't easily
680+ change the buffer.
681+
682+ When an existing buffer is to be written where 'modifiable' is off and the
683+ "out_modifiable" or "err_modifiable" options is not zero, an error is given
684+ and the buffer will not be written to.
685+
666686When the buffer written to is displayed in a window and the cursor is in the
667687first column of the last line, the cursor will be moved to the newly added
668688line and the window is scrolled up to show the cursor if needed.
669689
670- Undo is synced for every added line.
690+ Undo is synced for every added line. NUL bytes are accepted (internally Vim
691+ stores these as NL bytes).
671692
672693
673694Writing to a file ~
0 commit comments