@@ -446,29 +446,36 @@ func! s:apply_icons() abort
446446 for f in getline (1 , ' $' )
447447 let i += 1
448448 for id in sort (keys (s: cb_map ))
449- let l: icon = s: cb_map [id](f )
450- if type (l: icon ) == v: t_string
451- if -1 != match (l: icon , ' \S' )
449+ let icon = s: cb_map [id](f )
450+ if type (icon ) == type (' ' )
451+ if -1 != match (icon , ' \S' )
452+ unlet icon
452453 break
453454 endif
454455 endif
455456 endfor
456457 if exists (' l:icon' )
457458 if s: virttext_feat == # ' extmark'
458- let l: virt_text = type (l: icon ) == v: t_dict ? [[l: icon .icon , l: icon .hl ]] : [[l: icon , ' DirvishColumnHead' ]]
459+ let l: virt_text = type (icon ) == type ({}) ? [[icon .icon , icon .hl ]] : [[icon , ' DirvishColumnHead' ]]
459460 call nvim_buf_set_extmark (0 , s: ns_id , i - 1 , 0 , #{virt_text: l: virt_text , virt_text_pos: ' inline' })
460461 elseif s: virttext_feat == # ' textprop'
461- if type (l: icon ) == v: t_string
462- call prop_add (i , 1 , #{type : s: prop_type , text: l: icon })
462+ if type (icon ) == type (' ' )
463+ call prop_add (i , 1 , #{type : s: prop_type , text: icon })
464+ else
465+ let l: prop_type = prop_type_get (' dirvish.' .icon .hl , {})
466+ if l: prop_type == {}
467+ call prop_type_add (' dirvish.' .icon .hl , #{highlight : icon .hl })
468+ endif
469+ call prop_add (i , 1 , #{type : ' dirvish.' .icon .hl , text: icon .icon })
463470 endif
464471 else
465472 let isdir = (f [-1 :] == s: sep )
466473 let f = substitute (s: f (f ), escape (s: sep ,' \' ).' $' , ' ' , ' g' ) " Full path, trim slash.
467474 let tail_esc = escape (fnamemodify (f ,' :t' ).(isdir?(s: sep ):' ' ), ' [,*.^$~\' )
468- exe ' syntax match DirvishColumnHead =\%' .i .' l^.\{-}\ze' .tail_esc.' $= conceal cchar=' .l: icon
475+ exe ' syntax match DirvishColumnHead =\%' .i .' l^.\{-}\ze' .tail_esc.' $= conceal cchar=' .icon
469476 endif
477+ unlet icon
470478 endif
471- unlet l: icon
472479 endfor
473480endf
474481
0 commit comments