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

x/denops_std/autocmd/mod.ts>define

๐Ÿ“š Standard module for denops.vim
Go to Latest
function define
import { define } from "https://deno.land/x/denops_std@v5.0.2/autocmd/mod.ts";

Define an autocmd

import { Denops } from "../mod.ts";
import * as autocmd from "./mod.ts";

export async function main(denops: Denops): Promise<void> {
  // Define new autocmd for BufEnter
  await autocmd.define(denops, "BufEnter", "*", "echo 'BufEnter'");

  // Define new autocmd for BufEnter in 'MyGroup'
  await autocmd.define(denops, "BufEnter", "*", "echo 'BufEnter'", {
    group: "MyGroup",
  });

  // Define new autocmd for BufEnter with '++once'
  await autocmd.define(denops, "BufEnter", "*", "echo 'BufEnter'", {
    once: true,
  });

  // Define new autocmd for BufEnter with '++nested'
  await autocmd.define(denops, "BufEnter", "*", "echo 'BufEnter'", {
    nested: true,
  });

  // Define multiple autocmds
  await autocmd.define(denops, ["BufEnter", "WinEnter"], "*", "echo 'Enter'");
}

Parameters

denops: Denops
pat: string | string[]
cmd: string
optional
options: DefineOptions = [UNSUPPORTED]

Returns

Promise<void>