mirror of
https://github.com/BourgeoisBear/clrzr.git
synced 2026-09-10 07:16:27 -04:00
Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75cb2dad19 | ||
|
|
0ab91fef88 | ||
|
|
0a3ead4490 | ||
|
|
bb61373c80 | ||
|
|
a978dcfa6e |
|
|
@ -24,6 +24,9 @@ BEGIN {
|
|||
{
|
||||
szLine = tolower($1)
|
||||
|
||||
# --characters-as-bytes / -b ?
|
||||
# --posix
|
||||
|
||||
# PREFIX: buf_no \t line_no \t lines_total \t
|
||||
|
||||
# BUF#
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue