Skip to content

Commit 17c3c2e

Browse files
committed
📝 Add documentation comments on options
1 parent 45191c2 commit 17c3c2e

File tree

4 files changed

+68
-52
lines changed

4 files changed

+68
-52
lines changed

denops_std/option/README.md

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,7 @@
1-
# option
2-
3-
`option`, `option/vim`, and `option/nvim` are modules to provide accessors of
4-
Vim and Neovim native options.
5-
6-
- [API documentation](https://doc.deno.land/https/deno.land/x/denops_std/option/mod.ts)
7-
- [API documentation (Vim)](https://doc.deno.land/https/deno.land/x/denops_std/option/vim/mod.ts)
8-
- [API documentation (Neovim)](https://doc.deno.land/https/deno.land/x/denops_std/option/nvim/mod.ts)
9-
101
Most of codes are automatically generated by
112
[`gen-option.ts`](../../scripts/gen-option/gen-option.ts) from `options.txt` in
123
minimal supported Vim and Neovim versions.
134

14-
## Example
15-
16-
```typescript
17-
import { Denops } from "../mod.ts";
18-
import * as op from "../option/mod.ts";
19-
import * as vimOp from "../option/vim/mod.ts";
20-
import * as nvimOp from "../option/nvim/mod.ts";
21-
22-
export async function main(denops: Denops): Promise<void> {
23-
// Get value of the option.
24-
// `get` is available on any options
25-
// `getGlobal` is available on only global options
26-
// `getLocal` is available on only local options
27-
console.log(await op.autoread.get(denops));
28-
console.log(await op.autoread.getGlobal(denops));
29-
console.log(await op.autoread.getLocal(denops));
30-
31-
// Set value of the option.
32-
// `set` is available on any options
33-
// `setGlobal` is available on only global options
34-
// `setLocal` is available on only local options
35-
await op.autoread.set(denops, true);
36-
await op.autoread.setGlobal(denops, true);
37-
await op.autoread.setLocal(denops, true);
38-
39-
// Reset the option.
40-
// `reset` is available on any options
41-
// `resetGlobal` is available on only global options
42-
// `resetLocal` is available on only local options
43-
await op.autoread.reset(denops);
44-
await op.autoread.resetGlobal(denops);
45-
await op.autoread.resetLocal(denops);
46-
47-
// vimOp has options only exist in Vim
48-
console.log(await vimOp.compatible.get(denops));
49-
50-
// nvimOp has options only exist in Neovim
51-
console.log(await nvimOp.shada.get(denops));
52-
}
53-
```
54-
55-
## How to add options manually
56-
575
To add options manually, create or modify corresponding module under `option`,
586
`option/vim`, or `option/nvim` module then make sure that module is listed in
597
`_manual.ts` under corresponding module. After that, execute `make gen` on the

denops_std/option/mod.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
/**
2+
* A module to provide accessors of Vim and Neovim native options.
3+
*
4+
* ```typescript
5+
* import { Denops } from "../mod.ts";
6+
* import * as op from "../option/mod.ts";
7+
*
8+
* export async function main(denops: Denops): Promise<void> {
9+
* // Get value of the option.
10+
* // `get` is available on any options
11+
* // `getGlobal` is available on only global options
12+
* // `getLocal` is available on only local options
13+
* console.log(await op.autoread.get(denops));
14+
* console.log(await op.autoread.getGlobal(denops));
15+
* console.log(await op.autoread.getLocal(denops));
16+
*
17+
* // Set value of the option.
18+
* // `set` is available on any options
19+
* // `setGlobal` is available on only global options
20+
* // `setLocal` is available on only local options
21+
* await op.autoread.set(denops, true);
22+
* await op.autoread.setGlobal(denops, true);
23+
* await op.autoread.setLocal(denops, true);
24+
*
25+
* // Reset the option.
26+
* // `reset` is available on any options
27+
* // `resetGlobal` is available on only global options
28+
* // `resetLocal` is available on only local options
29+
* await op.autoread.reset(denops);
30+
* await op.autoread.resetGlobal(denops);
31+
* await op.autoread.resetLocal(denops);
32+
* }
33+
* ```
34+
*
35+
* See [`vim/mod.ts`](./vim/mod.ts) or [`nvim/mod.ts`](nvim/mod.ts) if you need Vim or Neovim specific options.
36+
*
37+
* @module
38+
*/
139
// NOTE:
240
// Do NOT add modules manually to this file.
341
// Add modules to `_manual.ts` instead for manually written modules.

denops_std/option/nvim/mod.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* A module to provide accessors of Neovim native options.
3+
*
4+
* ```typescript
5+
* import { Denops } from "../../mod.ts";
6+
* import * as nvimOp from "../../option/nvim/mod.ts";
7+
*
8+
* export async function main(denops: Denops): Promise<void> {
9+
* // nvimOp has options only exist in Neovim
10+
* console.log(await nvimOp.shada.get(denops));
11+
* }
12+
* ```
13+
*
14+
* @module
15+
*/
116
// NOTE:
217
// Do NOT add modules manually to this file.
318
// Add modules to `_manual.ts` instead for manually written modules.

denops_std/option/vim/mod.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* A module to provide accessors of Vim native options.
3+
*
4+
* ```typescript
5+
* import { Denops } from "../../mod.ts";
6+
* import * as vimOp from "../../option/vim/mod.ts";
7+
*
8+
* export async function main(denops: Denops): Promise<void> {
9+
* // vimOp has options only exist in Vim
10+
* console.log(await vimOp.compatible.get(denops));
11+
* }
12+
* ```
13+
*
14+
* @module
15+
*/
116
// NOTE:
217
// Do NOT add modules manually to this file.
318
// Add modules to `_manual.ts` instead for manually written modules.

0 commit comments

Comments
 (0)