mirror of
https://github.com/gabehf/base46.git
synced 2026-03-09 07:28:50 -07:00
misc
This commit is contained in:
parent
24634e947c
commit
ef124d74b7
1 changed files with 14 additions and 13 deletions
|
|
@ -101,21 +101,22 @@ end
|
|||
-- save table
|
||||
M.table_to_file = function(filename, tb)
|
||||
local file = io.open(filename, "w")
|
||||
local result = ""
|
||||
|
||||
for hlgroupName, hlgroup_vals in pairs(tb) do
|
||||
local hlname = "'" .. hlgroupName .. "',"
|
||||
local opts = ""
|
||||
|
||||
for optName, optVal in pairs(hlgroup_vals) do
|
||||
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
|
||||
local result = ""
|
||||
|
||||
for hlgroupName, hlgroup_vals in pairs(tb) do
|
||||
local hlname = "'" .. hlgroupName .. "',"
|
||||
local opts = ""
|
||||
|
||||
for optName, optVal in pairs(hlgroup_vals) do
|
||||
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
|
||||
|
||||
file:write(result)
|
||||
file:close()
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue