move template files into lua

This commit is contained in:
Michael Chris Lopez
2021-09-04 16:40:29 +08:00
parent 702156951f
commit d41487904c
5 changed files with 81 additions and 77 deletions

View File

@@ -1,9 +1,50 @@
local template = [[# vim:ft=kitty
## name: zenbones
## license: MIT
## author: Michael Chris Lopez
## upstream: https://github.com/mcchrish/zenbones.nvim/raw/main/extras/kitty/zenbones.conf
background ${background}
foreground ${foreground}
selection_background ${selection_background}
selection_foreground ${selection_foreground}
url_color ${url_color}
cursor ${cursor}
# Tabs
active_tab_background ${active_tab_background}
active_tab_foreground ${active_tab_foreground}
inactive_tab_background ${inactive_tab_background}
inactive_tab_foreground ${inactive_tab_foreground}
#tab_bar_background ${tab_bar_background}
# normal
color0 ${color0}
color1 ${color1}
color2 ${color2}
color3 ${color3}
color4 ${color4}
color5 ${color5}
color6 ${color6}
color7 ${color7}
# bright
color8 ${color8}
color9 ${color9}
color10 ${color10}
color11 ${color11}
color12 ${color12}
color13 ${color13}
color14 ${color14}
color15 ${color15}
]]
local theme = require "zenbones"
local terminal = require "zenbones.terminal"
local bg = theme.Normal.bg.hex
local fg = theme.Normal.fg.hex
local specs = {
local values = {
background = bg,
foreground = fg,
selection_background = theme.Visual.bg.hex,
@@ -16,7 +57,7 @@ local specs = {
inactive_tab_foreground = fg,
}
for i, v in ipairs(terminal.colors) do
specs["color" .. (i - 1)] = v.hex
values["color" .. (i - 1)] = v.hex
end
return { "extras/kitty/zenbones.conf", specs }
return { "extras/kitty/zenbones.conf", template, values }

View File

@@ -2,6 +2,40 @@ local lush = require "lush"
local theme = require "zenbones"
local terminal = require "zenbones.terminal"
local template = [[if exists('g:colors_name')
highlight clear
syntax reset
set t_Co=256
endif
set background=light
let g:colors_name = 'zenbones'
${termcolors}
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
${vimcolors}
]]
local termcolors = ""
for i, v in ipairs(terminal.colors) do
termcolors = termcolors .. string.format("let g:terminal_color_%s = '%s'\n", (i - 1), v.hex)
@@ -12,6 +46,7 @@ local vimcolors = table.concat(vim.fn.sort(lush.compile(theme, { exclude_keys =
return {
"colors/zenbones.vim",
template,
{
termcolors = termcolors,
vimcolors = vimcolors,