Something went wrong. Try again.
cthru your editor
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647assert(vim.fn.has("nvim-0.10.0") == 1, "cthru: minimum neovim version 0.10.0 required!")
local g = vim.glocal api = vim.api
g._cthru = falseg.cthru_groups = require("cthru.default_groups")g.cthru_defer_count = 10
local color_changed = falselocal default_color = nillocal prev_color = nillocal cthru = require("cthru")
local augroup = api.nvim_create_augroup("_cthru", { clear = true })
api.nvim_create_autocmd("ColorSchemePre", { desc = "Clear custom highlight groups before setting a colorscheme", group = augroup, callback = function(opts) local curr_color = opts.match color_changed = prev_color ~= curr_color if not prev_color or color_changed then prev_color = curr_color end if color_changed then vim.cmd.highlight("clear") end end,})
api.nvim_create_autocmd("ColorScheme", { desc = "Maintain cthru state on changing colorschemes", group = augroup, callback = function(opts) -- Set the firstly loaded color as default color if not default_color then default_color = g.colors_name end
local ui_loaded = vim.v.vim_did_enter > 0 if ui_loaded and color_changed then cthru.reset_hl_map() end if ui_loaded and g._cthru then if opts.match == default_color then -- stylua: ignore vim.defer_fn(function() cthru.hook_cthru(false) end, g.cthru_defer_count) else cthru.hook_cthru(false) end end end,})