format stuff

This commit is contained in:
siduck76 2021-09-01 19:42:23 +05:30
parent 38a47c27e3
commit 41434f352f

View file

@ -1,43 +1,48 @@
local function highlight(group, guifg, guibg, attr, guisp) local function highlight(group, guifg, guibg, attr, guisp)
local parts = {group} local parts = { group }
if guifg then table.insert(parts, "guifg=#"..guifg) end if guifg then
if guibg then table.insert(parts, "guibg=#"..guibg) end table.insert(parts, "guifg=#" .. guifg)
if attr then end
table.insert(parts, "gui="..attr) if guibg then
table.insert(parts, "guibg=#" .. guibg)
end
if attr then
table.insert(parts, "gui=" .. attr)
end
if guisp then
table.insert(parts, "guisp=#" .. guisp)
end end
if guisp then table.insert(parts, "guisp=#"..guisp) end
-- nvim.ex.highlight(parts) -- nvim.ex.highlight(parts)
vim.api.nvim_command('highlight '..table.concat(parts, ' ')) vim.api.nvim_command("highlight " .. table.concat(parts, " "))
end end
-- Modified from https://github.com/chriskempson/base16-vim -- Modified from https://github.com/chriskempson/base16-vim
local function apply_base16_theme(theme) local function apply_base16_theme(theme)
-- Neovim terminal colours -- Neovim terminal colours
if vim.fn.has("nvim") then if vim.fn.has "nvim" then
vim.g.terminal_color_0 = "#"..theme.base00 vim.g.terminal_color_0 = "#" .. theme.base00
vim.g.terminal_color_1 = "#"..theme.base08 vim.g.terminal_color_1 = "#" .. theme.base08
vim.g.terminal_color_2 = "#"..theme.base0B vim.g.terminal_color_2 = "#" .. theme.base0B
vim.g.terminal_color_3 = "#"..theme.base0A vim.g.terminal_color_3 = "#" .. theme.base0A
vim.g.terminal_color_4 = "#"..theme.base0D vim.g.terminal_color_4 = "#" .. theme.base0D
vim.g.terminal_color_5 = "#"..theme.base0E vim.g.terminal_color_5 = "#" .. theme.base0E
vim.g.terminal_color_6 = "#"..theme.base0C vim.g.terminal_color_6 = "#" .. theme.base0C
vim.g.terminal_color_7 = "#"..theme.base05 vim.g.terminal_color_7 = "#" .. theme.base05
vim.g.terminal_color_8 = "#"..theme.base03 vim.g.terminal_color_8 = "#" .. theme.base03
vim.g.terminal_color_9 = "#"..theme.base08 vim.g.terminal_color_9 = "#" .. theme.base08
vim.g.terminal_color_10 = "#"..theme.base0B vim.g.terminal_color_10 = "#" .. theme.base0B
vim.g.terminal_color_11 = "#"..theme.base0A vim.g.terminal_color_11 = "#" .. theme.base0A
vim.g.terminal_color_12 = "#"..theme.base0D vim.g.terminal_color_12 = "#" .. theme.base0D
vim.g.terminal_color_13 = "#"..theme.base0E vim.g.terminal_color_13 = "#" .. theme.base0E
vim.g.terminal_color_14 = "#"..theme.base0C vim.g.terminal_color_14 = "#" .. theme.base0C
vim.g.terminal_color_15 = "#"..theme.base07 vim.g.terminal_color_15 = "#" .. theme.base07
if vim.o.background == "light" then if vim.o.background == "light" then
vim.g.terminal_color_background = "#"..theme.base05 vim.g.terminal_color_background = "#" .. theme.base05
vim.g.terminal_color_foreground = "#"..theme.base0B vim.g.terminal_color_foreground = "#" .. theme.base0B
else else
vim.g.terminal_color_background = "#"..theme.base00 vim.g.terminal_color_background = "#" .. theme.base00
vim.g.terminal_color_foreground = "#"..theme.base0E vim.g.terminal_color_foreground = "#" .. theme.base0E
end end
end end
@ -74,7 +79,7 @@ local function apply_base16_theme(theme)
highlight("Title", theme.base0D, nil, "none", nil) highlight("Title", theme.base0D, nil, "none", nil)
highlight("Conceal", theme.base0D, theme.base00, nil, nil) highlight("Conceal", theme.base0D, theme.base00, nil, nil)
highlight("Cursor", theme.base00, theme.base05, nil, nil) highlight("Cursor", theme.base00, theme.base05, nil, nil)
highlight("NonText", theme.base03, nil,nil, nil) highlight("NonText", theme.base03, nil, nil, nil)
highlight("LineNr", theme.base03, "NONE", nil, nil) highlight("LineNr", theme.base03, "NONE", nil, nil)
highlight("SignColumn", theme.base03, "NONE", nil, nil) highlight("SignColumn", theme.base03, "NONE", nil, nil)
highlight("StatusLine", theme.base04, "NONE", "none", nil) highlight("StatusLine", theme.base04, "NONE", "none", nil)
@ -279,9 +284,9 @@ return setmetatable({
result[key] = value result[key] = value
end end
return result return result
end end,
}, { }, {
__call = function (_, ...) __call = function(_, ...)
apply_base16_theme(...) apply_base16_theme(...)
end, end,
}) })