Skip to main content

🐜 denops_std

deno land deno doc Test

Deno module for denops.vim. This module is assumed to be used in denops plugin and the code is assumed to be called in a worker thread for a plugin.

UNDER DEVELOPMENT

By using this module, developers can write Vim/Neovim denops plugins like:

import { ensureString, main } from "https://deno.land/x/denops_std/mod.ts";

main(async ({ vim }) => {
  vim.register({
    async say(where: unknown): Promise<void> {
      ensureString(where, "where");
      const name = await vim.call("input", "Your name: ");
      const progname = await vim.eval("v:progname");
      const messages = [
        `Hello ${where}`,
        `Your name is ${name}`,
        `This is ${progname}`,
      ];
      await vim.cmd(`redraw | echomsg message`, {
        message: messages.join(". "),
      });
    },
  });

  await vim.execute(`
    command! HelloWorld call denops#notify("${vim.name}", "say", ["World"])
    command! HelloDenops call denops#notify("${vim.name}", "say", ["Denops"])
  `);

  console.log("denops plugin has loaded");
});

See denops-helloworld.vim for more details.

License

The code follows MIT license written in LICENSE. Contributors need to agree that any modifications sent in this repository follow the license.