Compare commits

..

5 commits

Author SHA1 Message Date
Jason Stewart 75cb2dad19 'echo' => 'echomsg' on plugin init 2026-07-10 17:10:07 -04:00
Jason Stewart 0ab91fef88 special handling for mawk/gawk/goawk 2025-10-31 21:23:10 -04:00
Jason Stewart 0a3ead4490
Update README.md (mawk does not work) 2025-10-31 20:34:28 -04:00
Jason Stewart bb61373c80 Less obnoxious warning style when necessary Vim features are missing. 2024-12-23 23:12:34 -05:00
Jason Stewart a978dcfa6e - only require 'termguicolors' outside of gvim 2022-01-10 21:13:13 -05:00
3 changed files with 36 additions and 18 deletions

View file

@ -24,6 +24,9 @@ BEGIN {
{
szLine = tolower($1)
# --characters-as-bytes / -b ?
# --posix
# PREFIX: buf_no \t line_no \t lines_total \t
# BUF#

View file

@ -21,6 +21,7 @@ set cpo&vim
" - change colors, or enable/disable, with two views into same buffer to reproduce E966
" TODO: allowed filetypes list?
" TODO: sign_column (bigger pls, :h sign-commands)?
" TODO: color change operation
" --------------------------- CONSTANTS ---------------------------
@ -298,12 +299,19 @@ endfunction
function! s:RemoveProps(n_buf, l_first, l_last)
" ENSURE THAT BUFFER STILL EXISTS
let l_info = getbufinfo(a:n_buf)
if empty(l_info) | return 0 | endif
" REMOVE TEXTPROPS FROM LINES l_first TO l_last
let firstlast = sort([a:l_first, a:l_last], 'f')
return prop_remove({
\ 'bufnr': a:n_buf,
\ 'id': 777,
\ 'all': 1,
\ }, firstlast[0], firstlast[1])
endfunction
" BUILDS TEXTPROPS (COLORS+PATTERNS) FOR THE CURRENT BUFFER
@ -574,9 +582,17 @@ function! clrzr#Enable()
let job_opts['noblock'] = 1
endif
let s:awk_job = job_start(
\ ['awk', '-f', s:CLRZR_AWK_SCRIPT_PATH],
\ job_opts)
let l:awk_cmd = ['awk']
if executable('gawk')
let l:awk_cmd = ['gawk', '--posix']
elseif executable('mawk')
let l:awk_cmd = ['mawk', '--posix', '-W', 'interactive']
elseif executable('goawk')
let l:awk_cmd = ['goawk']
endif
call extend(l:awk_cmd, ['-f', s:CLRZR_AWK_SCRIPT_PATH])
let s:awk_job = job_start(l:awk_cmd, job_opts)
" NOTE: string(chan) == 'channel fail' is error
let s:awk_chan = job_getchannel(s:awk_job)

View file

@ -1,30 +1,29 @@
" 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:
" 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: http://www.vim.org/scripts/script.php?script_id=2150 (css_color.vim)
" Thanks To: Niklas Hofer (Author of css_color.vim), Ingo Karkat, rykka,
" KrzysztofUrban, blueyed, shanesmith, UncleBill
"
" Reload guard and 'compatible' handling
if exists("loaded_clrzr") | finish | endif
if !has('textprop')
echoerr 'clrzr disabled: +textprop Vim feature not found'
autocmd VimEnter * echomsg 'clrzr disabled: +textprop Vim feature not found'
finish
endif
if !(has('termguicolors') && &termguicolors)
echoerr 'clrzr disabled: termguicolors not enabled and/or available'
finish
if !has('gui_running')
if !(has('termguicolors') && &termguicolors)
autocmd VimEnter * echomsg 'clrzr disabled: termguicolors not enabled and/or available'
finish
endif
endif
if !exists('##TextChanged')
echoerr 'clrzr disabled: TextChanged autocmd not found'
autocmd VimEnter * echomsg 'clrzr disabled: TextChanged autocmd not found'
finish
endif