Bug: Does not work with autocmd
plugin installed, and using this to automatically activate it in css files.
with this config, the plugin does not work at all. :ColorizerAttachToBuffer also has no effect.
vim.opt.termguicolors = true
require("colorizer").setup {}
vim.api.nvim_create_autocmd("FileType", {
pattern = {"css"},
callback = function ()
require("colorizer").attach_to_buffer(0, {
mode = "background",
css = true,
})
end
})
leaving out the autocmd:
vim.opt.termguicolors = true
require("colorizer").setup {}
the plugin works, but of course this requires me to manually activate it in every css file with attach_to_buffer
I dunno, maybe I am missing something, but I went through the docs twice and cannot find what I might be missing here.
Operating System:
macOS 12.5.1 (M1)
neovim 0.8.0 (homebrew install)
colorizer: 36c610a9717cc9ec426a07c8e6bf3b3abcb139d6
i think this commit is the reason.
Hmm the current HEAD (9dd7ecde55b06b5114e1fa67c522433e7e59db8b) is working fine for me.
Here's my setup script. These are in my init.lua
colorizer.setup()
vim.api.nvim_create_autocmd("FileType", {
pattern = {"javascript"},
callback = function ()
require("colorizer").attach_to_buffer(0, {
mode = "background",
css = true,
})
end
})
But I'm facing with other problem. I was trying to make lsp doc window highlighted, so I tried the similar things. The only difference is that filetype is cmp_docs (from nvim-cmp plugin).
Here's the mentioned issue https://github.com/NvChad/nvim-colorizer.lua/issues/28. I'm not sure if it's intentional to not highlight colors in floating buffer window, but the original repo does that, so it's probably be a bug.
Does this issue still exist ?
I think I'm having the same problem (I initialize colorizer slightly differently, but my configuration stopped working because of the same commit). I just cloned it and checked the changes one-by-one. The issue is being caused by this line, I think because running COLORIZER_SETUP_HOOK there does something to the way the plugin can be later initialized in autocmds. Removing it causes my setup to work again.
Pull and check again.