feat!: nvim-treesitter changes

This commit is contained in:
Michael Chris Lopez
2022-10-22 09:32:57 +08:00
parent 6455bdfa0e
commit bfb2e0d43a
17 changed files with 205 additions and 196 deletions

View File

@@ -1,7 +1,7 @@
local M = {}
local function make_specs(specs_name, ness)
local background = vim.opt.background:get()
local background = vim.o.background
package.loaded[specs_name] = nil
if ness == nil then
return require(specs_name)
@@ -26,7 +26,7 @@ local function make_env(colorscheme)
transform = require "zenbones.shipwright.transform",
}
vim.opt.background = colorscheme.background
vim.o.background = colorscheme.background
env.specs = make_specs(specs_name)
local ness = colorscheme.background == "light" and { "dim", "bright" } or { "stark", "warm" }
env["specs_" .. ness[1]] = make_specs(specs_name, ness[1])

View File

@@ -1,11 +1,7 @@
local function to_vim_autoload(colorscheme)
local vimcolors, term = 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)
end
termcolors = {
local termcolors = {
string.format("let g:terminal_color_0 = '%s'", term.black),
string.format("let g:terminal_color_1 = '%s'", term.red),
string.format("let g:terminal_color_2 = '%s'", term.green),
@@ -43,8 +39,15 @@ run(
specs,
lushwright.to_vimscript,
lushwright.vim_compatible_vimscript,
function(vimcolors)
return { vimcolors, term }
function(colors)
-- filter out treesitter
local vimcolors = vim.tbl_filter(function(color)
return not string.match(color, "@")
end, colors)
return {
vimcolors,
term,
}
end,
to_vim_autoload,
{ prepend, [[" This codeblock is auto-generated by shipwright.nvim]] },
@@ -62,7 +65,7 @@ run(
local function remove_italics(specs)
local italic_specs = {}
for key, hl in pairs(specs) do
if hl.gui == "italic" and key ~= "Italic" then
if hl.gui == "italic" and key ~= "Italic" and not string.match(key, "@") then
table.insert(italic_specs, string.format("highlight %s gui=NONE cterm=NONE", key))
end
end