mirror of
https://github.com/gabehf/base46.git
synced 2026-03-16 10:45:55 -07:00
create another cache file which loads vim.opt.bg
related to https://github.com/NvChad/NvChad/issues/1237
This commit is contained in:
parent
ce738b118f
commit
cf83cc0689
1 changed files with 10 additions and 4 deletions
|
|
@ -81,9 +81,8 @@ M.load_highlight = function(group)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- convert table into string
|
-- convert table into string
|
||||||
M.table_to_str = function(filename, tb)
|
M.table_to_str = function(tb)
|
||||||
local theme_type = M.get_theme_tb "type" -- dark / light
|
local result = ""
|
||||||
local result = filename == "defaults" and "vim.opt.bg='" .. theme_type .. "'" or ""
|
|
||||||
|
|
||||||
for hlgroupName, hlgroup_vals in pairs(tb) do
|
for hlgroupName, hlgroup_vals in pairs(tb) do
|
||||||
local hlname = "'" .. hlgroupName .. "',"
|
local hlname = "'" .. hlgroupName .. "',"
|
||||||
|
|
@ -105,7 +104,7 @@ M.saveStr_to_cache = function(filename, tb)
|
||||||
-- It helped me understand string.dump stuff
|
-- It helped me understand string.dump stuff
|
||||||
|
|
||||||
local cache_path = vim.fn.stdpath "cache" .. "/nvchad/base46/"
|
local cache_path = vim.fn.stdpath "cache" .. "/nvchad/base46/"
|
||||||
local lines = 'require("base46").compiled = string.dump(function()' .. M.table_to_str(filename, tb) .. "end)"
|
local lines = 'require("base46").compiled = string.dump(function()' .. M.table_to_str(tb) .. "end)"
|
||||||
local file = io.open(cache_path .. filename, "wb")
|
local file = io.open(cache_path .. filename, "wb")
|
||||||
|
|
||||||
loadstring(lines, "=")()
|
loadstring(lines, "=")()
|
||||||
|
|
@ -131,6 +130,13 @@ M.compile = function()
|
||||||
|
|
||||||
M.saveStr_to_cache(filename, integration)
|
M.saveStr_to_cache(filename, integration)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local bg_file = io.open(vim.fn.stdpath "cache" .. "/nvchad/base46/bg", "wb")
|
||||||
|
|
||||||
|
if bg_file then
|
||||||
|
bg_file:write("vim.opt.bg='" .. M.get_theme_tb "type".."'")
|
||||||
|
bg_file:close()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.load_all_highlights = function()
|
M.load_all_highlights = function()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue