docs: update neovim's setup section (#749)

This commit is contained in:
Myriad-Dreamin 2024-10-29 22:56:05 +08:00 committed by GitHub
parent 493f8a8695
commit b97907cde6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 62 additions and 46 deletions

View file

@ -23,17 +23,42 @@ See #link("https://github.com/Myriad-Dreamin/tinymist#features")[Tinymist Featur
}
```
== Minimal Setup: LazyVim as an Example
<minimal-setup-lazyvim-as-an-example>
This section shows you a minimal way to setup tinymist in Neovim (LazyVim).
== Setup
+ Copy or merge the #link("https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/config/autocmds.lua")[Autocmds file] and #link("https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/plugins/tinymist.lua")[Plugin file] to corresponding paths into `~/.config/nvim/`.
+ Check and restart Neovim.
This section shows you a minimal way to setup tinymist in #link("https://www.lazyvim.org/")[LazyVim]. For other distros, we also bring some tips for you.
// todo: heading link support
Please see #md-alter(link(<neovim-extra-settings>)[Extra Settings], () => link("#extra-settings")[Extra Settings]) for more configuration.
=== Setup for #link("https://www.lazyvim.org/")[LazyVim]
Copy or merge the two files to corresponding paths into `~/.config/nvim/`.
- #link("https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/config/autocmds.lua")[Autocmds file] will help associate `.typ` file extension to `typst` filetype.
- #link("https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/plugins/tinymist.lua")[Plugin file] will help start tinymist for buffers with the `typst` filetype.
Then, check and restart Neovim.
=== Setup for #link("https://github.com/AstroNvim")[AstroVim]
AstroNvim now uses tinymist by default. Please check the #link("https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/pack/typst")[setup script].
=== Setup for #link("https://github.com/neoclide/coc.nvim")[coc.nvim]
You can edit the `coc-settings.json` by executing `:CocConfig`:
```json
{
"languageserver": {
"tinymist": {
"command": "tinymist",
"filetypes": ["typst"],
"settings": { ... }
}
}
}
```
== Tips
<tips>
=== Working with Multiple-File Projects
@ -98,23 +123,6 @@ return {
See #link("https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/Configuration.md")[Tinymist Server Configuration] for references.
=== Configuring Language Server for COC
<configuring-coc-language-server>
To configure language server for #link("https://github.com/neoclide/coc.nvim")[coc.nvim], you can edit the `coc-settings.json` by executing `:CocConfig`:
```json
"languageserver": {
"tinymist": {
"command": "tinymist",
"filetypes": ["typst"],
"settings": {
"exportPdf": "onType",
"outputPath" = "$root/target/$dir/$name",
}
}
}
```
=== Configuring Folding Range for Neovim Client
<configuring-folding-range-for-neovim-client>
Enable LSP-based folding range with `kevinhwang91/nvim-ufo`:

View file

@ -42,17 +42,42 @@ To enable LSP, you must install `tinymist`. You can find `tinymist` by:
}
```
## Minimal Setup: LazyVim as an Example
## Setup
This section shows you a minimal way to setup tinymist in Neovim (LazyVim).
1. Copy or merge the [Autocmds file](https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/config/autocmds.lua) and [Plugin file](https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/plugins/tinymist.lua) to corresponding paths into `~/.config/nvim/`.
1. Check and restart Neovim.
This section shows you a minimal way to setup tinymist in [LazyVim](https://www.lazyvim.org/). For other distros, we also bring some tips for you.
Please see [Extra Settings](#extra-settings) for more configuration.
### Setup for [LazyVim](https://www.lazyvim.org/)
Copy or merge the two files to corresponding paths into `~/.config/nvim/`.
- [Autocmds file](https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/config/autocmds.lua) will help associate `.typ` file extension to `typst` filetype.
- [Plugin file](https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/plugins/tinymist.lua) will help start tinymist for buffers with the `typst` filetype.
Then, check and restart Neovim.
### Setup for [AstroVim](https://github.com/AstroNvim)
AstroNvim now uses tinymist by default. Please check the [setup script](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/pack/typst).
### Setup for [coc.nvim](https://github.com/neoclide/coc.nvim)
You can edit the `coc-settings.json` by executing `:CocConfig`:
```json
{
"languageserver": {
"tinymist": {
"command": "tinymist",
"filetypes": ["typst"],
"settings": { ... }
}
}
}
```
## Tips
### Working with Multiple-File Projects
@ -118,23 +143,6 @@ return {
See [Tinymist Server Configuration](https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/neovim/Configuration.md) for references.
### Configuring Language Server for COC
To configure language server for [coc.nvim](https://github.com/neoclide/coc.nvim), you can edit the `coc-settings.json` by executing `:CocConfig`:
```json
"languageserver": {
"tinymist": {
"command": "tinymist",
"filetypes": ["typst"],
"settings": {
"exportPdf": "onType",
"outputPath" = "$root/target/$dir/$name",
}
}
}
```
### Configuring Folding Range for Neovim Client
Enable LSP-based folding range with `kevinhwang91/nvim-ufo`: