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@v6.4.0/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 type { Denops } from "https://deno.land/x/denops_std@v6.4.0/mod.ts";
import * as lambda from "https://deno.land/x/denops_std@v6.4.0/lambda/mod.ts";

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

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

  // Or from Vim
  await denops.cmd(`call ${lo.notify()}`);

  // Dispose the lambda object
  lo.dispose();
}

Functions

Add a lambda function to a denops API and return the lambda object

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