Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
📚 Standard module for denops.vim. This module is assumed to be used for developing denops plugins. The code is assumed to be called in a dedicated worker thread.
Standard module for denops.vim.
This module is assumed to be used for developing denops plugins. The code is assumed to be called in a dedicated worker thread.
By using this module, developers can write Vim/Neovim denops plugins like:
import type { Entrypoint } from "jsr:@denops/std"; import * as batch from "jsr:@denops/std/batch"; import * as fn from "jsr:@denops/std/function"; import * as vars from "jsr:@denops/std/variable"; import * as helper from "jsr:@denops/std/helper"; import { assert, is } from "jsr:@core/unknownutil"; export const main: Entrypoint = async (denops) => { denops.dispatcher = { async init() { // This is just an example. Developers usually should define commands directly in Vim script. await batch.batch(denops, async (denops) => { await denops.cmd( `command! HelloWorld call denops#notify("${denops.name}", "say", ["World"])`, ); await denops.cmd( `command! HelloDenops call denops#notify("${denops.name}", "say", ["Denops"])`, ); }); }, async say(where) { assert(where, is.String); const [name, progname] = await batch.collect(denops, (denops) => [ fn.input(denops, "Your name: "), vars.v.get(denops, "progname"), ]); const messages = [ `Hello ${where}.`, `Your name is ${name}.`, `This is ${progname}.`, ]; await helper.echo(denops, messages.join("\n")); }, }; };
Note that developers should avoid calling initialization code within the
main function. If necessary, add an init API or a similar approach like
above and call it from plugin/<your_plugin>.vim.
See Denops Documentation or denops-helloworld.vim for more details.
Built and signed on
GitHub Actions
Add Package
deno add jsr:@denops/std
Import symbol
import * as std from "@denops/std";
Import directly with a jsr specifier
import * as std from "jsr:@denops/std";