astral.nvim is a Neovim plugin for colorscheme persistence.
This very simple plugin allows Neovim to remember the last used colorscheme and restore it when Neovim opens.
- Remembers the last used colorscheme and restores it when Neovim opens.
- Allows setting fallback themes if the saved colorscheme is not available.
Using lazy.nvim, add the plugin to your configuration:
require("lazy").setup({
{
"rootiest/astral.nvim",
version = "*", -- Pin to GitHub releases
},
})You can configure the astral plugin by passing a table of options to require("astral").setup().
The default values for astral configuration are:
local config = {
fallback_themes = { -- Default fallback themes
"catppuccin",
"tokyonight",
"default"
},
}To set the options for astral,
use the following lazy.nvim configuration:
require("lazy").setup({
{
"astral/astral.nvim",
version = "*", -- Pin to GitHub releases
opts = {
fallback_themes = { -- Customize fallback themes
"catppuccin",
"tokyonight",
"default"
},
}
},
}):Astral reset: Reset the colorscheme management.:Astral restore: Restore the last used colorscheme.
- ColorScheme: Store the new name when the colorscheme changes.
If you encounter issues with astral.nvim, here are some common problems and
solutions:
-
Colorscheme not restoring on startup:
- Ensure
restore_colorsis set totruein the configuration. - Check if
vim.g.COLORTHEMEis set and holds the correct colorscheme name.
- Ensure
-
Fallback themes not applied:
- Verify that the
fallback_themesarray in the configuration contains valid colorscheme names. - Ensure that the fallback themes are installed and available in Neovim.
- Verify that the
-
Unknown Astral command error:
- Ensure you are using valid commands. The available commands are:
:Astral reset:Astral restore
- Ensure you are using valid commands. The available commands are:
-
Colorscheme changes not saved:
- Ensure there are no errors in the autocommand that triggers on the
ColorSchemeevent. - Check if
vim.g.COLORTHEMEis being updated correctly when you change the colorscheme.
- Ensure there are no errors in the autocommand that triggers on the
If the issue persists, please open an issue on the GitHub repository with details about your configuration and the problem you are facing.
astral.nvim is licensed under the MIT License. See LICENSE for details.
Contributions are welcome! Please open an issue or submit a pull request to the GitHub repository.
