Either in init.vim:
lua require 'colorizer'.setup()
lua << EOF
require 'colorizer'.setup {
'*'; -- Highlight all files, but customize some others.
css = { rgb_fn = true; }; -- Enable parsing rgb(...) functions in css.
html = { names = false; } -- Disable parsing "names" like Blue or Gray
}
EOF
Or in a separate lua file:
" init.vim
lua require 'foo'
-- ~/.config/nvim/lua/foo.lua
require 'colorizer'.setup {
'*'; -- Highlight all files, but customize some others.
css = { rgb_fn = true; }; -- Enable parsing rgb(...) functions in css.
html = { names = false; } -- Disable parsing "names" like Blue or Gray
}
Since the plugin currently requires set termguicolors
, you could do this, if you usually do not use that option:
function! s:colorizer_setup() abort
lua << EOF
require 'colorizer'.setup {
'*'; -- Highlight all files, but customize some others.
css = { rgb_fn = true; }; -- Enable parsing rgb(...) functions in css.
html = { names = false; } -- Disable parsing "names" like Blue or Gray
}
EOF
endfunction
if has('nvim')
if &termguicolors
call s:colorizer_setup()
else
autocmd OptionSet termguicolors ++once
\ if v:option_new == 1 |
\ call s:colorizer_setup() |
\ execute 'ColorizerAttachToBuffer' |
\ endif
endif
endif