Skip to main content
Module

x/denops_std/function/nvim/mod.ts>chansend

📚 Standard module for denops.vim
Latest
function chansend
import { chansend } from "https://deno.land/x/denops_std@v6.5.0/function/nvim/mod.ts";

Send data to channel {id}. For a job, it writes it to the stdin of the process. For the stdio channel channel-stdio, it writes to Nvim's stdout. Returns the number of bytes written if the write succeeded, 0 otherwise. See channel-bytes for more information.

{data} may be a string, string convertible, Blob, or a list. If {data} is a list, the items will be joined by newlines; any newlines in an item will be sent as NUL. To send a final newline, include a final empty string. Example:

:call chansend(id, ["abc", "123\n456", ""])

will send "abc<NL>123<NUL>456<NL>".

chansend() writes raw data, not RPC messages. If the channel was created with "rpc":v:true then the channel expects RPC messages, use rpcnotify() and rpcrequest() instead.

Parameters

denops: Denops
id: unknown
data: unknown

Returns

Promise<number>