mirror of
https://github.com/gabehf/base46.git
synced 2026-03-11 08:20:54 -07:00
parent
7b6fb92bcf
commit
1e803fd654
35 changed files with 552 additions and 436 deletions
|
|
@ -1,5 +1,4 @@
|
|||
local M = {}
|
||||
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
M.get_theme_tb = function(name, type)
|
||||
|
|
@ -27,27 +26,32 @@ M.merge_tb = function(table1, table2)
|
|||
return vim.tbl_deep_extend("force", table1, table2)
|
||||
end
|
||||
|
||||
M.load_theme = function()
|
||||
-- set bg option
|
||||
local theme_type = M.get_theme_tb(vim.g.nvchad_theme, "type") -- dark/light
|
||||
vim.opt.bg = theme_type
|
||||
|
||||
-- clear highlights of bufferline (cuz of dynamic devicons hl group on the buffer)
|
||||
local highlights_raw = vim.split(vim.api.nvim_exec("filter BufferLine hi", true), "\n")
|
||||
-- credits to https://github.com/max397574 for this function
|
||||
M.clear_highlights = function(hl_group)
|
||||
local highlights_raw = vim.split(vim.api.nvim_exec("filter " .. hl_group .. " hi", true), "\n")
|
||||
local highlight_groups = {}
|
||||
|
||||
for _, raw_hi in ipairs(highlights_raw) do
|
||||
table.insert(highlight_groups, string.match(raw_hi, "BufferLine%a+"))
|
||||
table.insert(highlight_groups, string.match(raw_hi, hl_group .. "%a+"))
|
||||
end
|
||||
|
||||
for _, highlight in ipairs(highlight_groups) do
|
||||
vim.cmd([[hi clear ]] .. highlight)
|
||||
end
|
||||
-- above highlights clear code by https://github.com/max397574
|
||||
end
|
||||
|
||||
M.load_theme = function()
|
||||
-- set bg option
|
||||
local theme_type = M.get_theme_tb(vim.g.nvchad_theme, "type") -- dark/light
|
||||
vim.opt.bg = theme_type
|
||||
|
||||
M.clear_highlights "BufferLine"
|
||||
M.clear_highlights "TS"
|
||||
|
||||
-- reload highlights for theme switcher
|
||||
require("plenary.reload").reload_module "integrations"
|
||||
require("plenary.reload").reload_module "chadlights"
|
||||
require("plenary.reload").reload_module "custom"
|
||||
|
||||
require "chadlights"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue