Skip to content

Commit

Permalink
feat(cache): auto-generate cache on first load
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmckendry committed Jul 29, 2024
1 parent bca6544 commit 68d7298
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua/cyberdream/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ end
M.load = function()
local cache = io.open(cache_file, "r")
if not cache then
M.build(require("cyberdream.theme").setup())
local notify = vim.defer_fn(function()
util.notify("Cache file not found, run :CyberdreamBuildCache to generate", "warn")
util.notify(" Building cache...\n A restart may be required for changes to take effect.")
M.load()
end, 1000)
return notify
end

local theme = vim.json.decode(cache:read("*a"))

for group, opts in pairs(theme.highlights) do
vim.api.nvim_set_hl(0, group, opts)
end

M.load_options(theme)

vim.g.colors_name = "cyberdream"
end

Expand Down

0 comments on commit 68d7298

Please sign in to comment.