Skip to main content
Module

x/denops_std/lambda/mod.ts

📚 Standard module for denops.vim
Go to Latest
import * as denopsStd from "https://deno.land/x/denops_std@v4.1.3/lambda/mod.ts";

A module to provide lambda function that is callable from the outside of the plugin.

Use denops#callback#register() and denops#callback#call() functions instead if you'd like to create a lambda function of Vim script that is callable from Deno.

import { Denops } from "../mod.ts";
import * as lambda from "./mod.ts";

export async function main(denops: Denops): Promise<void> {
  // Add lambda function
  const id = lambda.register(
    denops,
    () => {
      // Do what ever you want.
    },
  );

  // Use id to dispatch added function from Deno
  await denops.dispatch(denops.name, id);

  // Or from Vim
  await denops.cmd("call denops#notify(name, id, [])", {
    name: denops.name,
    id,
  });
}

Functions

Register a lambda function as a denops API and return the identifier.

Unregister a lambda function from a denops API identified by the identifier

Interfaces

Register options

Type Aliases

Lambda function

Lambda function identifier