2023-01-23 05:48:37 +01:00
|
|
|
local config = require("gruber-darker.config")
|
2023-01-10 21:11:37 +01:00
|
|
|
|
2023-01-04 03:29:50 +01:00
|
|
|
local M = {}
|
|
|
|
|
2023-01-10 21:11:37 +01:00
|
|
|
---Delete GruberDarker autocmds when the
|
|
|
|
---theme changes to something else
|
2023-01-21 18:11:55 +01:00
|
|
|
---@package
|
2023-01-23 05:48:37 +01:00
|
|
|
function M.on_colorscheme()
|
2023-03-14 03:09:44 +01:00
|
|
|
vim.cmd([[autocmd! GruberDarker]])
|
|
|
|
vim.cmd([[augroup! GruberDarker]])
|
2023-01-10 21:11:37 +01:00
|
|
|
end
|
|
|
|
|
2023-03-26 03:58:47 +02:00
|
|
|
local function create_autocmds()
|
|
|
|
local gruber_darker_group = vim.api.nvim_create_augroup("GruberDarker", { clear = true })
|
|
|
|
vim.api.nvim_create_autocmd("ColorSchemePre", {
|
|
|
|
group = gruber_darker_group,
|
|
|
|
pattern = "*",
|
|
|
|
callback = function()
|
|
|
|
require("gruber-darker").on_colorscheme()
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
2023-03-26 16:04:41 +02:00
|
|
|
group = gruber_darker_group,
|
|
|
|
pattern = "qf,help",
|
|
|
|
callback = function()
|
|
|
|
vim.cmd.setlocal("winhighlight=Normal:NormalSB,SignColumn:SignColumnSB")
|
|
|
|
end,
|
2023-03-26 03:58:47 +02:00
|
|
|
})
|
2023-04-07 16:35:44 +02:00
|
|
|
|
2023-04-10 19:22:47 +02:00
|
|
|
-- This is a mitigation for new Nvim v0.9.0 lsp semantic highlights
|
|
|
|
-- overriding treesitter highlights. Need to link these to relevant
|
|
|
|
-- treesitter groups in the future. See :h lsp-semantic-highlight
|
|
|
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
|
|
|
group = gruber_darker_group,
|
|
|
|
pattern = "*",
|
|
|
|
callback = function()
|
|
|
|
-- Hide all semantic highlights
|
|
|
|
for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
|
|
|
|
vim.api.nvim_set_hl(0, group, {})
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
2023-03-26 03:58:47 +02:00
|
|
|
end
|
|
|
|
|
2023-01-23 05:48:37 +01:00
|
|
|
---Clear current highlights and set Neovim global `colors_name`
|
2023-03-13 12:31:31 +01:00
|
|
|
function M.load()
|
2023-04-20 15:11:42 +02:00
|
|
|
local highlights = require("gruber-darker.highlights")
|
|
|
|
|
2023-03-14 03:09:44 +01:00
|
|
|
if vim.g.colors_name then
|
|
|
|
vim.cmd.hi("clear")
|
|
|
|
end
|
|
|
|
|
|
|
|
vim.opt.termguicolors = true
|
2023-03-29 02:40:28 +02:00
|
|
|
vim.g.colors_name = "gruber-darker"
|
2023-03-14 03:09:44 +01:00
|
|
|
|
2023-03-25 23:43:49 +01:00
|
|
|
highlights.setup()
|
2023-03-14 03:09:44 +01:00
|
|
|
|
2023-03-26 16:04:41 +02:00
|
|
|
create_autocmds()
|
2023-01-21 18:11:55 +01:00
|
|
|
end
|
2023-01-10 21:11:37 +01:00
|
|
|
|
2023-01-23 05:48:37 +01:00
|
|
|
---Change colorscheme to GruberDarker
|
2023-03-14 03:09:44 +01:00
|
|
|
function M.colorscheme() end
|
2023-01-23 05:48:37 +01:00
|
|
|
|
|
|
|
---GruberDarker configuration bootstrapper
|
2023-03-26 06:12:43 +02:00
|
|
|
---@param opts? GruberDarkerOpts
|
2023-01-23 05:48:37 +01:00
|
|
|
function M.setup(opts)
|
2023-03-26 06:12:43 +02:00
|
|
|
config.setup(opts)
|
2023-01-04 03:29:50 +01:00
|
|
|
end
|
|
|
|
|
2023-01-23 05:48:37 +01:00
|
|
|
return M
|