mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 15:49:14 +08:00
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:
parent
6ee75bdbde
commit
a8c4424244
|
@ -53,7 +53,7 @@ function! airline#highlighter#reset_hlcache()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#highlighter#get_highlight(group, ...)
|
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]
|
return s:hl_groups[a:group]
|
||||||
else
|
else
|
||||||
let fg = s:get_syn(a:group, 'fg')
|
let fg = s:get_syn(a:group, 'fg')
|
||||||
|
|
|
@ -211,6 +211,10 @@ values):
|
||||||
the same name (in the correct window): >
|
the same name (in the correct window): >
|
||||||
let w:airline_skip_empty_sections = 0
|
let w:airline_skip_empty_sections = 0
|
||||||
<
|
<
|
||||||
|
* Caches the changes to the highlighting groups, should therefore be faster.
|
||||||
|
Set this to one, if you experience a sluggish Vim: >
|
||||||
|
let g:airline_highlighting_cache = 0
|
||||||
|
<
|
||||||
==============================================================================
|
==============================================================================
|
||||||
COMMANDS *airline-commands*
|
COMMANDS *airline-commands*
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ function! s:airline_refresh()
|
||||||
let nomodeline = '<nomodeline>'
|
let nomodeline = '<nomodeline>'
|
||||||
endif
|
endif
|
||||||
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
|
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
|
||||||
|
call airline#highlighter#reset_hlcache()
|
||||||
call airline#load_theme()
|
call airline#load_theme()
|
||||||
call airline#update_statusline()
|
call airline#update_statusline()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
Loading…
Reference in New Issue
Block a user