channel.c File Reference
#include "nvim/api/private/helpers.h"
#include "nvim/api/ui.h"
#include "nvim/channel.h"
#include "nvim/eval.h"
#include "nvim/eval/encode.h"
#include "nvim/event/socket.h"
#include "nvim/fileio.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/os/shell.h"
#include "nvim/path.h"
#include "nvim/ascii.h"


 PMap (uint64_t)
 Teardown the module. More...
bool channel_close (uint64_t id, ChannelPart part, const char **error)
void channel_init (void)
 Initializes the module. More...
void channel_create_event (Channel *chan, const char *ext_source)
void channel_incref (Channel *chan)
void channel_decref (Channel *chan)
void callback_reader_free (CallbackReader *reader)
void callback_reader_start (CallbackReader *reader, const char *type)
Channelchannel_job_start (char **argv, CallbackReader on_stdout, CallbackReader on_stderr, Callback on_exit, bool pty, bool rpc, bool detach, const char *cwd, uint16_t pty_width, uint16_t pty_height, char *term_name, char **env, varnumber_T *status_out)
uint64_t channel_connect (bool tcp, const char *address, bool rpc, CallbackReader on_output, int timeout, const char **error)
void channel_from_connection (SocketWatcher *watcher)
uint64_t channel_from_stdio (bool rpc, CallbackReader on_output, const char **error) FUNC_ATTR_NONNULL_ALL
size_t channel_send (uint64_t id, char *data, size_t len, const char **error)
void on_channel_data (Stream *stream, RBuffer *buf, size_t count, void *data, bool eof)
void on_job_stderr (Stream *stream, RBuffer *buf, size_t count, void *data, bool eof)
void channel_reader_callbacks (Channel *chan, CallbackReader *reader)
void channel_terminal_open (Channel *chan)
void channel_info_changed (Channel *chan, bool new)
bool channel_job_running (uint64_t id)
Dictionary channel_info (uint64_t id)
Array channel_all_info (void)

Function Documentation

void callback_reader_free ( CallbackReader reader)
void callback_reader_start ( CallbackReader reader,
const char *  type 
Array channel_all_info ( void  )
bool channel_close ( uint64_t  id,
ChannelPart  part,
const char **  error 

Closes a channel

idThe channel id
true if successful, false otherwise
uint64_t channel_connect ( bool  tcp,
const char *  address,
bool  rpc,
CallbackReader  on_output,
int  timeout,
const char **  error 
void channel_create_event ( Channel chan,
const char *  ext_source 
void channel_decref ( Channel chan)
void channel_from_connection ( SocketWatcher watcher)

Creates an RPC channel from a tcp/pipe socket connection

watcherThe SocketWatcher ready to accept the connection
uint64_t channel_from_stdio ( bool  rpc,
CallbackReader  on_output,
const char **  error 

Creates an API channel from stdin/stdout. This is used when embedding Neovim

void channel_incref ( Channel chan)
Dictionary channel_info ( uint64_t  id)
void channel_info_changed ( Channel chan,
bool  new 
void channel_init ( void  )

Initializes the module.

bool channel_job_running ( uint64_t  id)
Channel* channel_job_start ( char **  argv,
CallbackReader  on_stdout,
CallbackReader  on_stderr,
Callback  on_exit,
bool  pty,
bool  rpc,
bool  detach,
const char *  cwd,
uint16_t  pty_width,
uint16_t  pty_height,
char *  term_name,
char **  env,
varnumber_T status_out 

Starts a job and returns the associated channel

[in]argvArguments vector specifying the command to run, NULL-terminated
[in]on_stdoutCallback to read the job's stdout
[in]on_stderrCallback to read the job's stderr
[in]on_exitCallback to receive the job's exit status
[in]ptyTrue if the job should run attached to a pty
[in]rpcTrue to communicate with the job using msgpack-rpc, on_stdout is ignored
[in]detachTrue if the job should not be killed when nvim exits, ignored if pty is true
[in]cwdInitial working directory for the job. Nvim's working directory if cwd is NULL
[in]pty_widthWidth of the pty, ignored if pty is false
[in]pty_heightHeight of the pty, ignored if pty is false
[in]term_name$TERM for the pty
[in]envNvim's configured environment is used if this is NULL, otherwise defines all environment variables
[out]status_out0 for invalid arguments, > 0 for the channel id, < 0 if the job can't start
[allocated] channel
void channel_reader_callbacks ( Channel chan,
CallbackReader reader 
size_t channel_send ( uint64_t  id,
char *  data,
size_t  len,
const char **  error 
datawill be consumed
void channel_terminal_open ( Channel chan)

Open terminal for channel

Channel chan is assumed to be an open pty channel, and curbuf is assumed to be a new, unmodified buffer.

void on_channel_data ( Stream stream,
RBuffer buf,
size_t  count,
void data,
bool  eof 
void on_job_stderr ( Stream stream,
RBuffer buf,
size_t  count,
void data,
bool  eof 
PMap ( uint64_t  )

Teardown the module.