move load_highlight functions to colors & term_hl

This commit is contained in:
krolyxon 2022-09-10 15:02:23 +05:30
parent 083d18269b
commit 0a5d53fac0
6 changed files with 45 additions and 21 deletions

View File

@ -30,6 +30,4 @@ for _, module in ipairs(modules) do
end
require("core.utils").load_mappings()
-- require("core.utils").load_highlight "syntax"
-- require("core.utils").load_highlight "nvim"
require("core.utils").load_highlight "core"
require("colors").core_setup()

24
lua/colors/init.lua Normal file
View File

@ -0,0 +1,24 @@
local M = {}
M.load_highlight = function(group)
-- if type(group) == "string" and group == "core" then
-- local syntax = require("colors.integrations.syntax")
-- local nvim = require("colors.integrations.nvim")
-- group = merge_tb("force", syntax, nvim)
-- end
if type(group) == "string" then
group = require("colors.integrations." .. group)
end
for hl, col in pairs(group) do
vim.api.nvim_set_hl(0, hl, col)
end
end
M.core_setup = function ()
require("colors.term_hl")
require("colors").load_highlight "syntax"
require("colors").load_highlight "nvim"
end
return M

18
lua/colors/term_hl.lua Normal file
View File

@ -0,0 +1,18 @@
local colors = require("colors.kdark").colors
vim.g.terminal_color_0 = "#" .. colors.black
vim.g.terminal_color_1 = "#" .. colors.red
vim.g.terminal_color_2 = "#" .. colors.green
vim.g.terminal_color_3 = "#" .. colors.yellow
vim.g.terminal_color_4 = "#" .. colors.blue
vim.g.terminal_color_5 = "#" .. colors.magenta
vim.g.terminal_color_6 = "#" .. colors.cyan
vim.g.terminal_color_7 = "#" .. colors.white
vim.g.terminal_color_8 = "#" .. colors.bright_black
vim.g.terminal_color_9 = "#" .. colors.bright_red
vim.g.terminal_color_10 = "#" .. colors.bright_green
vim.g.terminal_color_11 = "#" .. colors.bright_yellow
vim.g.terminal_color_12 = "#" .. colors.bright_blue
vim.g.terminal_color_13 = "#" .. colors.bright_magenta
vim.g.terminal_color_14 = "#" .. colors.bright_cyan
vim.g.terminal_color_15 = "#" .. colors.bright_white

View File

@ -1,22 +1,6 @@
local M = {}
local merge_tb = vim.tbl_deep_extend
M.load_highlight = function(group)
if type(group) == "string" and group == "core" then
local syntax = require("colors.integrations.syntax")
local nvim = require("colors.integrations.nvim")
group = merge_tb("force", syntax, nvim)
end
if type(group) == "string" then
group = require("colors.integrations." .. group)
end
for hl, col in pairs(group) do
vim.api.nvim_set_hl(0, hl, col)
end
end
M.close_buffer = function(bufnr)
if vim.bo.buftype == "terminal" then
vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide")

View File

@ -4,7 +4,7 @@ if not present then
return
end
require("core.utils").load_highlight "cmp"
require("colors").load_highlight "cmp"
vim.opt.completeopt = "menuone,noselect"

View File

@ -4,7 +4,7 @@ if not present then
return
end
require("core.utils").load_highlight "treesitter"
require("colors").load_highlight "treesitter"
local options = {
ensure_installed = {