|
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 |
| - |
10 | 1 | Most of codes are automatically generated by
|
11 | 2 | [`gen-option.ts`](../../scripts/gen-option/gen-option.ts) from `options.txt` in
|
12 | 3 | minimal supported Vim and Neovim versions.
|
13 | 4 |
|
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 |
| - |
57 | 5 | To add options manually, create or modify corresponding module under `option`,
|
58 | 6 | `option/vim`, or `option/nvim` module then make sure that module is listed in
|
59 | 7 | `_manual.ts` under corresponding module. After that, execute `make gen` on the
|
|
0 commit comments