|
1 |
| -# 🐜 denops-std-deno |
| 1 | +# 🐜 denops_std |
2 | 2 |
|
3 |
| -[](https://doc.deno.land/https/deno.land/x/denops_std/mod.ts) |
4 | 3 | [](https://github.com/vim-denops/denops-std-deno/actions?query=workflow%3Adeno)
|
| 4 | +[](https://doc.deno.land/https/deno.land/x/denops_std/mod.ts) |
| 5 | +[](https://deno.land/x/denops_std) |
5 | 6 |
|
6 | 7 | [Deno][deno] module for [denops.vim][denops.vim]. This module is assumed to be
|
7 | 8 | used in denops plugin and the code is assumed to be called in a worker thread
|
8 | 9 | for a plugin.
|
9 | 10 |
|
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 |
| - |
13 | 11 | **UNDER DEVELOPMENT**
|
14 | 12 |
|
| 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 | + |
15 | 47 | [deno]: https://deno.land/
|
16 | 48 | [denops.vim]: https://github.com/vim-denops/denops.vim
|
17 | 49 |
|
|
0 commit comments