siduck 3 years ago
parent 24634e947c
commit ef124d74b7

@ -101,21 +101,22 @@ end
-- save table -- save table
M.table_to_file = function(filename, tb) M.table_to_file = function(filename, tb)
local file = io.open(filename, "w") local file = io.open(filename, "w")
local result = ""
for hlgroupName, hlgroup_vals in pairs(tb) do if file then
local hlname = "'" .. hlgroupName .. "'," local result = ""
local opts = ""
for optName, optVal in pairs(hlgroup_vals) do for hlgroupName, hlgroup_vals in pairs(tb) do
local valueInStr = type(optVal) == "boolean" and " " .. tostring(optVal) or '"' .. optVal .. '"' local hlname = "'" .. hlgroupName .. "',"
opts = opts .. optName .. "=" .. valueInStr .. "," local opts = ""
end
result = result .. "vim.api.nvim_set_hl(0," .. hlname .. "{" .. opts .. "})" for optName, optVal in pairs(hlgroup_vals) do
end local valueInStr = type(optVal) == "boolean" and " " .. tostring(optVal) or '"' .. optVal .. '"'
opts = opts .. optName .. "=" .. valueInStr .. ","
end
result = result .. "vim.api.nvim_set_hl(0," .. hlname .. "{" .. opts .. "})"
end
if file then
file:write(result) file:write(result)
file:close() file:close()
end end

Loading…
Cancel
Save