Skip to content

Commit eea7b0f

Browse files
authored
Merge pull request #11 from vim-denops/v6-pre
📝 Rewrite documentation for denops v6
2 parents d804221 + 117c25a commit eea7b0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+5239
-513
lines changed

.gitattributes

-1
This file was deleted.

.github/workflows/mdbook.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html
44
#
5-
name: Deploy mdBook site to Pages
5+
name: Deploy
66

77
on:
88
# Runs on pushes targeting the default branch
@@ -37,7 +37,7 @@ jobs:
3737
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
3838
rustup update
3939
cargo install --version ${MDBOOK_VERSION} mdbook
40-
cargo install mdbook-plantuml
40+
cargo install mdbook-alerts
4141
- name: Setup Pages
4242
id: pages
4343
uses: actions/configure-pages@v4

.github/workflows/reviewdog.yml

-18
This file was deleted.

.github/workflows/test.yml

+16-18
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@ name: Test
22

33
env:
44
DENO_VERSION: 1.x
5+
MDBOOK_VERSION: 0.4.36
56

67
on:
78
push:
8-
branches:
9-
- main
109
pull_request:
11-
branches:
12-
- main
1310

1411
jobs:
1512
test:
16-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-latest
1714
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions/cache@v2
15+
- uses: actions/checkout@v4
16+
- uses: actions/cache@v4
2017
with:
2118
path: |
2219
~/.cargo/bin/
@@ -26,17 +23,18 @@ jobs:
2623
target/
2724
.tools/
2825
key: ${{ runner.os }}-cargo
29-
- uses: denoland/setup-deno@main
26+
- uses: denoland/setup-deno@v1.1.4
3027
with:
3128
deno-version: ${{ env.DENO_VERSION }}
32-
- uses: actions-rs/toolchain@v1
33-
with:
34-
toolchain: stable
35-
- name: Format
36-
run: make fmt-check
37-
- name: Install tools
38-
run: make tools
39-
- name: Generate
29+
- name: Install mdBook
4030
run: |
41-
make gen
42-
git diff --check
31+
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
32+
rustup update
33+
cargo install --version ${MDBOOK_VERSION} mdbook
34+
cargo install mdbook-alerts
35+
- name: Build with mdBook
36+
run: mdbook build
37+
- name: Format
38+
run: deno fmt --check
39+
- name: Misspell
40+
uses: reviewdog/[email protected]

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/.tools
21
/book

Makefile

-25
This file was deleted.

README.md

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Denops Documentation
1+
# denops-documentation
22

33
[![Test](https://github.com/vim-denops/denops-documentation/actions/workflows/test.yml/badge.svg)](https://github.com/vim-denops/denops-documentation/actions/workflows/test.yml)
4+
[![Deploy](https://github.com/vim-denops/denops-documentation/actions/workflows/mdbook.yml/badge.svg)](https://github.com/vim-denops/denops-documentation/actions/workflows/mdbook.yml)
45
[![Documentation](https://img.shields.io/badge/denops-Documentation-yellow.svg)](https://vim-denops.github.io/denops-documentation/)
56

6-
This is an official documentation of [denops.vim][denops.vim], an ecosystem of
7-
Vim/Neovim which allows developers to write plugins in [Deno][Deno].
7+
This is an official documentation of [denops.vim], an ecosystem of Vim/Neovim
8+
which allows developers to write plugins in [Deno].
89

910
[denops.vim]: https://github.com/vim-denops/denops.vim
1011
[deno]: https://deno.land
@@ -20,26 +21,31 @@ To contribute, install the latest versions of the followings in your environment
2021
- [Rust](https://www.rust-lang.org/tools/install)
2122
- [Deno](https://deno.land/)
2223

23-
Then, install [mdBook](https://github.com/rust-lang/mdBook) and its plugins in
24-
`.tools` directory by
24+
Then, install [mdBook](https://github.com/rust-lang/mdBook) and its plugins
2525

2626
```
27-
make tools
27+
cargo install mdbook
28+
cargo install mdbook-alerts
2829
```
2930

30-
Once required tools are installed, execute the following command to generate
31-
static files in [`./docs`](./docs) from markdown files in [`./src`](./src).
31+
Once required tools are installed, execute the following command to serve the
32+
book on http://localhost:3000
3233

3334
```
34-
make gen
35+
mdbook serve
3536
```
3637

37-
Note that all markdown files are formatted with
38-
[Deno's code formatter](https://deno.land/manual/tools/formatter) and checked by
39-
CI thus make sure to format codes by the following command
38+
Or build book into `book` directory
4039

4140
```
42-
make fmt
41+
mdbook build
42+
```
43+
44+
Don't forget to format Markdown files with `deno fmt` before sending a pull
45+
request.
46+
47+
```
48+
deno fmt
4349
```
4450

4551
## See also

book.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ multilingual = false
55
src = "src"
66
title = "Denops Documentation"
77

8-
[preprocessor.plantuml]
9-
plantuml-cmd="http://www.plantuml.com/plantuml"
8+
[preprocessor.alerts]

deno.jsonc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"exclude": ["theme/**/*", "book/**/*"]
3+
}

src/SUMMARY.md

+15-10
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
[Introduction](./introduction.md)
44

55
- [Install](./install.md)
6-
- [Tutorial](./tutorial.md)
7-
- [Preparing Deno and Denops](./tutorial/preparing-deno-and-denops.md)
8-
- [Developing Your First Plugin](./tutorial/developing-your-first-plugin.md)
9-
- [Vim/Neovim Configuration](./tutorial/vimneovim-configuration.md)
10-
- [Making a Plugin Directory Tree](./tutorial/making-a-directory-tree.md)
11-
- [Adding a Skelton of Denops Plugin](./tutorial/adding-a-skelton-of-denops-plugin.md)
12-
- [Adding an API](./tutorial/adding-an-api.md)
13-
- [Calling Vim/Neovim Features](./tutorial/calling-vimneovim-features.md)
14-
- [Developing More Applicative Plugin](./tutorial/developing-more-applicative-plugin.md)
15-
- [Developing Your Next Plugins](./tutorial/developing-your-next-plugins.md)
6+
- [Getting Started](./getting-started/README.md)
7+
- [Explanation of the Getting started](./getting-started/explanation.md)
8+
- [Tutorial (Hello world)](./tutorial/helloworld/README.md)
9+
- [Creating a minimal Vim plugin](./tutorial/helloworld/creating-a-minimal-vim-plugin.md)
10+
- [Creating a minimal Denops plugin](./tutorial/helloworld/creating-a-minimal-denops-plugin.md)
11+
- [Adding Denops APIs](./tutorial/helloworld/adding-an-api.md)
12+
- [Calling Vim features](./tutorial/helloworld/calling-vim-features.md)
13+
- [Tutorial (Maze)](./tutorial/maze/README.md)
14+
- [Utilizing third-party library](./tutorial/maze/utilizing-third-party-library.md)
15+
- [Outputting content to buffer](./tutorial/maze/outputting-content-to-buffer.md)
16+
- [Adjusting maze size to fit the window](./tutorial/maze/adjusting-maze-size-to-fit-the-window.md)
17+
- [Properly create a virtual buffer](./tutorial/maze/properly-create-a-virtual-buffer.md)
18+
- [Properly configured the buffer](./tutorial/maze/properly-configured-the-buffer.md)
19+
- [Reduce the number of RPC calls](./tutorial/maze/reduce-the-number-of-rpc-calls.md)
20+
- [FAQ](./faq.md)

src/faq.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# FAQ
2+
3+
## How to Check Denops Startup Time
4+
5+
To check the startup time of Denops or Denops plugins, utilize
6+
[denops-startup-recorder]. This plugin visualizes the timing of events related
7+
to Denops and Denops plugin startup.
8+
9+
[denops-startup-recorder]: https://github.com/vim-denops/denops-startup-recorder.vim
10+
11+
It shows the result in echo area like:
12+
13+
![](./img/faq-1.png)
14+
15+
## How to Check Denops Performance
16+
17+
To assess Denops performance, employ [denops-benchmark]. This plugin measures
18+
the number of operations or characters that can be processed in milliseconds.
19+
20+
[denops-benchmark]: https://github.com/vim-denops/denops-benchmark.vim
21+
22+
It shows the result in a buffer like:
23+
24+
![](./img/faq-2.png)

src/getting-started/README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Getting Started
2+
3+
[Denops] ([/ˈdiːnoʊps/](http://ipa-reader.xyz/?text=%CB%88di%CB%90no%CA%8Aps),
4+
pronounced `dee-nops`) is an ecosystem for [Vim] / [Neovim] that empowers
5+
developers to write plugins in [TypeScript] / [JavaScript] powered by [Deno].
6+
7+
Let's start by creating a simple plugin to learn how to develop Denops plugins.
8+
9+
## Create a Plugin
10+
11+
Create a directory named `denops-getting-started` in your home directory and a
12+
file named `main.ts` within it, under `denops/denops-getting-started/`:
13+
14+
```
15+
$HOME
16+
└── denops-getting-started
17+
└── denops
18+
└── denops-getting-started
19+
└── main.ts
20+
```
21+
22+
Next, write the following TypeScript code in `main.ts`:
23+
24+
```typescript
25+
import type { Denops } from "https://deno.land/x/[email protected]/mod.ts";
26+
27+
export function main(denops: Denops): void {
28+
denops.dispatcher = {
29+
async hello() {
30+
await denops.cmd(`echo "Hello, Denops!"`);
31+
},
32+
};
33+
}
34+
```
35+
36+
## Activate the Plugin
37+
38+
Add the following line to your Vim or Neovim configuration file (e.g.,
39+
`~/.vimrc` or `~/.config/nvim/init.vim`):
40+
41+
```vim
42+
set runtimepath+=~/denops-getting-started
43+
```
44+
45+
Or Neovim Lua configuration file (e.g., `~/.config/nvim/init.lua`):
46+
47+
```lua
48+
vim.opt.runtimepath:append("~/denops-getting-started")
49+
```
50+
51+
## Try the Plugin
52+
53+
Restart Vim/Neovim and execute the following command:
54+
55+
```vim
56+
:call denops#request('denops-getting-started', 'hello', [])
57+
```
58+
59+
You should see "Hello, Denops!" displayed on the screen like:
60+
61+
![](./img/README-01.png)
62+
63+
[Denops]: https://github.com/vim-denops/denops.vim
64+
[Vim]: https://www.vim.org/
65+
[Neovim]: https://neovim.io/
66+
[TypeScript]: https://www.typescriptlang.org/
67+
[JavaScript]: https://developer.mozilla.org/en-US/docs/Web/JavaScript
68+
[Deno]: https://deno.land/

0 commit comments

Comments
 (0)