denops_std
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.
By using this module, developers can write Vim/Neovim denops plugins like:
import { Denops } from "./mod.ts";
import * as fn from "./function/mod.ts";
import * as vars from "./variable/mod.ts";
import * as helper from "./helper/mod.ts";
import { assertString } from "https://deno.land/x/unknownutil/mod.ts";
export async function main(denops: Denops): Promise<void> {
denops.dispatcher = {
async say(where: unknown): Promise<void> {
// Ensure that `where` is `string` here
assertString(where);
const name = await fn.input(denops, "Your name: ");
const progname = await vars.v.get(denops, "progname");
const messages = [
`Hello ${where}.`,
`Your name is ${name}.`,
`This is ${progname}.`,
];
await helper.echo(denops, messages.join("\n"));
},
};
await helper.execute(
denops,
`
command! HelloWorld call denops#notify("${denops.name}", "say", ["World"])
command! HelloDenops call denops#notify("${denops.name}", "say", ["Denops"])
`,
);
}
See Denops Documentation or denops-helloworld.vim for more details.
Index
Name | Description |
---|---|
anonymous |
A module to provide anonymous function |
argument |
A module to provide helper functions to manage Vim's command arguments |
autocmd |
A module to provide helper functions to manage autocmd |
batch |
A module to provide wrapper functions of denops.batch() |
buffer |
A module to provide helper functions to manage buffers |
bufname |
A module to provide helper functions to manage Vim's buffer name |
function |
A module to provide functions of Vim and Neovim native functions |
helper |
A module to provide helper functions |
mapping |
A module to provide helper functions to manage mappings |
option |
A module to provide helper functions to manage options |
variable |
A module to provide helper accessor functions to variables |