nvim-cokeline icon indicating copy to clipboard operation
nvim-cokeline copied to clipboard

Component hightlight doesn't update after colorscheme change

Open Keitokuch opened this issue 2 years ago • 2 comments

The buffer-tab component hightlights (except for default hl) are not changed after colorscheme highlight change.

Noticable after switching between dark and light schemes image

Keitokuch avatar Jun 23 '22 18:06 Keitokuch

Just to add I get around this by having a ColorScheme autocommand that reloads my cokeline config.

olimorris avatar Jul 11 '22 06:07 olimorris

I had the same issue, but then I noticed that I had created all components outside of the require('cokeline').setup call. Remember to update all the components too in order to update all colors.

anthony-darienzo avatar Aug 08 '22 19:08 anthony-darienzo

I implemented a temporary fix by mapping a key to source the cokeline config file, so every time I change the theme I manually refresh the cokeline colors. Simple workaround for now.

stankovictab avatar Jun 09 '23 03:06 stankovictab

What olimorris mentioned is actually a way better solution, here's how I did it.

local group = vim.api.nvim_create_augroup("CokeLine Fix", { clear = true }) -- A group with clear on true is created so that the autocmd isn't being duplicated on every run in the :autocmd ColorScheme list
vim.api.nvim_create_autocmd("ColorScheme",
	{ command = "source ~/.config/nvim/PUT_YOUR_PATH_TO_COKELINE_CONFIG_HERE.lua", group = group })

Paste this anywhere in the CokeLine config, set the path, and it'll be registered.

stankovictab avatar Jun 26 '23 17:06 stankovictab

Should be fixed, I can't repro anymore and just added the ability to return hlgroup names instead of hex colors to read the color from a predefined hlgroup.

willothy avatar Jul 01 '23 05:07 willothy