highlighter: skip create hi groups for inactive mode if not needed

This will skip creation of highlighting groups, if there are no inactive
windows.
This commit is contained in:
Christian Brabandt 2017-06-26 22:30:48 +02:00
parent 560092a9ec
commit 583ae3d5f9
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 5 additions and 1 deletions

View File

@ -202,6 +202,11 @@ function! airline#highlighter#highlight(modes, ...)
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
for mode in mapped
if mode == 'inactive' && winnr('$') == 1
" there exist no inactive windows, don't need to create all those
" highlighting groups
continue
endif
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
for kvp in items(dict)
@ -239,4 +244,3 @@ function! airline#highlighter#highlight(modes, ...)
endif
endfor
endfunction