Skip to main content
Module

x/denops_std/lambda/mod.ts>add

📚 Standard module for denops.vim
Go to Latest
function add
import { add } from "https://deno.land/x/denops_std@v6.4.0/lambda/mod.ts";

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

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.
    },
  );

  // Call the lambda function from Vim script
  await denops.eval(lo.request());

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

Parameters

denops: Denops
fn: Fn