highligthing: Enable cacheing only when config is set.

This enables the highlighting caching only when the variable
g:airline_highlighting_cache is set to 1

Should make airline faster and more performant, because we can save a
lot of expensive C core calls. However, when redefining highlighting
groups, it might not correctly reset the cache.
This commit is contained in:
Christian Brabandt
2017-08-14 08:06:53 +02:00
parent 6ee75bdbde
commit a8c4424244
3 changed files with 6 additions and 1 deletions

View File

@@ -53,7 +53,7 @@ function! airline#highlighter#reset_hlcache()
endfunction
function! airline#highlighter#get_highlight(group, ...)
if has_key(s:hl_groups, a:group)
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
return s:hl_groups[a:group]
else
let fg = s:get_syn(a:group, 'fg')