Skip to main content
Module

x/vim_channel_command/client.ts>Client

🦕 Vim's Channel command for Deno
Latest
class Client
import { Client } from "https://deno.land/x/vim_channel_command@v3.1.1/client.ts";

Client is a wrapper of Session to send commands and messages.

Examples

Example 1

import { channel } from "https://deno.land/x/streamtools@v0.5.0/mod.ts";
import { Session, Client } from "./mod.ts";

const input = channel<Uint8Array>();
const output = channel<Uint8Array>();
const session = new Session(input.reader, output.writer);
session.start();

// Create a client
const client = new Client(session);

// Send a ex command
client.ex("echo 'Hello, world!'");

// Send a call command and wait for the result.
console.log(await client.call("abs", -1)); // 1

Constructors

new
Client(session: Session, indexer?: Indexer)

Constructs a new client.

Note that the indexer must be unique for each session to avoid message ID conflicts. If multiple clients are created for a single session, specify a single indexer.

Methods

call(fn: string, ...args: unknown[]): Promise<unknown>

Sends a call command to Vim and wait for the result.

callNoReply(fn: string, ...args: unknown[]): Promise<void>

Sends a call command to Vim.

ex(expr: string): Promise<void>

Sends an ex command to Vim.

expr(expr: string): Promise<unknown>

Sends an expr command to Vim and wait for the result.

exprNoReply(expr: string): Promise<void>

Sends an expr command to Vim.

normal(expr: string): Promise<void>

Sends a normal command to Vim.

redraw(force?): Promise<void>

Sends a redraw command to Vim.

reply(msgid: number, value: unknown): Promise<void>

Sends a message to Vim.