vim: initialize colorizer only if termguicolors is set

This additional check is needed because when nvim is started as `nvim -u
NORC`, my configuration that sets `termguicolors` is not called but
colorizer IS installed and requires `termguicolors` to be set. If it is
not set, the setup() function prints an error.
This commit is contained in:
Fernando Schauenburg 2022-12-13 12:54:26 +01:00
parent b824717c68
commit 3e61fb902a

View file

@ -1,5 +1,5 @@
local ok, colorizer = pcall(require, 'colorizer') local ok, colorizer = pcall(require, 'colorizer')
if ok and colorizer then if ok and colorizer and vim.opt.termguicolors:get() then
colorizer.setup({'*'}, { mode = 'foreground' }) colorizer.setup({'*'}, { mode = 'foreground' })
end end