94 lines
3.1 KiB
Lua
94 lines
3.1 KiB
Lua
local function to_vim_autoload(colorscheme)
|
|
local vimcolors, term = unpack(colorscheme)
|
|
|
|
local termcolors = {
|
|
string.format("let g:terminal_color_0 = '%s'", term.black),
|
|
string.format("let g:terminal_color_1 = '%s'", term.red),
|
|
string.format("let g:terminal_color_2 = '%s'", term.green),
|
|
string.format("let g:terminal_color_3 = '%s'", term.yellow),
|
|
string.format("let g:terminal_color_4 = '%s'", term.blue),
|
|
string.format("let g:terminal_color_5 = '%s'", term.magenta),
|
|
string.format("let g:terminal_color_6 = '%s'", term.cyan),
|
|
string.format("let g:terminal_color_7 = '%s'", term.white),
|
|
string.format("let g:terminal_color_8 = '%s'", term.bright_black),
|
|
string.format("let g:terminal_color_9 = '%s'", term.bright_red),
|
|
string.format("let g:terminal_color_10 = '%s'", term.bright_green),
|
|
string.format("let g:terminal_color_11 = '%s'", term.bright_yellow),
|
|
string.format("let g:terminal_color_12 = '%s'", term.bright_blue),
|
|
string.format("let g:terminal_color_13 = '%s'", term.bright_magenta),
|
|
string.format("let g:terminal_color_14 = '%s'", term.bright_cyan),
|
|
string.format("let g:terminal_color_15 = '%s'", term.bright_white),
|
|
}
|
|
|
|
return vim.list_extend(termcolors, vimcolors)
|
|
end
|
|
|
|
local function left_pad(lines, length)
|
|
local padded_lines = {}
|
|
for _, line in ipairs(lines) do
|
|
line = table.insert(padded_lines, string.rep(" ", length) .. line)
|
|
end
|
|
return padded_lines
|
|
end
|
|
|
|
local lushwright = require "shipwright.transform.lush"
|
|
|
|
---@diagnostic disable: undefined-global
|
|
-- selene: allow(undefined_variable)
|
|
run(
|
|
specs,
|
|
lushwright.to_vimscript,
|
|
lushwright.vim_compatible_vimscript,
|
|
function(colors)
|
|
local vimcolors = vim.tbl_filter(function(color)
|
|
return not (
|
|
string.match(color, "@")
|
|
or string.match(color, "Noice")
|
|
or string.match(color, "Telescope")
|
|
or string.match(color, "Leap")
|
|
or string.match(color, "Hop")
|
|
or string.match(color, "Neogit")
|
|
or string.match(color, "NvimTree")
|
|
or string.match(color, "Cmp")
|
|
or string.match(color, "Mason")
|
|
)
|
|
end, colors)
|
|
return {
|
|
vimcolors,
|
|
term,
|
|
}
|
|
end,
|
|
to_vim_autoload,
|
|
{ prepend, [[" This codeblock is auto-generated by shipwright.nvim]] },
|
|
{ left_pad, 4 },
|
|
{
|
|
patchwrite,
|
|
string.format("colors/%s.vim", specs_name),
|
|
string.format([[" %s start]], background),
|
|
string.format([[" %s end]], background),
|
|
}
|
|
)
|
|
-- selene: deny(undefined_variable)
|
|
---@diagnostic enable: undefined-global
|
|
|
|
local function remove_italics(specs)
|
|
local italic_specs = {}
|
|
for key, hl in pairs(specs) do
|
|
if hl.gui == "italic" and key ~= "Italic" and not string.match(key, "@") then
|
|
table.insert(italic_specs, string.format("highlight %s gui=NONE cterm=NONE", key))
|
|
end
|
|
end
|
|
return vim.fn.sort(italic_specs)
|
|
end
|
|
|
|
---@diagnostic disable: undefined-global
|
|
-- selene: allow(undefined_variable)
|
|
run(specs, remove_italics, { prepend, [[" This codeblock is auto-generated by shipwright.nvim]] }, { left_pad, 8 }, {
|
|
patchwrite,
|
|
string.format("colors/%s.vim", specs_name),
|
|
string.format([[" no italics %s start]], background),
|
|
string.format([[" no italics %s end]], background),
|
|
})
|
|
-- selene: deny(undefined_variable)
|
|
---@diagnostic enable: undefined-global
|