Skip to content

Commit f716f70

Browse files
committed
add #dump_highlights utility function
1 parent 7d91939 commit f716f70

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

autoload/css_color.vim

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ else
124124
endfunction
125125
endif
126126

127+
function! s:recreate_highlights()
128+
call filter( copy( b:css_color_hi ), 's:create_highlight( v:key, v:val )' )
129+
endfunction
130+
127131
let s:pattern_color = {}
128132
let s:color_bright = {}
129133
function! s:create_syn_match()
@@ -223,7 +227,7 @@ endfunction
223227
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
224228

225229
function! css_color#reinit()
226-
call filter( keys( b:css_color_hi ), 's:create_highlight( v:val, s:color_bright[v:val] )' )
230+
call s:recreate_highlights()
227231
call s:flush_exe()
228232
endfunction
229233

@@ -278,3 +282,12 @@ function! css_color#init(type, keywords, groups)
278282
call extend( s:color_bright, b:css_color_hi )
279283
endif
280284
endfunction
285+
286+
" utility function for development use
287+
function! css_color#dump_highlights()
288+
call s:recreate_highlights()
289+
let cmd = join( sort( remove( s:exe, 0, -1 ) ), "\n" )
290+
let cmd = substitute( cmd, '#......', '\U&', 'g' )
291+
let cmd = substitute( cmd, 'ctermbg=\zs\d\+', '\=printf("%-3d",submatch(0))', 'g' )
292+
return cmd
293+
endfunction

0 commit comments

Comments
 (0)