Migration to v6.0
AstroNvim v6 brings together many exciting updates mainly focusing on moving towards newer Neovim APIs. Neovim v0.11 introduced a new LSP configuration API (vim.lsp.config) which over the past year has been refined and cleaned up. Now with the release of Neovim v0.12 this API seems to be stable and nearly has feature parity with the original method with the API previously provided by nvim-lspconfig. Along with this LSP restructuring, Neovim has been pushing to integrate a solid treesitter API into the core Neovim codebase. This has led to a big refactor of the nvim-treesitter plugin to simply act as a treesitter language parser download utility rather than providing modules and functionality. AstroNvim v6 adapts to both of these major breaking changes and utilizes itās core plugins such as AstroCore and AstroLSP to make sure these features are still easy to configure for users. Along with these we have removed a few legacy plugins that were only enabled in Neovim v0.10 as well as plugins that do not support the new vim.lsp.config APIs.
Setting Up a Migration Environment
Section titled āSetting Up a Migration EnvironmentāBreaking your working editor configuration when migrating to v6 will make it difficult to edit your new configuration. As such, we recommend following the process below so that your existing editor keeps working while you upgrade to the new v6 configuration. This workflow makes use of an Isolated Installation environment.
-
Clone the AstroNvim v6 configuration template to a new location (
astronvim_v6is used as the example):Terminal window git clone https://github.com/AstroNvim/template ~/.config/astronvim_v6rm -rf ~/.config/astronvim_v6/.git -
Start
nvimin the new environment.nvimshould start, bootstrap itself by installing and loadinglazy.nvim. Lazy will load all of the plugins specified by AstroNvim.Terminal window NVIM_APPNAME=astronvim_v6 nvim -
Migrate your AstroNvim v5 configuration to your new AstroNvim v6 environment at
~/.config/astronvim_v6using the guide below. You can use your previous AstroNvim setup to do the editing and then continue running the command in Step 2 to test the new installation. -
Once you have your configuration set up how you like it, move it over to the default neovim configuration location
~/.config/nvim:Terminal window # Backup old Neovim foldersmv ~/.local/share/nvim ~/.local/share/nvim.bak # backup old data foldermv ~/.local/state/nvim ~/.local/state/nvim.bak # backup old state foldermv ~/.cache/nvim ~/.cache/nvim.bak # backup old cache foldermv ~/.config/nvim ~/.config/nvim.bak # backup old config# Move new configuration into placemv ~/.config/astronvim_v6 ~/.config/nvim # move new config -
Run your new v6 environment simply with
nvimš
Migration Guide
Section titled āMigration GuideāConfiguration Option Changes
Section titled āConfiguration Option ChangesāEach āMigratingā section below has an link to documentation and/or an example configuration. Each example configuration file shows the structure for configuring that plugin. The comments in each example configuration describes the configuration keys.
The plugin configuration files. in the AstroNvim codebase itself are also a good reference to learn how to configure.
Please also read the Other Breaking Changes section - there are a number of changes that are not just āmove some config from one place to anotherā. For example, updating default plugins to new releases with breaking changes which may require configuration changes if the user has modified them.
If you get stuck, people on the Discord forum are active and friendly! Like all humans, sometimes they are grumpy, so be nice to them! The best place to post is most likely the #help-forum, but poke around a few of the other channels, you never know what you will find that is useful.
Plugin Changes
Section titled āPlugin ChangesāAstroNvim v6 comes with some changes to our default plugin list that userās should keep in mind while performing the migration.
Renamed Plugins
Section titled āRenamed PluginsāA few plugins have been updated to a new name due to changes in the plugin repository owner. Please make sure to search and replace the old plugin entry names with the new to make sure plugin spec merging happens correctly.
| Old Plugin Name | New Plugin Name |
|---|---|
Saghen/blink.cmp | saghen/blink.cmp |
echasnovski/mini.icons | nvim-mini/mini.icons |
williamboman/mason-lspconfig.nvim | mason-org/mason-lspconfig.nvim |
williamboman/mason.nvim | mason-org/mason.nvim |
Removed Plugins
Section titled āRemoved PluginsāA few plugins have been removed due to being replaced with core Neovim functions or no longer support the new Neovim APIs.
| Old Plugin Name | Reason |
|---|---|
JoosepAlviste/nvim-ts-context-commentstring | Not necessary in Neovim v0.11+ and built in commenting |
folke/neoconf.nvim | Does not support vim.lsp.config |
kevinhwang91/nvim-ufo | Replaced with built in foldexpr |
RRethy/vim-illuminate | Replaced with snacks.words module in folke/snacks.nvim |
Details
Section titled āDetailsānvim-ufoandnvim-ts-context-commentstringin v5 were only used when users were using Neovim v0.10, so this shouldnāt require changes for most users. If you were previously using AstroNvim v5 and Neovim v0.10 please make sure to remove usages of these plugins in your configuration, or if you want to continue using these rather than the built in functionality explore installing them again using AstroCommunity.neoconf.nvimhas been removed as folke is no longer supporting it in lieu of focusing on users utilizing the newvim.lsp.configAPI and the newlsp/<server_name>.luaconfiguration files. If you were previously usingneoconf.nvimfor project local LSP settings, look into alternatives. A lot of language servers support project configuration files (such as.luarcfor the Lua language server), for other language servers project local Neovim configuration files can be used with theexrcoption (see:h exrc).
AstroNvim Core Plugin Changes
Section titled āAstroNvim Core Plugin ChangesāAstroCore
Section titled āAstroCoreā-
Configuration of Treesitter features in Neovim. With the latest development of the
nvim-treesitterplugin, the plugin has moved to simply being a download utility for treesitter parsers and it is up to the user to configure treesitter features such as highlighting and folding. This also applies tonvim-treesitter-textobjectswhich now is simply a plugin that provides an API for manually creating key mappings. AstroCore has added a newtreesittermodule to help aid with this and can be configured through the plugin configurationopts. This configuration table includes the ability to configure bothnvim-treesitterandnvim-treesitter-textobjectsin a similar format to how they were configured before. If you have custom configuration for either plugins you will need to migrate those plugin configurations to AstroCore. For more details, checkout the new Treesitter Configuration Documentationlua/plugins/astrocore_treesitter.lua return {"nvim-treesitter/nvim-treesitter",opts = {ensure_installed = { "vim", "lua" },highlight = { enable = true },textobjects = {select = {keymaps = {["ak"] = { query = "@block.outer", desc = "around block" },},},},},"AstroNvim/astrocore",---@type AstroCoreOptsopts = {treesitter = {ensure_installed = { "vim", "lua" },highlight = true,textobjects = {select = {select_textobject = {["ak"] = { query = "@block.outer", desc = "around block" },},},},},},}
AstroLSP
Section titled āAstroLSPāThe biggest change for AstroLSP is the migration to using vim.lsp.config as the backend for language server configuration. In general, this doesnāt change all that much of the configuration. The config and handlers tables can still be used for configuring language server options as well as how they are actually enabled, but now each table has a ["*"] key for defining defaults. Below is a walk through of each major configuration change:
-
config["*"]is now used for the default language server options which in turn callsvim.lsp.config("*", config_table). Previously this was done with separatecapabilitiesandflagstables at the root of the AstroLSP opts. If you have anything in thecapabilitiesorflagstables, they should be moved toconfig["*"].capabilitiesandconfig["*"].flagsrespectively.lua/plugins/astroui_default_config.lua return {"AstroNvim/astrolsp",---@type AstroLSPOptsopts = {capabilities = {textDocument = {foldingRange = { dynamicRegistration = false },},},flags = {exit_timeout = 5000,},config = {["*"] = {capabilities = {textDocument = {foldingRange = { dynamicRegistration = false },},},flags = {exit_timeout = 5000,},},},},} -
The
handlerstable default handler is no longer done through the first entry with no key which blended list-like and dictionary-like tables. This is now done with the"*"key. This makes it clearer to the user which handler is the global one and cleaner to define. The other change is the default handler is nowvim.lsp.enableby default. Lastly, handler functions here simply provide the server name as a parameter and no longer pass in the server options. Users should use the newvim.lsp.config[server_name]built in Neovim LSP API for accessing the resolved language server configuration table.lua/plugins/astroui_default_handler.lua return {"AstroNvim/astrolsp",---@type AstroLSPOptsopts = {handlers = {function(server, opts)require("lspconfig")[server].setup(opts)end,["*"] = function(server)-- If you need the LSP options for a server use `vim.lsp.config` table-- This is useful for cases of setting up language server specific pluginslocal opts = vim.lsp.config[server]vim.lsp.enable(server)end,},},} -
require("astrolsp").lsp_opts(server_name)function has been removed, users should replace all usages withvim.lsp.config[server_name]. This typically comes up when configuring language server specific plugins. For migration of language server specific plugins, you should also verify with each plugin to make sure they have support for the newvim.lsp.configAPIs and Neovim v0.11+. Some plugins that are no longer actively maintained may still rely on oldnvim-lspconfigAPIs that are no longer available. Be sure to check out the updated Advanced LSP Setup Documentation. -
Previously we had a relatively undocumented configuration table for
mason_lspconfigwhich allowed hot patching mason-lspconfig to recognize packages that didnāt define their language servers. This is no longer necessary as the Mason Registry maintenance has been improved and the registry provides the mapping to language servers rather thanmason-lspconfigmaintaining the mapping. This configuration table and functionality has been removed, if you happen to use it you should remove all usages.
AstroUI
Section titled āAstroUIā- No user facing changes, code updated to use new APIs in AstroNvim plugins as well as core Neovim.
Other Breaking Changes
Section titled āOther Breaking Changesā- Drop support for Neovim v0.9
nvim-treesitter/nvim-treesitterhas been updated to the new (and default)mainbranch with the latest rewrite and development. Verify that user installed treesitter based plugins are updated to use this new version rather than the removed module system of the previousnvim-treesitterrelease.nvim-treesitter/nvim-treesitter-textobjectshas been updated to the new (and default)mainbranch. This refactors it to no longer be a module fornvim-treesitter. If you are doing configuration of this plugin in your user configuration, make sure to follow the AstroCore changes detailed above.mason-org/mason-lspconfig.nvimhas been updated to v2 which utilizes the newvim.lsp.configAPIs as well as Mason packages self registering as language servers. Make sure language server specific plugins are not reliant onmason-lspconfigv1 if they have any sort of integration.:LspInfo,:LspLog,:LspStart,:LspRestart,:LspStopcommands fromnvim-lspconfigare removed in Neovim v0.12 and are replaced with the built in:lspcommand (:h lsp-commands). If you are using these commands in your configuration make sure to update them accordingly.
New Features
Section titled āNew Featuresā-
Full adoption of
vim.lsp.configwhich includes support for configuring language servers withlsp/<server_name>.lua(:h lsp-configfor more details) -
Migration to using
winborderNeovim option for specifying window border settings. This provides a single option for choosing to remove borders from floating windows.lua/plugins/disable_borders.lua return {{"AstroNvim/astrocore",---@type AstroCoreOptsopts = {options = {opt = {winborder = "none",},},},},} -
New mappings:
<Leader>lw- Workspace diagnostics (Neovim v0.12+ only)