Files
zenbones-theme/lua/zenbones/template/vim.lua

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.6 KiB
Lua
Raw Normal View History

2021-09-21 20:55:53 +08:00
local template = [[" This file is auto-generated from lua/zenbones/template/vim.lua
2021-11-01 10:10:49 +08:00
function! ${name}#load()
2021-09-04 16:40:29 +08:00
2021-10-10 15:17:54 +08:00
${termcolors}
${vimcolors}
2021-10-26 12:52:22 +08:00
highlight! link StatusLineTerm StatusLine
highlight! link StatusLineTermNC StatusLineNC
2021-09-04 16:40:29 +08:00
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
2021-11-01 10:10:49 +08:00
endfunction
2021-09-04 16:40:29 +08:00
]]
2021-11-01 10:10:49 +08:00
return function(name, specs, p)
local lush = require "lush"
2021-10-10 13:43:40 +08:00
local term = require("zenbones.term").colors_map(p)
2021-09-14 07:50:23 +08:00
local termcolors = ""
2021-10-09 16:27:46 +08:00
for i, v in ipairs(term) do
2021-09-14 07:50:23 +08:00
termcolors = termcolors .. string.format("let g:terminal_color_%s = '%s'\n", (i - 1), v.hex)
end
2021-09-04 16:02:45 +08:00
2021-09-14 07:50:23 +08:00
-- Compile lush table, concatenate to a single string, and remove blend property
local compiled = lush.compile(specs, {
exclude_keys = { "blend" },
copy_cterm_from_gui = true,
})
local vimcolors = table.concat(vim.fn.sort(compiled), "\n")
2021-09-04 16:02:45 +08:00
2021-09-14 07:50:23 +08:00
return {
2021-11-01 10:10:49 +08:00
string.format("autoload/%s.vim", name),
2021-09-14 07:50:23 +08:00
template,
{
name = name,
specs_path = name,
2021-09-14 07:50:23 +08:00
termcolors = termcolors,
vimcolors = vimcolors,
},
}
2021-09-14 05:53:51 +08:00
end