before trying to return hi attributes, check the group exists
This prevents trying to access twice the highlighting groups and should slightly speed up airline.
This commit is contained in:
parent
b66c1ef070
commit
583121bbc9
@ -22,12 +22,17 @@ function! s:get_syn(group, what)
|
|||||||
if !exists("g:airline_gui_mode")
|
if !exists("g:airline_gui_mode")
|
||||||
let g:airline_gui_mode = airline#init#gui_mode()
|
let g:airline_gui_mode = airline#init#gui_mode()
|
||||||
endif
|
endif
|
||||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode)
|
let color = ''
|
||||||
if empty(color) || color == -1
|
if hlexists(a:group)
|
||||||
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode)
|
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode)
|
||||||
endif
|
endif
|
||||||
if empty(color) || color == -1
|
if empty(color) || color == -1
|
||||||
let color = 'NONE'
|
" should always exists
|
||||||
|
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode)
|
||||||
|
" however, just in case
|
||||||
|
if empty(color) || color == -1
|
||||||
|
let color = 'NONE'
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
return color
|
return color
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user