patch 8.1.1912: more functions can be used as methods
Problem: More functions can be used as methods. Solution: Make channel and job functions usable as a method.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 8.1. Last change: 2019 Jul 28
|
||||
*channel.txt* For Vim version 8.1. Last change: 2019 Aug 22
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -474,18 +474,25 @@ ch_canread({handle}) *ch_canread()*
|
||||
Note that messages are dropped when the channel does not have
|
||||
a callback. Add a close callback to avoid that.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_canread()
|
||||
|
||||
ch_close({handle}) *ch_close()*
|
||||
Close {handle}. See |channel-close|.
|
||||
{handle} can be a Channel or a Job that has a Channel.
|
||||
A close callback is not invoked.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_close()
|
||||
|
||||
ch_close_in({handle}) *ch_close_in()*
|
||||
Close the "in" part of {handle}. See |channel-close-in|.
|
||||
{handle} can be a Channel or a Job that has a Channel.
|
||||
A close callback is not invoked.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_close_in()
|
||||
|
||||
|
||||
ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
Send {expr} over {handle}. The {expr} is encoded
|
||||
@ -501,6 +508,9 @@ ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
expression. When there is an error or timeout it returns an
|
||||
empty string.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_evalexpr(expr)
|
||||
|
||||
|
||||
ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()*
|
||||
Send {string} over {handle}.
|
||||
@ -516,6 +526,8 @@ ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()*
|
||||
need to use |ch_readraw()| to fetch the rest.
|
||||
See |channel-use|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_evalraw(rawstring)
|
||||
|
||||
ch_getbufnr({handle}, {what}) *ch_getbufnr()*
|
||||
Get the buffer number that {handle} is using for {what}.
|
||||
@ -524,12 +536,17 @@ ch_getbufnr({handle}, {what}) *ch_getbufnr()*
|
||||
socket output.
|
||||
Returns -1 when there is no buffer.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_getbufnr(what)
|
||||
|
||||
ch_getjob({channel}) *ch_getjob()*
|
||||
Get the Job associated with {channel}.
|
||||
If there is no job calling |job_status()| on the returned Job
|
||||
will result in "fail".
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_getjob()
|
||||
|
||||
|
||||
ch_info({handle}) *ch_info()*
|
||||
Returns a Dictionary with information about {handle}. The
|
||||
@ -558,6 +575,9 @@ ch_info({handle}) *ch_info()*
|
||||
"in_io" "null", "pipe", "file" or "buffer"
|
||||
"in_timeout" timeout in msec
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_info()
|
||||
|
||||
|
||||
ch_log({msg} [, {handle}]) *ch_log()*
|
||||
Write {msg} in the channel log file, if it was opened with
|
||||
@ -567,6 +587,9 @@ ch_log({msg} [, {handle}]) *ch_log()*
|
||||
{handle} can be a Channel or a Job that has a Channel. The
|
||||
Channel must be open for the channel number to be used.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
'did something'->ch_log()
|
||||
|
||||
|
||||
ch_logfile({fname} [, {mode}]) *ch_logfile()*
|
||||
Start logging channel activity to {fname}.
|
||||
@ -584,6 +607,9 @@ ch_logfile({fname} [, {mode}]) *ch_logfile()*
|
||||
aware that this may contain confidential and privacy sensitive
|
||||
information, e.g. a password you type in a terminal window.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
'logfile'->ch_logfile('w')
|
||||
|
||||
|
||||
ch_open({address} [, {options}]) *ch_open()*
|
||||
Open a channel to {address}. See |channel|.
|
||||
@ -595,6 +621,9 @@ ch_open({address} [, {options}]) *ch_open()*
|
||||
If {options} is given it must be a |Dictionary|.
|
||||
See |channel-open-options|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetAddress()->ch_open()
|
||||
|
||||
|
||||
ch_read({handle} [, {options}]) *ch_read()*
|
||||
Read from {handle} and return the received message.
|
||||
@ -603,11 +632,17 @@ ch_read({handle} [, {options}]) *ch_read()*
|
||||
there is nothing more to read (channel was closed).
|
||||
See |channel-more|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_read()
|
||||
|
||||
|
||||
ch_readblob({handle} [, {options}]) *ch_readblob()*
|
||||
Like ch_read() but reads binary data and returns a |Blob|.
|
||||
See |channel-more|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_readblob()
|
||||
|
||||
|
||||
ch_readraw({handle} [, {options}]) *ch_readraw()*
|
||||
Like ch_read() but for a JS and JSON channel does not decode
|
||||
@ -615,6 +650,9 @@ ch_readraw({handle} [, {options}]) *ch_readraw()*
|
||||
the NL to arrive, but otherwise works like ch_read().
|
||||
See |channel-more|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_readraw()
|
||||
|
||||
|
||||
ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
Send {expr} over {handle}. The {expr} is encoded
|
||||
@ -623,6 +661,9 @@ ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
See |channel-use|. *E912*
|
||||
{handle} can be a Channel or a Job that has a Channel.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_sendexpr(expr)
|
||||
|
||||
|
||||
ch_sendraw({handle}, {expr} [, {options}]) *ch_sendraw()*
|
||||
Send |String| or |Blob| {expr} over {handle}.
|
||||
@ -633,6 +674,9 @@ ch_sendraw({handle}, {expr} [, {options}]) *ch_sendraw()*
|
||||
is removed.
|
||||
See |channel-use|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_sendraw(rawexpr)
|
||||
|
||||
|
||||
ch_setoptions({handle}, {options}) *ch_setoptions()*
|
||||
Set options on {handle}:
|
||||
@ -648,6 +692,9 @@ ch_setoptions({handle}, {options}) *ch_setoptions()*
|
||||
These options cannot be changed:
|
||||
"waittime" only applies to |ch_open()|
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_setoptions(options)
|
||||
|
||||
|
||||
ch_status({handle} [, {options}]) *ch_status()*
|
||||
Return the status of {handle}:
|
||||
@ -664,6 +711,8 @@ ch_status({handle} [, {options}]) *ch_status()*
|
||||
"err". For example, to get the error status: >
|
||||
ch_status(job, {"part": "err"})
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
GetChannel()->ch_status()
|
||||
|
||||
==============================================================================
|
||||
9. Starting a job with a channel *job-start* *job*
|
||||
@ -792,6 +841,8 @@ job_getchannel({job}) *job_getchannel()*
|
||||
To check if the job has no channel: >
|
||||
if string(job_getchannel()) == 'channel fail'
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
GetJob()->job_getchannel()
|
||||
|
||||
job_info([{job}]) *job_info()*
|
||||
Returns a Dictionary with information about {job}:
|
||||
@ -817,12 +868,18 @@ job_info([{job}]) *job_info()*
|
||||
|
||||
Without any arguments, returns a List with all Job objects.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetJob()->job_info()
|
||||
|
||||
|
||||
job_setoptions({job}, {options}) *job_setoptions()*
|
||||
Change options for {job}. Supported are:
|
||||
"stoponexit" |job-stoponexit|
|
||||
"exit_cb" |job-exit_cb|
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetJob()->job_setoptions(options)
|
||||
|
||||
|
||||
job_start({command} [, {options}]) *job_start()*
|
||||
Start a job and return a Job object. Unlike |system()| and
|
||||
@ -881,6 +938,9 @@ job_start({command} [, {options}]) *job_start()*
|
||||
{options} must be a Dictionary. It can contain many optional
|
||||
items, see |job-options|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
BuildCommand()->job_start()
|
||||
|
||||
|
||||
job_status({job}) *job_status()* *E916*
|
||||
Returns a String with the status of {job}:
|
||||
@ -897,6 +957,9 @@ job_status({job}) *job_status()* *E916*
|
||||
|
||||
For more information see |job_info()|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetJob()->job_status()
|
||||
|
||||
|
||||
job_stop({job} [, {how}]) *job_stop()*
|
||||
Stop the {job}. This can also be used to signal the job.
|
||||
@ -940,6 +1003,9 @@ job_stop({job} [, {how}]) *job_stop()*
|
||||
When using "kill" Vim will assume the job will die and close
|
||||
the channel.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetJob()->job_stop()
|
||||
|
||||
|
||||
==============================================================================
|
||||
12. Job options *job-options*
|
||||
|
||||
Reference in New Issue
Block a user