Skip to content

Commit

Permalink
fix: update reload function for new options structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Feb 16, 2024
1 parent da96d83 commit b8e8a9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ AstroCore provides the core Lua API that powers [AstroNvim](https://github.com/A
## ⚡️ Requirements

- Neovim >= 0.9
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim)
- [lazy.nvim](https://github.com/folke/lazy.nvim)
- [resession.nvim][resession] (_optional_)

Expand All @@ -25,7 +24,6 @@ Install the plugin with the lazy plugin manager:
```lua
return {
"AstroNvim/astrocore",
dependencies = { "nvim-lua/plenary.nvim" },
lazy = false, -- disable lazy loading
priority = 10000, -- load AstroCore first
opts = {
Expand Down
12 changes: 2 additions & 10 deletions lua/astrocore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,10 @@ end

--- Partially reload AstroNvim user settings. Includes core vim options, mappings, and highlights. This is an experimental feature and may lead to instabilities until restart.
function M.reload()
local was_modifiable = vim.opt.modifiable:get()

local reload_module = require("plenary.reload").reload_module
reload_module "astronivm.options"
if package.loaded["config.options"] then reload_module "config.options" end

local lazy, was_modifiable = require "lazy", vim.opt.modifiable:get()
if not was_modifiable then vim.opt.modifiable = true end
local success, fault = pcall(require, "astronvim.options")
if not success then vim.api.nvim_err_writeln("Failed to load " .. module .. "\n\n" .. fault) end
if not was_modifiable then vim.opt.modifiable = false end
local lazy = require "lazy"
lazy.reload { plugins = { M.get_plugin "astrocore" } }
if not was_modifiable then vim.opt.modifiable = false end
if M.is_available "astroui" then lazy.reload { plugins = { M.get_plugin "astroui" } } end
vim.cmd.doautocmd "ColorScheme"
end
Expand Down

0 comments on commit b8e8a9b

Please sign in to comment.