Skip to content

Commit 530243c

Browse files
committed
feat: more documentation update of AstroNvim v6 changes
1 parent 3ace3ab commit 530243c

11 files changed

Lines changed: 86 additions & 169 deletions

File tree

src/content/docs/configuration/customizing_plugins.mdx

Lines changed: 37 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,18 @@ return {
7878
},
7979
},
8080
},
81-
-- customize treesitter parsers
81+
-- customize enabled AstroLSP servers
8282
{
83-
"nvim-treesitter/nvim-treesitter",
83+
"AstroNvim/astrolsp",
8484
opts = function(_, opts)
85-
-- list like portions of a table cannot be merged naturally and require the user to merge it manually
85+
-- list like portions of a table cannot be merged naturally and may require the user to merge it manually
8686
-- check to make sure the key exists
87-
if not opts.ensure_installed then
88-
opts.ensure_installed = {}
87+
if not opts.servers then
88+
opts.servers = {}
8989
end
90-
vim.list_extend(opts.ensure_installed, {
91-
"lua",
92-
"vim",
93-
-- add more arguments for adding more treesitter parsers
90+
vim.list_extend(opts.servers, {
91+
"lua_ls",
92+
-- add more arguments for manually enabling more language servers
9493
})
9594
end,
9695
},
@@ -110,19 +109,19 @@ The `table` notation is the simplest method for configuration but does not cover
110109

111110
:::tip
112111

113-
Since [`lazy.nvim` v10.23.0](https://github.com/folke/lazy.nvim/releases/tag/v10.23.0) a new configuration option has been added called `opts_extend` which allows specifying that a part of the options passed to the `opts` table should be treated as a list that is extended rather than replaced completely as described below. Since [AstroNvim v4.9.0](https://github.com/AstroNvim/AstroNvim/releases/tag/v4.9.0) this option has been enabled out of the box for the `ensure_installed` tables for [`nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter) and [`mason-tool-installer.nvim`](https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim). This allows the user to use the basic table notation to simply add more items to these `ensure_installed` lists.
112+
Since [`lazy.nvim` v10.23.0](https://github.com/folke/lazy.nvim/releases/tag/v10.23.0) a new configuration option has been added called `opts_extend` which allows specifying that a part of the options passed to the `opts` table should be treated as a list that is extended rather than replaced completely as described below. Since [AstroNvim v4.9.0](https://github.com/AstroNvim/AstroNvim/releases/tag/v4.9.0) this option has been enabled out of the box for the `ensure_installed` tables for [`mason-tool-installer.nvim`](https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim). This allows the user to use the basic table notation to simply add more items to these `ensure_installed` lists.
114113

115114
:::
116115

117-
Let's take a closer look at these two notations with an example using [`nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter). Let's assume the default configuration for `nvim-treesitter` is:
116+
Let's take a closer look at these two notations with an example using [`mason-tool-installer.nvim`](https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim). Let's assume the default configuration for `mason-tool-installer` is:
118117

119118
```lua
120119
return {
121-
"nvim-treesitter/nvim-treesitter",
120+
"WhoIsSethDaniel/mason-tool-installer.nvim",
122121
opts = {
123-
ensure_installed = { "lua", "vim" },
124-
highlight = {
125-
enable = true,
122+
ensure_installed = { "lua_ls" },
123+
integrations = {
124+
["mason-lspconfig"] = true,
126125
},
127126
},
128127
}
@@ -132,9 +131,9 @@ With this specification the current `opts` would resolve to the table:
132131

133132
```lua
134133
opts = {
135-
ensure_installed = { "lua", "vim" },
136-
highlight = {
137-
enable = true,
134+
ensure_installed = { "lua_ls" },
135+
integrations = {
136+
["mason-lspconfig"] = true,
138137
},
139138
}
140139
```
@@ -143,67 +142,36 @@ If you use the table notation to override these fields in your configuration lik
143142

144143
```lua
145144
return {
146-
"nvim-treesitter/nvim-treesitter",
145+
"WhoIsSethDaniel/mason-tool-installer.nvim",
147146
opts = {
148-
ensure_installed = { "python" },
149-
highlight = {
150-
enable = false,
147+
ensure_installed = { "prettier" },
148+
integrations = {
149+
["mason-lspconfig"] = false,
150+
["mason-nvim-dap"] = true,
151151
},
152-
indent = {
153-
enable = false,
154-
},
155-
},
156-
}
157-
```
158-
159-
You would end up with the `opts` resolving to:
160-
161-
```lua
162-
opts = {
163-
ensure_installed = { "python" },
164-
highlight = {
165-
enable = false,
166-
},
167-
indent = {
168-
enable = false,
169152
},
170153
}
171154
```
172155

173-
The `highlight.enabled` and `indent.enabled` fields work as expected, but the `ensure_installed` table does not actually extend the list and instead simply overwrites it. This is a limitation of the table merging. To resolve this we can rewrite our `opts` as a function where the first parameter is the resolve plugin specification (this is rarely used but may be useful in very advanced cases) and the second parameter which is the current `opts` table:
174-
175-
```lua
176-
return {
177-
"nvim-treesitter/nvim-treesitter",
178-
opts = function(plugin, opts)
179-
table.insert(opts.ensure_installed, "python")
180-
end,
181-
}
182-
```
183-
184156
You would end up with the `opts` resolving to:
185157

186158
```lua
187159
opts = {
188-
ensure_installed = { "lua", "vim", "python" },
189-
highlight = {
190-
enable = true,
160+
ensure_installed = { "prettier" },
161+
integrations = {
162+
["mason-lspconfig"] = false,
163+
["mason-nvim-dap"] = true,
191164
},
192165
}
193166
```
194167

195-
One thing to watch out for (that `table` merging handles automatically, but the function notation does not) is the creation of nested/parent keys. When using a function to modify `opts`, you’re responsible for ensuring that nested tables exist before setting any values on them. For example, if we want to set `indent.enable = true` in our `opts` with the function notation, it would look something like this:
168+
The `integrations.mason-lspconfig` and `integrations.mason-nvim-dap` fields work as expected, but the `ensure_installed` table does not actually extend the list and instead simply overwrites it. This is a limitation of the table merging. To resolve this we can rewrite our `opts` as a function where the first parameter is the resolve plugin specification (this is rarely used but may be useful in very advanced cases) and the second parameter which is the current `opts` table:
196169

197170
```lua
198171
return {
199-
"nvim-treesitter/nvim-treesitter",
172+
"WhoIsSethDaniel/mason-tool-installer.nvim",
200173
opts = function(plugin, opts)
201-
-- check if an `indent` table exists, if not, create it
202-
if not opts.indent then
203-
opts.indent = {}
204-
end
205-
-- once we know it is created, we can set the sub-keys
206-
opts.indent.enable = true
174+
table.insert(opts.ensure_installed, "prettier")
207175
end,
208176
}
209177
```
@@ -212,12 +180,9 @@ You would end up with the `opts` resolving to:
212180

213181
```lua
214182
opts = {
215-
ensure_installed = { "lua", "vim", "python" },
216-
highlight = {
217-
enable = true,
218-
},
219-
indent = {
220-
enable = true,
183+
ensure_installed = { "lua_ls", "prettier" },
184+
integrations = {
185+
["mason-lspconfig"] = true,
221186
},
222187
}
223188
```
@@ -226,7 +191,7 @@ Notice how we didn't return anything from this function. In Lua, tables are pass
226191

227192
```lua
228193
return {
229-
"nvim-treesitter/nvim-treesitter",
194+
"WhoIsSethDaniel/mason-tool-installer.nvim",
230195
opts = function(plugin, opts)
231196
return {}
232197
end,
@@ -239,7 +204,7 @@ You would end up with the `opts` resolving to:
239204
opts = {}
240205
```
241206

242-
The last thing that this function notation provides is the ability to `require` modules safely even with lazy loading. `nvim-treesitter` isn't a great example of this, so here is a simple example with `nvim-cmp`. `nvim-cmp` allows the configuration of mappings and provides helper functions to make setting these mappings easy. Because `nvim-cmp` is lazy loaded, the function notation is required in this situation so that we don't break the lazy loading:
207+
The last thing that this function notation provides is the ability to `require` modules safely even with lazy loading. `mason-tool-installer.nvim` isn't a great example of this, so here is a simple example with `nvim-cmp`. `nvim-cmp` allows the configuration of mappings and provides helper functions to make setting these mappings easy. Because `nvim-cmp` is lazy loaded, the function notation is required in this situation so that we don't break the lazy loading:
243208

244209
```lua
245210
return {
@@ -293,17 +258,17 @@ return {
293258

294259
##### `list_insert_unique`
295260

296-
Other times when you do list inserting you want to safely insert new entries into a list but skip over values that already exist. This is useful if you are importing lots of language packs in AstroCommunity. Here is the previous `nvim-treesitter` example above using this function:
261+
Other times when you do list inserting you want to safely insert new entries into a list but skip over values that already exist. This is useful if you are importing lots of language packs in AstroCommunity. Here is the previous `mason-tool-installer` example above using this function:
297262

298263
```lua
299264
return {
300-
"nvim-treesitter/nvim-treesitter",
265+
"WhoIsSethDaniel/mason-tool-installer.nvim",
301266
opts = function(plugin, opts)
302267
-- `list_insert_unique` is in place, so it will modify
303268
-- the first parameter table if provided
304269
require("astrocore").list_insert_unique(
305270
opts.ensure_installed,
306-
{ "python", "vim" }
271+
{ "lua_ls", "prettier" }
307272
)
308273
end,
309274
}

src/content/docs/faq.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ If you're already using a Nerd Font and face this issue it's very likely that yo
3434

3535
If your icons appear too small it's because you're using a Mono font. If a font ends with `mono` the icons will also be monospaced. [Video recommendation](https://youtu.be/mQdB_kHyZn8) on how to install a Nerd Font for a handful of popular terminals.
3636

37-
## Why am I getting `symbol not found` error on Mac OS Sonoma?
38-
39-
This was a bug in core Neovim not supporting Mac OS Sonoma. Most likely you have an outdated [Neovim](https://github.com/neovim/neovim) version, please update to at least v0.10.
40-
4137
## Why is `<Leader>fw` not working?
4238

4339
Make sure you have [ripgrep](https://github.com/BurntSushi/ripgrep) installed. For other missing feature please check [optional requirements section](/#-requirements) in the documentation.

src/content/docs/index.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ AstroNvim is an aesthetically pleasing and feature-rich neovim config that is ex
2525
## ⚡ Requirements
2626

2727
- [Nerd Fonts](https://www.nerdfonts.com/font-downloads) (_Optional with manual intervention:_ See [Recipes/Customizing Icons](/recipes/icons#disable-icons)) <sup>[[1]](#1)</sup>
28-
- [Neovim v0.10+ (_Not_ including nightly)](https://github.com/neovim/neovim/releases/tag/stable)
28+
- [Neovim v0.11+ (_Not_ including nightly)](https://github.com/neovim/neovim/releases/tag/stable)
2929
- [Tree-sitter CLI](https://github.com/tree-sitter/tree-sitter/blob/master/crates/cli/README.md) (_Note:_ This is only necessary if you want to use `auto_install` feature with Treesitter)
3030
- A clipboard tool is necessary for the integration with the system clipboard (see [`:help clipboard-tool`](https://neovim.io/doc/user/provider.html#clipboard-tool) for supported solutions)
3131
- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using) <sup>[[2]](#2)</sup>
@@ -161,7 +161,6 @@ docker run -w /root -it --rm alpine:edge sh -uelic '
161161
> Example: `:DapInstall python`
162162
163163
- **Manage plugins**
164-
165164
- Run `:Lazy check` (`<Leader>pu`) to check for plugin updates
166165
- Run `:Lazy update` (`<Leader>pU`) to apply any pending plugin updates
167166
- Run `:Lazy sync` (`<Leader>pS`) to update and clean plugins

src/content/docs/mappings.mdx

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -138,35 +138,36 @@ AstroNvim generally relies on `<Leader>` driven mappings, which is default set t
138138

139139
## LSP Mappings
140140

141-
| Action | Mappings |
142-
| --------------------------- | -------------------------------- |
143-
| LSP Info | `Leader + li` |
144-
| None-ls Info | `Leader + lI` |
145-
| Hover Document | `K` |
146-
| Format Document | `Leader + lf` |
147-
| Symbols Outline | `Leader + lS` |
148-
| Line Diagnostics | `gl`, `Leader + ld`, `<C-W> + d` |
149-
| All Diagnostics | `Leader + lD` |
150-
| Code Actions | `gra`, `Leader + la` |
151-
| Source Code Actions | `Leader + lA` |
152-
| Signature Help | `Leader + lh` |
153-
| Rename | `grn`, `Leader + lr` |
154-
| Document Symbols | `Leader + ls` |
155-
| Workspace Symbols | `Leader + lG` |
156-
| Diagnostic Next | `]d` |
157-
| Diagnostics Previous | `[d` |
158-
| Diagnostic Error Next | `]e` |
159-
| Diagnostic Error Previous | `[e` |
160-
| Diagnostic Warning Next | `]w` |
161-
| Diagnostic Warning Previous | `[w` |
162-
| Document Symbol Next | `]y` |
163-
| Document Symbol Previous | `[y` |
164-
| Document Symbol | `gO` |
165-
| Declaration | `gD` |
166-
| Type Definition | `gy` |
167-
| Definition | `gd` |
168-
| Implementation | `gri` |
169-
| References | `grr`, `Leader + lR` |
141+
| Action | Mappings |
142+
| --------------------------- | ---------------------------------- |
143+
| LSP Info | `Leader + li` |
144+
| None-ls Info | `Leader + lI` |
145+
| Hover Document | `K` |
146+
| Format Document | `Leader + lf` |
147+
| Symbols Outline | `Leader + lS` |
148+
| Line Diagnostics | `gl`, `Leader + ld`, `<C-W> + d` |
149+
| All Diagnostics | `Leader + lD` |
150+
| Workspace Diagnostics | `Leader + lw` (Neovim v0.12+ only) |
151+
| Code Actions | `gra`, `Leader + la` |
152+
| Source Code Actions | `Leader + lA` |
153+
| Signature Help | `Leader + lh` |
154+
| Rename | `grn`, `Leader + lr` |
155+
| Document Symbols | `Leader + ls` |
156+
| Workspace Symbols | `Leader + lG` |
157+
| Diagnostic Next | `]d` |
158+
| Diagnostics Previous | `[d` |
159+
| Diagnostic Error Next | `]e` |
160+
| Diagnostic Error Previous | `[e` |
161+
| Diagnostic Warning Next | `]w` |
162+
| Diagnostic Warning Previous | `[w` |
163+
| Document Symbol Next | `]y` |
164+
| Document Symbol Previous | `[y` |
165+
| Document Symbol | `gO` |
166+
| Declaration | `gD` |
167+
| Type Definition | `gy` |
168+
| Definition | `gd` |
169+
| Implementation | `gri` |
170+
| References | `grr`, `Leader + lR` |
170171

171172
## Debugger Mappings
172173

src/content/docs/recipes/advanced_lsp.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ return {
676676

677677
## Inlay Hints
678678

679-
Since Neovim v0.10 there is the ability to handle and render inline virtual text and therefore first class support of inlay hints. AstroLSP comes with a built in feature for enabling inlay hints easily as well as toggling them during runtime. By default inlay hints are disabled, but they can easily be enabled by default by modifying `features.inlay_hints` in the AstroLSP `opts`:
679+
Neovim has the ability to handle and render inline virtual text and therefore first class support of inlay hints. AstroLSP comes with a built in feature for enabling inlay hints easily as well as toggling them during runtime. By default inlay hints are disabled, but they can easily be enabled by default by modifying `features.inlay_hints` in the AstroLSP `opts`:
680680

681681
```lua title="lua/plugins/inlay_hints.lua"
682682
return {

src/content/docs/recipes/diagnostics.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ return {
1818
-- All available options can be found with `:h vim.diagnostic.Opts`
1919
diagnostics = {
2020
virtual_text = true,
21-
virtual_lines = false, -- Neovim v0.11+ only
21+
virtual_lines = false,
2222
update_in_insert = false,
2323
underline = true,
2424
severity_sort = true,
@@ -47,7 +47,7 @@ return {
4747
-- All available options can be found with `:h vim.diagnostic.Opts`
4848
diagnostics = {
4949
virtual_text = true,
50-
virtual_lines = true, -- Neovim v0.11+ only
50+
virtual_lines = true,
5151
update_in_insert = false,
5252
underline = true,
5353
severity_sort = true,

src/content/docs/recipes/disable_borders.mdx

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ id: disable_borders
33
title: Disable Borders
44
---
55

6-
By default AstroNvim unifies the user interface to utilize rounded borders. If you prefer other border types such as setting borders to `"none"` then you currently must do this for each individual plugin which has configurable borders. The provided code below helps aid the user in getting started with this.
7-
8-
It is worth noting that Neovim v0.11 adds support for a new option, `winborder`, which will allow an easy place to change this option. Currently AstroNvim is not able to utilize this option due to lack of support in plugins currently which leads to unexpected results in the user interface. Once plugins catch up in general we will move to utilizing this option globally to improve the user configuration experience.
6+
By default AstroNvim unifies the user interface to utilize rounded borders. If you prefer other border types such as setting borders to `"none"` then you currently must do this for each individual plugin which has configurable borders. This can be easily configured with the `vim.opt.winborder` configuration setting. Here is some example code:
97

108
:::tip
119

@@ -21,50 +19,16 @@ return {
2119
:::
2220

2321
```lua title="lua/plugins/disable_borders.lua"
24-
local border_type = "none"
25-
2622
return {
2723
{
2824
"AstroNvim/astrocore",
2925
---@type AstroCoreOpts
3026
opts = {
31-
diagnostics = { float = { border = border_type } },
32-
},
33-
},
34-
{
35-
"AstroNvim/astrolsp",
36-
optional = true,
37-
---@type AstroLSPOpts
38-
opts = {
39-
defaults = {
40-
hover = { border = border_type },
41-
signature_help = { border = border_type },
42-
},
43-
},
44-
},
45-
{
46-
"akinsho/toggleterm.nvim",
47-
optional = true,
48-
opts = {
49-
float_opts = { border = border_type },
50-
},
51-
},
52-
{
53-
"rcarriga/nvim-dap-ui",
54-
optional = true,
55-
opts = {
56-
floating = { border = border_type },
57-
},
58-
},
59-
{
60-
"Saghen/blink.cmp",
61-
optional = true,
62-
opts = {
63-
completion = {
64-
menu = { border = border_type },
65-
documentation = { window = { border = border_type } },
27+
options = {
28+
opt = {
29+
winborder = "none",
30+
},
6631
},
67-
signature = { window = { border = border_type } },
6832
},
6933
},
7034
}

src/content/docs/recipes/icons.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ return {
212212
},
213213
},
214214
{
215-
"echasnovski/mini.icons",
215+
"nvim-mini/mini.icons",
216216
optional = true,
217217
opts = {
218218
lsp = {

0 commit comments

Comments
 (0)