Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/lambda/mod.ts

๐Ÿ“š Standard module for denops.vim
Latest
import * as denopsStd from "https://deno.land/x/denops_std@v6.5.1/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 { Entrypoint } from "https://deno.land/x/denops_std@v6.5.1/mod.ts";
import * as lambda from "https://deno.land/x/denops_std@v6.5.1/lambda/mod.ts";

export const main: Entrypoint = async (denops) => {
  // 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