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

x/denops_std/batch/mod.ts

๐Ÿ“š Standard module for denops.vim
Latest
import * as denopsStd from "https://deno.land/x/denops_std@v6.5.1/batch/mod.ts";

A module to provide denops.batch() helper functions

import type { Entrypoint } from "https://deno.land/x/denops_std@v6.5.1/mod.ts";
import { batch, collect } from "https://deno.land/x/denops_std@v6.5.1/batch/mod.ts";

export const main: Entrypoint = async (denops) => {
  // Call multiple denops functions sequentially in a signle RPC call
  await batch(denops, async (denops) => {
    await denops.cmd("setlocal modifiable");
    await denops.cmd("setlocal noswap");
    await denops.cmd("setlocal nobackup");
  });

  // Call multiple denops functions sequentially and get the return values in a single RPC call
  const results = await collect(denops, (denops) => [
    denops.eval("&modifiable"),
    denops.eval("&modified"),
    denops.eval("&filetype"),
  ]);
  // results contains the value of modifiable, modified, and filetype
}

Functions

Call multiple denops functions sequentially without RPC overhead

Call multiple denops functions sequentially without RPC overhead and return values