Skip to content

Commit 3989cb2

Browse files
committed
📝 Add documentation for function module
1 parent 86b1d4f commit 3989cb2

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

denops_std/function/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# `function`
2+
3+
This module provides entry points of raw Vim and Neovim functions. Most of codes
4+
are automatically generated by
5+
[`gen-function.ts`](../../scripts/gen-function/gen-function.ts) from `eval.txt`
6+
in minimal supported Vim and Neovim versions.
7+
8+
## Example
9+
10+
```typescript
11+
import * as fn from "https://deno.land/x/denops_std/function/mod.ts";
12+
import * as vimFn from "https://deno.land/x/denops_std/function/vim/mod.ts";
13+
import * as nvimFn from "https://deno.land/x/denops_std/function/nvim/mod.ts";
14+
15+
export async function main(denops) {
16+
// fn holds functions exists in both Vim and Neovim
17+
console.log(fn.or(denops, 0, 1));
18+
19+
// vimFn holds functions exists only in Vim
20+
console.log(vimFn.balloon_gettext(denops));
21+
22+
// nvimFn holds functions exists only in Neovim
23+
console.log(nvimFn.api_info(denops));
24+
}
25+
```
26+
27+
## How to add functions manually
28+
29+
To add functions manually, create or modify corresponding module under
30+
`function`, `function/vim`, or `function/nvim` module then make sure that module
31+
is listed in `_manual.ts` uneder corresponding module. After that, execute
32+
`make gen` on the repository top so that `gen-function.ts` automatically remove
33+
duplicated functions from `_generated.ts`.

0 commit comments

Comments
 (0)