highlighter: also check separator groups for being defined

Make sure, to also check, if the separator groups have already been
defined. Once they are defined initially, they are usually available in
the palette group. So do not redefine them once they have been created
initially.

references #1779
This commit is contained in:
Christian Brabandt 2018-11-08 15:31:58 +01:00
parent d57344a3c3
commit 99971aa24d
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 8 additions and 3 deletions

View File

@ -34,6 +34,10 @@ function! s:group_not_done(list, name)
endif
endfu
function! s:separator_name(from, to, suffix)
return a:from.'_to_'.a:to.a:suffix
endfu
function! s:get_syn(group, what)
if !exists("g:airline_gui_mode")
let g:airline_gui_mode = airline#init#gui_mode()
@ -178,7 +182,7 @@ function! s:exec_separator(dict, from, to, inverse, suffix)
if pumvisible()
return
endif
let group = a:from.'_to_'.a:to.a:suffix
let group = s:separator_name(a:from, a:to, a:suffix)
let l:from = airline#themes#get_highlight(a:from.a:suffix)
let l:to = airline#themes#get_highlight(a:to.a:suffix)
if a:inverse
@ -290,9 +294,10 @@ function! airline#highlighter#highlight(modes, ...)
" nothing to be done
continue
endif
" TODO: optimize this
for sep in items(s:separators)
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
if s:group_not_done(airline_grouplist, s:separator_name(sep[1][0], sep[1][1], suffix))
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
endif
endfor
endif
endfor