norcalli / nvim-colorizer.lua

The fastest Neovim colorizer.
Other
2.23k stars 117 forks source link

:ColorizerAttachToBuffer by default #97

Closed MannyFay closed 1 year ago

MannyFay commented 1 year ago

How can I enable the colorizer by default if I open Neovim and attach it automatically to every buffer I open?

I've tried different auto commands in my nvim-colorizer.lua but without any results. The Colorizer is working if I attach it manually in command line.

gongfarmer commented 1 year ago

It sounds like the setup() function is not running at all, or maybe not early enough.

I started hitting this same bug after switching my neovim config from Packer to Lazy.

For me it was solved by changing this line in lua/plugins/init.lua:

'norcalli/nvim-colorizer.lua'

to this:

{
    'norcalli/nvim-colorizer.lua',
    config = function()
      require("colorizer").setup()
    end,
  },

I thought that Lazy would run setup() automatically, but apparently it did not.

piersolenski commented 1 year ago

Would be great if it could support config = true with Lazy!

MannyFay commented 1 year ago

Thanks @gongfarmer! This works for me with Packer.

hellmind commented 3 months ago

I still need a way to activate it at startup using Lazy

Felipe-9 commented 1 week ago

Just add the event "BufRead"