|
5 | 5 | [](https://vim-denops.github.io/denops-documentation/) |
6 | 6 | [](https://deno.land/x/denops_std) |
7 | 7 |
|
8 | | -[Deno][deno] module for [denops.vim][denops.vim]. This module is assumed to be |
9 | | -used in denops plugin and the code is assumed to be called in a worker thread |
10 | | -for a plugin. |
11 | | - |
12 | | -By using this module, developers can write Vim/Neovim denops plugins like: |
13 | | - |
14 | | -```typescript |
15 | | -import { Denops } from "./mod.ts"; |
16 | | -import * as fn from "./function/mod.ts"; |
17 | | -import * as vars from "./variable/mod.ts"; |
18 | | -import * as helper from "./helper/mod.ts"; |
19 | | - |
20 | | -import { assertString } from "https://deno.land/x/unknownutil/mod.ts"; |
21 | | - |
22 | | -export async function main(denops: Denops): Promise<void> { |
23 | | - denops.dispatcher = { |
24 | | - async say(where: unknown): Promise<void> { |
25 | | - // Ensure that `where` is `string` here |
26 | | - assertString(where); |
27 | | - const name = await fn.input(denops, "Your name: "); |
28 | | - const progname = await vars.v.get(denops, "progname"); |
29 | | - const messages = [ |
30 | | - `Hello ${where}.`, |
31 | | - `Your name is ${name}.`, |
32 | | - `This is ${progname}.`, |
33 | | - ]; |
34 | | - await helper.echo(denops, messages.join("\n")); |
35 | | - }, |
36 | | - }; |
37 | | - |
38 | | - await helper.execute( |
39 | | - denops, |
40 | | - ` |
41 | | - command! HelloWorld call denops#notify("${denops.name}", "say", ["World"]) |
42 | | - command! HelloDenops call denops#notify("${denops.name}", "say", ["Denops"]) |
43 | | - `, |
44 | | - ); |
45 | | -} |
46 | | -``` |
47 | | - |
48 | | -See [Denops Documentation](https://vim-denops.github.io/denops-documentation/) |
49 | | -or [denops-helloworld.vim](https://github.com/vim-denops/denops-helloworld.vim) |
50 | | -for more details. |
| 8 | +[Deno][deno] module for [denops.vim][denops.vim]. |
51 | 9 |
|
52 | 10 | [deno]: https://deno.land/ |
53 | 11 | [denops.vim]: https://github.com/vim-denops/denops.vim |
0 commit comments