@@ -6,6 +6,28 @@ function! gin#internal#util#debounce(expr, delay) abort
66 let s: debounce_timers [a: expr ] = timer_start (a: delay , { - > execute (a: expr ) })
77endfunction
88
9+ " Inherit highlight attributes from a source group and apply additional attributes
10+ " @param target_group The name of the target highlight group
11+ " @param source_group The name of the source highlight group to inherit from
12+ " @param extra_attrs Dictionary with additional attributes (e.g., {'gui': 'strikethrough', 'cterm': 'strikethrough'})
13+ function ! gin#internal#util#highlight_inherit (target_group, source_group, extra_attrs) abort
14+ let source_hl = execute (' highlight ' . a: source_group )
15+ let guifg = matchstr (source_hl, ' guifg=\zs\S\+' )
16+ let guibg = matchstr (source_hl, ' guibg=\zs\S\+' )
17+ let ctermfg = matchstr (source_hl, ' ctermfg=\zs\S\+' )
18+ let ctermbg = matchstr (source_hl, ' ctermbg=\zs\S\+' )
19+
20+ let hl_cmd = ' highlight ' . a: target_group
21+ if has_key (a: extra_attrs , ' gui' ) | let hl_cmd .= ' gui=' . a: extra_attrs .gui | endif
22+ if has_key (a: extra_attrs , ' cterm' ) | let hl_cmd .= ' cterm=' . a: extra_attrs .cterm | endif
23+ if ! empty (guifg) | let hl_cmd .= ' guifg=' . guifg | endif
24+ if ! empty (guibg) | let hl_cmd .= ' guibg=' . guibg | endif
25+ if ! empty (ctermfg) | let hl_cmd .= ' ctermfg=' . ctermfg | endif
26+ if ! empty (ctermbg) | let hl_cmd .= ' ctermbg=' . ctermbg | endif
27+
28+ execute hl_cmd
29+ endfunction
30+
931function gin#internal#util#input (opts) abort
1032 return s: input (a: opts )
1133endfunction
0 commit comments