Proper lazy load fix for colorizer
This commit is contained in:
parent
82f6744c2f
commit
e61c059de6
|
@ -5,6 +5,7 @@ return {
|
||||||
"NvChad/nvim-colorizer.lua",
|
"NvChad/nvim-colorizer.lua",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {
|
opts = {
|
||||||
|
lazy_load = true,
|
||||||
filetypes = {
|
filetypes = {
|
||||||
"*", -- Enable color highlighting for all files
|
"*", -- Enable color highlighting for all files
|
||||||
"!neo-tree", -- Exclude neo-tree
|
"!neo-tree", -- Exclude neo-tree
|
||||||
|
@ -19,16 +20,4 @@ return {
|
||||||
names = false,
|
names = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- Fix lazy loading: https://github.com/NvChad/nvim-colorizer.lua
|
|
||||||
config = function(_, opts)
|
|
||||||
local colorizer = require("colorizer")
|
|
||||||
colorizer.setup(opts)
|
|
||||||
|
|
||||||
-- nvim-colorizer doesn't work on the initial buffer if we lazy load, so force it to attach
|
|
||||||
-- on load.
|
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
|
||||||
if bufnr and not colorizer.is_buffer_attached(bufnr) then
|
|
||||||
colorizer.attach_to_buffer(bufnr)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user