Skip to content

Commit d2f2ac1

Browse files
committed
Update README
1 parent 6e9883f commit d2f2ac1

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

README.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,49 @@
1-
# 🐜 denops-std-deno
1+
# 🐜 denops_std
22

3-
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_std/mod.ts)
43
[![deno](https://github.com/vim-denops/denops-std-deno/workflows/deno/badge.svg)](https://github.com/vim-denops/denops-std-deno/actions?query=workflow%3Adeno)
4+
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_std/mod.ts)
5+
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/denops_std)
56

67
[Deno][deno] module for [denops.vim][denops.vim]. This module is assumed to be
78
used in denops plugin and the code is assumed to be called in a worker thread
89
for a plugin.
910

10-
Note that this module focused to provide non-primitive features. See
11-
[denops-deno](https://github.com/vim-denops/denops-deno) for primitives.
12-
1311
**UNDER DEVELOPMENT**
1412

13+
By using this module, developers can write Vim/Neovim denops plugins like:
14+
15+
```typescript
16+
import { ensureString, main } from "https://deno.land/x/denops_std/mod.ts";
17+
18+
main(async ({ vim }) => {
19+
vim.register({
20+
async say(where: unknown): Promise<void> {
21+
ensureString(where, "where");
22+
const name = await vim.call("input", "Your name: ");
23+
const progname = await vim.eval("v:progname");
24+
const messages = [
25+
`Hello ${where}`,
26+
`Your name is ${name}`,
27+
`This is ${progname}`,
28+
];
29+
await vim.cmd(`redraw | echomsg message`, {
30+
message: messages.join(". "),
31+
});
32+
},
33+
});
34+
35+
await vim.execute(`
36+
command! HelloWorld call denops#notify("${vim.name}", "say", ["World"])
37+
command! HelloDenops call denops#notify("${vim.name}", "say", ["Denops"])
38+
`);
39+
40+
console.log("denops plugin has loaded");
41+
});
42+
```
43+
44+
See [denops-helloworld.vim](https://github.com/denops-helloworld.vim) for more
45+
details.
46+
1547
[deno]: https://deno.land/
1648
[denops.vim]: https://github.com/vim-denops/denops.vim
1749

0 commit comments

Comments
 (0)