Skip to main content
Module

x/denops_std/helper/execute.ts>execute

📚 Standard module for denops.vim
Go to Latest
function execute
import { execute } from "https://deno.land/x/denops_std@v5.2.0/helper/execute.ts";

Execute multi-lined Vim script directly

import { Denops } from "../mod.ts";
import { execute } from "../helper/mod.ts";

export async function main(denops: Denops): Promise<void> {
  await execute(
    denops,
    `
    command! CommandA echo "A"
    command! CommandB echo "B"
    command! CommandC echo "C"
    `,
  );

  // You can pass context like
  await execute(
    denops,
    `
    command! CommandA echo msg_a
    command! CommandB echo msg_b
    command! CommandC echo l:msg_c
    `,
    {
      msg_a: "Hello A",
      msg_b: "Hello B",
      msg_c: "Hello C",
    },
  );
}

Parameters

denops: Denops
script: string | string[]
optional
ctx: Context = [UNSUPPORTED]

Returns

Promise<void>