@@ -124,6 +124,10 @@ else
124124 endfunction
125125endif
126126
127+ function ! s: recreate_highlights ()
128+ call filter ( copy ( b: css_color_hi ), ' s:create_highlight( v:key, v:val )' )
129+ endfunction
130+
127131let s: pattern_color = {}
128132let s: color_bright = {}
129133function ! s: create_syn_match ()
@@ -223,7 +227,7 @@ endfunction
223227" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
224228
225229function ! 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 ()
228232endfunction
229233
@@ -278,3 +282,12 @@ function! css_color#init(type, keywords, groups)
278282 call extend ( s: color_bright , b: css_color_hi )
279283 endif
280284endfunction
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