Migration to v5.0
While AstroNvim v4 came with a large restructuring of the configuration organization, AstroNvim v5 is a much smaller major version release and mainly comes with some modernization of plugins and small quality of life improvements. The most notable change in AstroNvim v5 is that support for Neovim <0.10 has been dropped and users must be running either Neovim stable releases of v0.10 or v0.11. Most of the migration will only apply to users who have gone and customized the plugins that have been replaced. The plugin replacements come from various reasons such as plugins getting archived (dressing.nvim
), better performance, more stable development practices, and overall simplification.
Setting Up a Migration Environment
Breaking your working editor configuration when migrating to v5 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 v5 configuration. This workflow makes use of an Isolated Installation environment.
-
Clone the AstroNvim v5 configuration template to a new location (
astronvim_v5
is used as the example):Terminal window git clone https://github.com/AstroNvim/template ~/.config/astronvim_v5rm -rf ~/.config/astronvim_v5/.git -
Start
nvim
in the new environment.nvim
should start, bootstrap itself by installing and loadinglazy.nvim
. Lazy will load all of the plugins specified by AstroNvim.Terminal window NVIM_APPNAME=astronvim_v5 nvim -
Migrate your AstroNvim v4 configuration to your new AstroNvim v5 environment at
~/.config/astronvim_v5
using 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_v5 ~/.config/nvim # move new config -
Run your new v5 environment simply with
nvim
🎉
Migration Guide
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, in key mapping <leader>
is no longer recognized.
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
AstroNvim v5 comes with some changes to our default plugin list that user’s should keep in mind while performing the migration.
Overview
Details
-
mason-tool-installer.nvim
(New Plugin)- AstroNvim is now relying on
mason-tool-installer.nvim
rather thanmason-lspconfig
/mason-nvim-dap
/mason-null-ls
. This makes configuration of installed packages easier rather than managing severalensure_installed
tables and also adds support for installing packages automatically that are not part of any of those usecase specific plugins.mason-tool-installer.nvim
also allows the user to specify specific package versions and other options. Check out themason-tool-installer.nvim
Documentation for details on it’s configuration. - For migration, anywhere in your configuration where you are configuring
ensure_installed
formason-lspconfig
/mason-nvim-dap
/mason-null-ls
, you should move those to anensure_installed
table inmason-tool-installer.nvim
. You must also change the name of the package where necessary to properly reflect the name of the package in Mason. For instance, if you havelua_ls
specified formason-lspconfig
, this would belua-language-server
inmason-tool-installer.nvim
.
- AstroNvim is now relying on
-
- If you are customizing
alpha-nvim
, checkout the updated Dashboard Customizations recipes and thesnacks.dashboard
Documentation for how to implement the same customizations in the new plugin.
- If you are customizing
-
- If you are customizing the
input
field indressing.nvim
, check out thesnacks.input
Documentation for how to implement the same customizations in the new plugin. - If you are customizing the
select
field indressing.nvim
, checkout thesnacks.picker
Documentation for how to implement the same customizations in the new plugin.
- If you are customizing the
-
indent-blankline.nvim
→snacks.nvim
- If you are customizing
indent-blankline.nvim
, checkout thesnacks.indent
Documentation for how to implement the same customizations in the new plugin.
- If you are customizing
-
-
If you are customizing lsp kind icons, check out the
mini.icons
Documentation for how to implement the same custom icons in the new plugin. -
If you have customized the
mode
option inlspkind.nvim
to change the look of the LSP icons, this can be done easily by customizing thecompletion.menu.draw.columns
option inblink.cmp
:lua/plugins/blink_menu.lua return {"Saghen/blink.cmp",opts = {completion = {menu = {draw = {columns = {-- rearrange these as necessary to match desired look{ "label", "label_description", gap = 1 },{ "kind_icon", "kind", gap = 1 },},},},},},}
-
-
- If you are using any of the API provided by
mini.bufremove
, check out thesnacks.bufdelete
Documentation for the new method names to call.
- If you are using any of the API provided by
-
- If you are customizing
nvim-cmp
, checkout the updated Cmp Customizations recipes and theblink.cmp
Documentation for how to implement the same customizations in the new plugin.
- If you are customizing
-
nvim-colorizer.lua
→nvim-highlight-colors
- If you are customizing
nvim-colorizer.lua
, check out thenvim-highlight-colors
Documentation for how to implement the same customizations in the new plugin.
- If you are customizing
-
- If you are customizing
nvim-notify
, checkout thesnacks.notify
Documentation for how to implement the same customizations in the new plugin.
- If you are customizing
-
nvim-web-devicons
→mini.icons
- If you are customizing icons, check out the
mini.icons
Documentation for how to implement the same custom icons in the new plugin.
- If you are customizing icons, check out the
-
- If you are customizing
telescope.nvim
, checkout thesnacks.picker
Documentation for how to implement the same customizations in the new plugin. - Some plugins have strong
telescope.nvim
integration, if you have plugins such as this, look to see if they have support forsnacks.picker
or just the nativevim.ui.select
function which will usesnacks.picker
. - If you want to revert back to using
telescope.nvim
, you can install it from AstroCommunity
- If you are customizing
AstroNvim Core Plugin Changes
AstroCore
- The
system_open
function has been removed and any references torequire("astrocore").system_open()
should be replaced withvim.ui.open()
- The
features.diagnostics_mode
configuration option has been simplified to just befeatures.diagnostics
. This new value is either a boolean (true
/false
) to enable/disable diagnostics completely on startup, or it can be a table in the form of{ virtual_text = true, virtual_lines = false }
to control the display of virtual text/virtual lines on startup. New toggles have been added (<Leader>uv
and<Leader>uV
) to toggle the virtual text and virtual lines at runtime. - The mapping
<Leader>ud
simply enables/disables diagnostics completely rather than managing various different states. - The
mappings
configuration table now does some basic normalization which means specific casing of the keys should not matter as much. It is still recommended to use the official keycode casing to maintain the most stable behavior (keycode casing can be found in:h keycodes
). - The
mason
module has been removed. If you are usingrequire("astrocore.mason")
anywhere, investigate the APIs available frommason.nvim
andmason-tool-installer.nvim
for alternatives.
AstroLSP
- Configuration of
vim.lsp.buf.hover
andvim.lsp.buf.signature_help
are no longer configured through thehandlers["textDocument/hover"]
andhandlers["textDocument/signature_help"]
configuration options. This is because of a breaking change in core Neovim where these are no longer configured as such. The options are now configured through a newdefaults
table in the AstroLSP configuration (defaults.hover
anddefaults.signature_help
). If you have customized those handlers in your configuration, then check the AstroLSP Documentation for where to place those configurations. - The
mappings
configuration table now does some basic normalization which means specific casing of the keys should not matter as much. It is still recommended to use the official keycode casing to maintain the most stable behavior (keycode casing can be found in:h keycodes
).
AstroUI
-
Introduction of a new
folding
module for a custom builtfoldexpr
function in order to replacenvim-ufo
.- This feature is currently only enabled by default if you are using Neovim v0.11 as this provides LSP based folding out of the box, but if you want to use it with Neovim v0.10 then you can simply disable
nvim-ufo
in your user configuration. - When in use, it also exposes a new command,
:AstroFoldInfo
which displays the current fold information. - The folding behavior can also be configured through the new
folding
configuration table which can be explored through the AstroUI Documentation which allows the user to configure when folding is enabled as well as which folding methods are utilized (currently supports treesitter based folding, indentation based folding, and LSP based folding which is Neovim v0.11 only).
- This feature is currently only enabled by default if you are using Neovim v0.11 as this provides LSP based folding out of the box, but if you want to use it with Neovim v0.10 then you can simply disable
-
AstroUI status providers and component defaults options can now be configured in the
opts
table throughstatus.providers
andstatus.components
.-
All of these options have strong typing and autocompletion as long as the type is set with Lua annotations in the code (an example of this is shown in the code example below).
-
This is primarily useful for customizing default options for the providers such as setting up custom LSP client name mappings or alignment/padding of some elements without having to fully modify the statusline in
heirline.nvim
. For example, if you want to set up custom LSP client names to be displayed, you can do the following:lua/plugins/astroui_lsp_client_names.lua return {"AstroNvim/astroui",---@type AstroUIOptsopts = {status = {providers = {lsp_client_names = {mappings = {-- display `lua_ls` as just `LUA` in the statuslinelua_ls = "LUA",},},},},},}
-
Other Breaking Changes
- Drop support for Neovim v0.9
AstroMasonUpdate
andAstroMasonUpdateAll
commands have been removed in favor for the commands provided bymason-tool-installer
- The mapping
<C-S>
for saving while in insert mode has been removed as this is now a core Neovim binding for showing signature help. - The mapping
gI
for lsp implementation has been moved togri
to align with new core Neovim default LSP mappings
New Features
Some changes have been made that do not necessarily require any user intervention during the migration, but are just new features! Here are a few highlights
- Neovim v0.11 adds a ton of great new features such as
vim.lsp.foldexpr
and context based comment strings. When using Neovim v0.11 we disable a few plugins and just rely on core featuresComment.nvim
andnvim-ts-context-commentstring
are disabled in Neovim v0.11 in favor of the built in commenting featuresnvim-ufo
is disabled in Neovim v0.11 in favor of the new AstroUI based fold expression. This provides a much clearer implementation of folding rather than relying on the “manual” fold method which can lead to some strange behavior.
- With Neovim v0.11 diagnostic navigation bindings (
[d
/]d
/[w
/]w
/[e
/]e
) supportv:count
, for example3]e
will navigate 3 errors forward. - New mappings
gco
andgcO
for inserting new comments below and above the current line - New mappings
<Leader>uv
and<Leader>uV
for toggling diagnostic virtual text and virtual lines (virtual lines are only available in Neovim v0.11 and can replace plugins such aslsp_lines.nvim
) - New mapping
gO
for document symbols to align with new core Neovim default LSP mappings - New mapping
<Leader>uZ
for toggling “Zen mode” for the current buffer which maximizes the buffer, centers the code, and disables most of the “eye candy” such as diagnostics - New mapping
<Leader>go
for opening the current buffer’s git URL in the browser if it is a git tracked file - A new command,
:AstroRename
has been added which renames the current file. This uses a new function in AstroCore,require("astrocore").rename_file()
- AstroLSP has a full implementation for LSP based file operations which can help with things such as updating import statements when renaming files. These features are now enabled by default and have integration with
neo-tree.nvim
when moving and renaming files as well as the:AstroRename
command