bourgeoisbear.clrzr/plugin/clrzr.vim
Jason Stewart 372a915469 using textprop instead of matches
- updated color parsers to all return RGBA lists
- split alpha-disabled match pruning out into s:UnHlAlpha()
- g:clrzr_maxlines guarding
- single awk job, instead of per-window
- updated awk script to reflect buffer# back to vim
- have plugin check for textprop, termguicolors, ##TextChanged.  echoerr
if missing.
- removed most ...Window() functions & window-specific properties
2022-01-02 13:03:39 -05:00

52 lines
1.4 KiB
VimL

" clrzr.vim Colorize all text in the form #rrggbb or #rgb; entrance
" Licence: Vim license. See ':help license'
" Maintainer: Jason Stewart <support@eggplantsd.com>
" Derived From: https://github.com/lilydjwg/colorizer
" lilydjwg <lilydjwg@gmail.com>
" Derived From: css_color.vim
" http://www.vim.org/scripts/script.php?script_id=2150
" Thanks To: Niklas Hofer (Author of css_color.vim), Ingo Karkat, rykka,
" KrzysztofUrban, blueyed, shanesmith, UncleBill
" Usage:
"
" Reload guard and 'compatible' handling
if exists("loaded_clrzr") | finish | endif
if !has('textprop')
echoerr 'clrzr disabled: +textprop Vim feature not found'
finish
endif
if !(has('termguicolors') && &termguicolors)
echoerr 'clrzr disabled: termguicolors not enabled and/or available'
finish
endif
if !exists('##TextChanged')
echoerr 'clrzr disabled: TextChanged autocmd not found'
finish
endif
let loaded_clrzr = 1
let s:save_cpo = &cpo
set cpo&vim
command! ClrzrOn call clrzr#Enable()
command! ClrzrOff call clrzr#Disable()
command! ClrzrAposTog call clrzr#AlphaPosToggle()
command! ClrzrRefresh call clrzr#Refresh()
nnoremap <leader>C :ClrzrOn<CR>
nnoremap <leader>V :ClrzrOff<CR>
nnoremap <leader>R :ClrzrRefresh<CR>
if !exists('g:clrzr_startup') || g:clrzr_startup
call clrzr#Enable()
endif
" Cleanup and modelines {{{1
let &cpo = s:save_cpo
" vim:ft=vim:fdm=marker:fmr={{{,}}}:ts=8:sw=2:sts=2: