1
1
# denops_std
2
2
3
- [ ![ deno land] ( http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno )] ( https://deno.land/x/denops_std )
4
- [ ![ deno doc] ( https://doc.deno.land/badge.svg )] ( https://doc.deno.land/https/deno.land/x/denops_std/mod.ts )
5
3
[ ![ Test] ( https://github.com/vim-denops/deno-denops-std/actions/workflows/test.yml/badge.svg )] ( https://github.com/vim-denops/deno-denops-std/actions/workflows/test.yml )
4
+ [ ![ deno doc] ( https://doc.deno.land/badge.svg )] ( https://doc.deno.land/https/deno.land/x/denops_std/mod.ts )
5
+ [ ![ Documentation] ( https://img.shields.io/badge/denops-Documentation-yellow.svg )] ( https://vim-denops.github.io/denops-documentation/ )
6
+ [ ![ deno land] ( http://img.shields.io/badge/available%20on-deno.land/x/denops__std-lightgrey.svg?logo=deno )] ( https://deno.land/x/denops_std )
6
7
7
8
[ Deno] [ deno ] module for [ denops.vim] [ denops.vim ] . This module is assumed to be
8
9
used in denops plugin and the code is assumed to be called in a worker thread
@@ -14,33 +15,27 @@ By using this module, developers can write Vim/Neovim denops plugins like:
14
15
import { Denops } from " https://deno.land/x/denops_std/mod.ts" ;
15
16
import * as fn from " https://deno.land/x/denops_std/function/mod.ts" ;
16
17
import * as vars from " https://deno.land/x/denops_std/variable/mod.ts" ;
17
- import { execute } from " https://deno.land/x/denops_std/helper/mod.ts" ;
18
+ import * as helper from " https://deno.land/x/denops_std/helper/mod.ts" ;
19
+
18
20
import { ensureString } from " https://deno.land/x/unknownutil/mod.ts" ;
19
21
20
22
export async function main(denops : Denops ): Promise <void > {
21
23
denops .dispatcher = {
22
24
async say(where : unknown ): Promise <void > {
23
25
// Ensure that `where` is `string` here
24
26
ensureString (where );
25
- // Use `call` to call Vim's function
26
27
const name = await fn .input (denops , " Your name: " );
27
- // Use `eval` to evaluate Vim's expression
28
28
const progname = await vars .v .get (denops , " progname" );
29
- // Construct messages
30
29
const messages = [
31
- ` Hello ${where } ` ,
32
- ` Your name is ${name } ` ,
33
- ` This is ${progname } ` ,
30
+ ` Hello ${where }. ` ,
31
+ ` Your name is ${name }. ` ,
32
+ ` This is ${progname }. ` ,
34
33
];
35
- // Use `cmd` to execute Vim's command
36
- await denops .cmd (` redraw | echomsg message ` , {
37
- message: messages .join (" . " ),
38
- });
34
+ await helper .echo (denops , messages .join (" \n " ));
39
35
},
40
36
};
41
37
42
- // Use 'execute()' to execute multiline Vim script
43
- await execute (
38
+ await helper .execute (
44
39
denops ,
45
40
`
46
41
command! HelloWorld call denops#notify("${denops .name }", "say", ["World"])
@@ -50,7 +45,8 @@ export async function main(denops: Denops): Promise<void> {
50
45
}
51
46
```
52
47
53
- See [ denops-helloworld.vim] ( https://github.com/vim-denops/denops-helloworld.vim )
48
+ See [ Denops Documentation] ( https://vim-denops.github.io/denops-documentation/ )
49
+ or [ denops-helloworld.vim] ( https://github.com/vim-denops/denops-helloworld.vim )
54
50
for more details.
55
51
56
52
[ deno ] : https://deno.land/
0 commit comments