2021-11-06 11:37:55 +08:00
|
|
|
local template = [[function! $name#load()
|
|
|
|
|
|
|
|
|
|
$termcolors
|
|
|
|
|
$vimcolors
|
|
|
|
|
highlight! link StatusLineTerm StatusLine
|
|
|
|
|
highlight! link StatusLineTermNC StatusLineNC
|
|
|
|
|
|
|
|
|
|
if has('terminal')
|
|
|
|
|
let g:terminal_ansi_colors = [
|
|
|
|
|
\ g:terminal_color_0,
|
|
|
|
|
\ g:terminal_color_1,
|
|
|
|
|
\ g:terminal_color_2,
|
|
|
|
|
\ g:terminal_color_3,
|
|
|
|
|
\ g:terminal_color_4,
|
|
|
|
|
\ g:terminal_color_5,
|
|
|
|
|
\ g:terminal_color_6,
|
|
|
|
|
\ g:terminal_color_7,
|
|
|
|
|
\ g:terminal_color_8,
|
|
|
|
|
\ g:terminal_color_9,
|
|
|
|
|
\ g:terminal_color_10,
|
|
|
|
|
\ g:terminal_color_11,
|
|
|
|
|
\ g:terminal_color_12,
|
|
|
|
|
\ g:terminal_color_13,
|
|
|
|
|
\ g:terminal_color_14,
|
|
|
|
|
\ g:terminal_color_15
|
|
|
|
|
\ ]
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
]]
|
|
|
|
|
|
|
|
|
|
local helpers = require "shipwright.transform.helpers"
|
|
|
|
|
|
2021-11-06 12:04:23 +08:00
|
|
|
local function to_vim_autoload(colorscheme)
|
|
|
|
|
local vimcolors, term, name = unpack(colorscheme)
|
2021-11-06 11:37:55 +08:00
|
|
|
local termcolors = ""
|
|
|
|
|
for i, v in ipairs(term) do
|
|
|
|
|
termcolors = termcolors .. string.format("let g:terminal_color_%s = '%s'\n", (i - 1), v.hex)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local text = helpers.apply_template(template, {
|
|
|
|
|
name = name,
|
|
|
|
|
termcolors = termcolors,
|
|
|
|
|
vimcolors = table.concat(vimcolors, "\n"),
|
|
|
|
|
})
|
|
|
|
|
return { text }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local lushwright = require "shipwright.transform.lush"
|
|
|
|
|
|
2021-11-06 12:04:23 +08:00
|
|
|
-- selene: allow(undefined_variable)
|
2021-11-06 11:37:55 +08:00
|
|
|
run(
|
|
|
|
|
specs,
|
|
|
|
|
lushwright.to_vimscript,
|
|
|
|
|
lushwright.vim_compatible_vimscript,
|
2021-11-06 12:04:23 +08:00
|
|
|
function(vimcolors)
|
|
|
|
|
return { vimcolors, term, name }
|
|
|
|
|
end,
|
2021-11-06 11:37:55 +08:00
|
|
|
to_vim_autoload,
|
|
|
|
|
{ prepend, [[" This file is auto-generated by shipwright.nvim]] },
|
|
|
|
|
{ overwrite, string.format("autoload/%s.vim", name) }
|
|
|
|
|
)
|
2021-11-06 12:04:23 +08:00
|
|
|
-- selene: deny(undefined_variable)
|