add vim runner
This commit is contained in:
57
lua/zenbones/shipwright/runners/vim.lua
Normal file
57
lua/zenbones/shipwright/runners/vim.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
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(vimcolors)
|
||||
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"
|
||||
|
||||
run(
|
||||
specs,
|
||||
lushwright.to_vimscript,
|
||||
lushwright.vim_compatible_vimscript,
|
||||
to_vim_autoload,
|
||||
{ prepend, [[" This file is auto-generated by shipwright.nvim]] },
|
||||
{ overwrite, string.format("autoload/%s.vim", name) }
|
||||
)
|
||||
Reference in New Issue
Block a user