fix(compiler): after_loading hook

dev
nullchilly 2 years ago
parent a05ca14360
commit 19c7ec4787

@ -492,14 +492,14 @@ vim.api.nvim_create_autocmd("OptionSet", {
}) })
``` ```
For people who are hybrid between light and dark mode!
#### Abnormal colors? #### Abnormal colors?
You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_console#True_color_support) You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_console#True_color_support)
Related: [:h termguicolors](https://neovim.io/doc/user/options.html#'termguicolors'), [catppuccin/nvim#182](https://github.com/catppuccin/nvim/issues/182), Related: [:h termguicolors](https://neovim.io/doc/user/options.html#'termguicolors'), [catppuccin/nvim#182](https://github.com/catppuccin/nvim/issues/182),
For people who are hybrid between light and dark mode!
## 💝 Thanks to ## 💝 Thanks to
- [Pocco81](https://github.com/Pocco81) - [Pocco81](https://github.com/Pocco81)

@ -27,7 +27,7 @@ function M.load()
catppuccin.before_loading() catppuccin.before_loading()
end end
local loaded = nil local compiled = nil
local config = require("catppuccin.config").options local config = require("catppuccin.config").options
if config.compile.enabled == true then if config.compile.enabled == true then
@ -40,19 +40,19 @@ function M.load()
if f ~= nil then if f ~= nil then
io.close(f) io.close(f)
vim.cmd("luafile " .. compiled_path) vim.cmd("luafile " .. compiled_path)
loaded = true compiled = true
end end
end end
if not loaded then -- colorscheme gets evaluated from mapper.lua if not compiled then -- colorscheme gets evaluated from mapper.lua
require("catppuccin.lib.highlighter").load(require("catppuccin.lib.mapper").apply()) require("catppuccin.lib.highlighter").load(require("catppuccin.lib.mapper").apply())
end
if catppuccin.after_loading ~= nil then if catppuccin.after_loading ~= nil then
catppuccin.after_loading() catppuccin.after_loading()
end
end end
vim.api.nvim_exec_autocmds("User", { pattern = "CatppuccinLoaded" }) vim.api.nvim_exec_autocmds("User", { pattern = "Catppuccincompiled" })
end end
function M.setup(custom_opts) function M.setup(custom_opts)

@ -49,19 +49,11 @@ vim.g.colors_name = "catppuccin"]],
table.insert(lines, fmt([[vim.api.nvim_set_hl(0, "%s", { link = "%s" })]], group, color.link)) table.insert(lines, fmt([[vim.api.nvim_set_hl(0, "%s", { link = "%s" })]], group, color.link))
else else
if color.style then if color.style then
if color.style ~= "NONE" then for _, style in ipairs(color.style) do
if type(color.style) == "table" then color[style] = true
for _, style in ipairs(color.style) do
color[style] = true
end
else
color[color.style] = true
end
end end
end end
color.style = nil color.style = nil
vim.api.nvim_set_hl(0, group, color)
table.insert(lines, fmt([[vim.api.nvim_set_hl(0, "%s", %s)]], group, inspect(color))) table.insert(lines, fmt([[vim.api.nvim_set_hl(0, "%s", %s)]], group, inspect(color)))
end end
end end

@ -12,7 +12,6 @@ function M.highlight(group, color)
color[style] = true color[style] = true
end end
end end
color.style = nil color.style = nil
vim.api.nvim_set_hl(0, group, color) vim.api.nvim_set_hl(0, group, color)
end end

Loading…
Cancel
Save