From 560092a9ec10fb281dda6a689cadb626cdcf95ee Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Mon, 26 Jun 2017 22:27:01 +0200 Subject: [PATCH] highligher: fix the comparison before redefining hi group The comparison in airline#highlighter#exec() was there to prevent to call out to too many :hi calls by making sure that the newly to be defined highlighting group will be actually different from the current existing one. However, that did not work, as the returned old highlight group did never match the newly to be created one, since it intentionally left the cterm attributes out for the gui and the gui attributes for the terminal. Therefore, fix the comparasion and make it compare the actual values that we have. This should make vim-airline a bit faster (hopefully!) --- autoload/airline/highlighter.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/airline/highlighter.vim b/autoload/airline/highlighter.vim index 8d85e02d..456e8d9e 100644 --- a/autoload/airline/highlighter.vim +++ b/autoload/airline/highlighter.vim @@ -84,8 +84,13 @@ function! airline#highlighter#exec(group, colors) if len(colors) == 4 call add(colors, '') endif + if g:airline_gui_mode ==# 'gui' + let new_hi = [colors[0], colors[1], '', '', colors[4]] + else + let new_hi = ['', '', printf("%s", colors[2]), printf("%s", colors[3]), colors[4]] + endif let colors = s:CheckDefined(colors) - if old_hi != colors || !s:hl_group_exists(a:group) + if old_hi != new_hi || !s:hl_group_exists(a:group) 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=', ''),