Skip to content

Commit 3f77fa7

Browse files
committed
docs: update README.md
1 parent 93a30fb commit 3f77fa7

File tree

2 files changed

+99
-96
lines changed

2 files changed

+99
-96
lines changed

README.md

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ others, you must use direct mode
6565

6666
Ultimately, `Neopyter` can control `Juppyter lab`. `Neopyter` can implement abilities like [jupynium.nvim](https://github.com/kiyoon/jupynium.nvim).
6767

68+
## Specifications
69+
70+
Please refer to [doc/specification.ipynb](doc/specification.ipynb) and [doc/specification.ju.py](doc/specification.ju.py)
71+
6872
<!-- panvimdoc-ignore-start -->
6973
## Screenshots
7074

@@ -124,7 +128,6 @@ Configure `JupyterLab` in side panel
124128

125129
- With 💤lazy.nvim:
126130

127-
For all config, ref to `:h neopyter-configuration` and `:h neopyter-configuration-types`
128131

129132
```lua
130133
{
@@ -141,45 +144,11 @@ For all config, ref to `:h neopyter-configuration` and `:h neopyter-configuratio
141144
}
142145
```
143146

144-
Suggest keymaps(`neopyter` don't provide default keymap):
145-
146-
```lua
147-
on_attach = function(buf)
148-
local function map(mode, lhs, rhs, desc)
149-
vim.keymap.set(mode, lhs, rhs, { desc = desc, buffer = buf })
150-
end
151-
-- same, recommend the former
152-
map("n", "<C-Enter>", "<cmd>Neopyter execute notebook:run-cell<cr>", "run selected")
153-
-- map("n", "<C-Enter>", "<cmd>Neopyter run current<cr>", "run selected")
154-
155-
-- same, recommend the former
156-
map("n", "<space>X", "<cmd>Neopyter execute notebook:run-all-above<cr>", "run all above cell")
157-
-- map("n", "<space>X", "<cmd>Neopyter run allAbove<cr>", "run all above cell")
158-
159-
-- same, recommend the former, but the latter is silent
160-
map("n", "<space>nt", "<cmd>Neopyter execute kernelmenu:restart<cr>", "restart kernel")
161-
-- map("n", "<space>nt", "<cmd>Neopyter kernel restart<cr>", "restart kernel")
162-
163-
map("n", "<S-Enter>", "<cmd>Neopyter execute runmenu:run<cr>", "run selected and select next")
164-
map("n", "<M-Enter>", "<cmd>Neopyter execute run-cell-and-insert-below<cr>", "run selected and insert below")
165-
166-
map("n", "<F5>", "<cmd>Neopyter execute notebook:restart-run-all<cr>", "restart kernel and run all")
167-
end
168-
```
169-
170-
# Usage
171-
172-
- Open JupyterLab `jupyter lab`, there is a sidebar named `Neopyter`, which display neopyter ip+port
173-
- Open a `*.ju.py` file in neovim
174-
- Now you can type `# %%` in Neovim to create a code cell.
175-
- You'll see everything you type below that will be synchronised in the browser
176-
177-
# Configuration
178147

179148
<details>
180149
<summary><strong>Default configuration</strong></summary>
181-
<!-- doc-inject:default-config -->
182150

151+
<!-- doc-inject:default-config -->
183152
```lua
184153
---@type neopyter.Option
185154
local default_config = {
@@ -228,7 +197,42 @@ local default_config = {
228197

229198
</details>
230199

231-
See `:h neopyter-configuration-types` for all type description.
200+
See `:h neopyter-configuration-types` for all option type description.
201+
202+
Suggest keymaps(`neopyter` don't provide default keymap):
203+
204+
```lua
205+
on_attach = function(buf)
206+
local function map(mode, lhs, rhs, desc)
207+
vim.keymap.set(mode, lhs, rhs, { desc = desc, buffer = buf })
208+
end
209+
-- same, recommend the former
210+
map("n", "<C-Enter>", "<cmd>Neopyter execute notebook:run-cell<cr>", "run selected")
211+
-- map("n", "<C-Enter>", "<cmd>Neopyter run current<cr>", "run selected")
212+
213+
-- same, recommend the former
214+
map("n", "<space>X", "<cmd>Neopyter execute notebook:run-all-above<cr>", "run all above cell")
215+
-- map("n", "<space>X", "<cmd>Neopyter run allAbove<cr>", "run all above cell")
216+
217+
-- same, recommend the former, but the latter is silent
218+
map("n", "<space>nt", "<cmd>Neopyter execute kernelmenu:restart<cr>", "restart kernel")
219+
-- map("n", "<space>nt", "<cmd>Neopyter kernel restart<cr>", "restart kernel")
220+
221+
map("n", "<S-Enter>", "<cmd>Neopyter execute runmenu:run<cr>", "run selected and select next")
222+
map("n", "<M-Enter>", "<cmd>Neopyter execute run-cell-and-insert-below<cr>", "run selected and insert below")
223+
224+
map("n", "<F5>", "<cmd>Neopyter execute notebook:restart-run-all<cr>", "restart kernel and run all")
225+
end
226+
```
227+
228+
229+
# Usage
230+
231+
- Open JupyterLab `jupyter lab`, there is a sidebar named `Neopyter`, which display neopyter ip+port
232+
- Open a `*.ju.py` file in neovim
233+
- Now you can type `# %%` in Neovim to create a code cell.
234+
- You'll see everything you type below that will be synchronised in the browser
235+
232236

233237
# Available Vim Commands
234238

@@ -391,8 +395,8 @@ current_notebook:run_all_below()
391395

392396
```
393397

394-
- `:h neopyter-notebook-api`
395-
- `:h neopyter-jupyterlab-api-api`
398+
- Notebook API: `:h neopyter-notebook-api`
399+
- JupyterLab API`:h neopyter-jupyterlab-api-api`
396400

397401
## Async
398402

doc/neopyter.txt

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ Table of Contents *neopyter-table-of-contents*
55

66
1. Introduction |neopyter-introduction|
77
- How does it work? |neopyter-introduction-how-does-it-work?|
8+
- Specifications |neopyter-introduction-specifications|
89
2. Requirements |neopyter-requirements|
910
3. Installation |neopyter-installation|
1011
- JupyterLab Extension |neopyter-installation-jupyterlab-extension|
1112
- Neovim Plugin |neopyter-installation-neovim-plugin|
1213
4. Usage |neopyter-usage|
13-
5. Configuration |neopyter-configuration|
14-
6. Available Vim Commands |neopyter-available-vim-commands|
15-
7. Integration |neopyter-integration|
14+
5. Available Vim Commands |neopyter-available-vim-commands|
15+
6. Integration |neopyter-integration|
1616
- neoconf.nvim |neopyter-integration-neoconf.nvim|
1717
- nvim-cmp |neopyter-integration-nvim-cmp|
1818
- textobjects |neopyter-integration-textobjects|
19-
8. API |neopyter-api|
19+
7. API |neopyter-api|
2020
- Async |neopyter-api-async|
21-
9. Features |neopyter-features|
22-
10. Acknowledges |neopyter-acknowledges|
23-
11. Configuration Types |neopyter-configuration-types|
21+
8. Features |neopyter-features|
22+
9. Acknowledges |neopyter-acknowledges|
23+
10. Configuration Types |neopyter-configuration-types|
2424

2525
==============================================================================
2626
1. Introduction *neopyter-introduction*
@@ -55,6 +55,12 @@ Ultimately, `Neopyter` can control `Juppyter lab`. `Neopyter` can implement
5555
abilities like jupynium.nvim <https://github.com/kiyoon/jupynium.nvim>.
5656

5757

58+
SPECIFICATIONS *neopyter-introduction-specifications*
59+
60+
Please refer to doc/specification.ipynb <doc/specification.ipynb> and
61+
doc/specification.ju.py <doc/specification.ju.py>
62+
63+
5864
==============================================================================
5965
2. Requirements *neopyter-requirements*
6066

@@ -92,9 +98,6 @@ NEOVIM PLUGIN *neopyter-installation-neovim-plugin*
9298

9399
- With 💤lazy.nvim:
94100

95-
For all config, ref to |neopyter-configuration| and
96-
|neopyter-configuration-types|
97-
98101
>lua
99102
{
100103
"SUSTech-data/neopyter",
@@ -110,45 +113,6 @@ For all config, ref to |neopyter-configuration| and
110113
}
111114
<
112115

113-
Suggest keymaps(`neopyter` don’t provide default keymap):
114-
115-
>lua
116-
on_attach = function(buf)
117-
local function map(mode, lhs, rhs, desc)
118-
vim.keymap.set(mode, lhs, rhs, { desc = desc, buffer = buf })
119-
end
120-
-- same, recommend the former
121-
map("n", "<C-Enter>", "<cmd>Neopyter execute notebook:run-cell<cr>", "run selected")
122-
-- map("n", "<C-Enter>", "<cmd>Neopyter run current<cr>", "run selected")
123-
124-
-- same, recommend the former
125-
map("n", "<space>X", "<cmd>Neopyter execute notebook:run-all-above<cr>", "run all above cell")
126-
-- map("n", "<space>X", "<cmd>Neopyter run allAbove<cr>", "run all above cell")
127-
128-
-- same, recommend the former, but the latter is silent
129-
map("n", "<space>nt", "<cmd>Neopyter execute kernelmenu:restart<cr>", "restart kernel")
130-
-- map("n", "<space>nt", "<cmd>Neopyter kernel restart<cr>", "restart kernel")
131-
132-
map("n", "<S-Enter>", "<cmd>Neopyter execute runmenu:run<cr>", "run selected and select next")
133-
map("n", "<M-Enter>", "<cmd>Neopyter execute run-cell-and-insert-below<cr>", "run selected and insert below")
134-
135-
map("n", "<F5>", "<cmd>Neopyter execute notebook:restart-run-all<cr>", "restart kernel and run all")
136-
end
137-
<
138-
139-
140-
==============================================================================
141-
4. Usage *neopyter-usage*
142-
143-
- Open JupyterLab `jupyter lab`, there is a sidebar named `Neopyter`, which display neopyter ip+port
144-
- Open a `*.ju.py` file in neovim
145-
- Now you can type `# %%` in Neovim to create a code cell.
146-
- You’ll see everything you type below that will be synchronised in the browser
147-
148-
149-
==============================================================================
150-
5. Configuration *neopyter-configuration*
151-
152116
Default configuration ~
153117

154118
>lua
@@ -197,11 +161,46 @@ Default configuration ~
197161
}
198162
<
199163

200-
See |neopyter-configuration-types| for all type description.
164+
See |neopyter-configuration-types| for all option type description.
165+
166+
Suggest keymaps(`neopyter` don’t provide default keymap):
167+
168+
>lua
169+
on_attach = function(buf)
170+
local function map(mode, lhs, rhs, desc)
171+
vim.keymap.set(mode, lhs, rhs, { desc = desc, buffer = buf })
172+
end
173+
-- same, recommend the former
174+
map("n", "<C-Enter>", "<cmd>Neopyter execute notebook:run-cell<cr>", "run selected")
175+
-- map("n", "<C-Enter>", "<cmd>Neopyter run current<cr>", "run selected")
176+
177+
-- same, recommend the former
178+
map("n", "<space>X", "<cmd>Neopyter execute notebook:run-all-above<cr>", "run all above cell")
179+
-- map("n", "<space>X", "<cmd>Neopyter run allAbove<cr>", "run all above cell")
180+
181+
-- same, recommend the former, but the latter is silent
182+
map("n", "<space>nt", "<cmd>Neopyter execute kernelmenu:restart<cr>", "restart kernel")
183+
-- map("n", "<space>nt", "<cmd>Neopyter kernel restart<cr>", "restart kernel")
184+
185+
map("n", "<S-Enter>", "<cmd>Neopyter execute runmenu:run<cr>", "run selected and select next")
186+
map("n", "<M-Enter>", "<cmd>Neopyter execute run-cell-and-insert-below<cr>", "run selected and insert below")
187+
188+
map("n", "<F5>", "<cmd>Neopyter execute notebook:restart-run-all<cr>", "restart kernel and run all")
189+
end
190+
<
191+
192+
193+
==============================================================================
194+
4. Usage *neopyter-usage*
195+
196+
- Open JupyterLab `jupyter lab`, there is a sidebar named `Neopyter`, which display neopyter ip+port
197+
- Open a `*.ju.py` file in neovim
198+
- Now you can type `# %%` in Neovim to create a code cell.
199+
- You’ll see everything you type below that will be synchronised in the browser
201200

202201

203202
==============================================================================
204-
6. Available Vim Commands *neopyter-available-vim-commands*
203+
5. Available Vim Commands *neopyter-available-vim-commands*
205204

206205
- Status
207206
- `:Neopyter status` alias to `:checkhealth neopyter` currently
@@ -226,7 +225,7 @@ See |neopyter-configuration-types| for all type description.
226225

227226

228227
==============================================================================
229-
7. Integration *neopyter-integration*
228+
6. Integration *neopyter-integration*
230229

231230

232231
NEOCONF.NVIM *neopyter-integration-neoconf.nvim*
@@ -350,7 +349,7 @@ Supported captures in `textobjects` query group
350349

351350

352351
==============================================================================
353-
8. API *neopyter-api*
352+
7. API *neopyter-api*
354353

355354
`Neopyter` provides rich lua APIs, you could use below code as initialization:
356355

@@ -368,8 +367,8 @@ Supported captures in `textobjects` query group
368367
current_notebook:run_all_below()
369368
<
370369

371-
- |neopyter-notebook-api|
372-
- |neopyter-jupyterlab-api-api|
370+
- Notebook API: |neopyter-notebook-api|
371+
- JupyterLab API|neopyter-jupyterlab-api-api|
373372

374373

375374
ASYNC *neopyter-api-async*
@@ -397,7 +396,7 @@ ASYNC *neopyter-api-async*
397396

398397

399398
==============================================================================
400-
9. Features *neopyter-features*
399+
8. Features *neopyter-features*
401400

402401
- Neovim
403402
- ☒ Full sync
@@ -445,7 +444,7 @@ ASYNC *neopyter-api-async*
445444

446445

447446
==============================================================================
448-
10. Acknowledges *neopyter-acknowledges*
447+
9. Acknowledges *neopyter-acknowledges*
449448

450449
- jupynium.nvim <https://github.com/kiyoon/jupynium.nvim>: Selenium-automated Jupyter Notebook that is synchronised with Neovim in real-time.
451450
- snacks.nvim <https://github.com/folke/snacks.nvim>: The `zen` highlight is inspired by `snacks.zen`

0 commit comments

Comments
 (0)