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`: