Files
zenbones-theme/lua/zenbones/shipwright/runners/vim.lua
Michael Chris Lopez 0473b25a05 fix lint errors
2021-11-06 12:04:23 +08:00

64 lines
1.7 KiB
Lua

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"
local function to_vim_autoload(colorscheme)
local vimcolors, term, name = unpack(colorscheme)
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"
-- selene: allow(undefined_variable)
run(
specs,
lushwright.to_vimscript,
lushwright.vim_compatible_vimscript,
function(vimcolors)
return { vimcolors, term, name }
end,
to_vim_autoload,
{ prepend, [[" This file is auto-generated by shipwright.nvim]] },
{ overwrite, string.format("autoload/%s.vim", name) }
)
-- selene: deny(undefined_variable)