airline#highlighter#exec: do not build cmd always

This commit is contained in:
Daniel Hahler 2016-06-06 20:41:33 +02:00
parent 429cfcd71e
commit f51f73773d
1 changed files with 5 additions and 5 deletions

View File

@ -61,16 +61,16 @@ function! airline#highlighter#exec(group, colors)
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, '')) let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, '')) let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
endif endif
let cmd= printf('hi %s %s %s %s %s %s %s %s',
\ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''),
\ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),
\ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''),
\ s:Get(colors, 4, 'term=', ''))
let old_hi = airline#highlighter#get_highlight(a:group) let old_hi = airline#highlighter#get_highlight(a:group)
if len(colors) == 4 if len(colors) == 4
call add(colors, '') call add(colors, '')
endif endif
if old_hi != colors if old_hi != colors
let cmd = printf('hi %s %s %s %s %s %s %s %s',
\ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''),
\ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),
\ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''),
\ s:Get(colors, 4, 'term=', ''))
exe cmd exe cmd
endif endif
endfunction endfunction