mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-02-19 04:53:06 +08:00
highlight: skip processing the same hi group twice
Shouldn't happen, but just in case skip creating highlighting group, if the same group with the same attributes has already been defined.
This commit is contained in:
parent
583ae3d5f9
commit
feee9bcf3c
|
@ -47,7 +47,9 @@ function! airline#load_theme()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call airline#highlighter#load_theme()
|
call airline#highlighter#load_theme()
|
||||||
|
let g:airline_theme_dict = {}
|
||||||
call airline#extensions#load_theme()
|
call airline#extensions#load_theme()
|
||||||
|
unlet g:airline_theme_dict
|
||||||
call airline#update_statusline()
|
call airline#update_statusline()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -102,6 +104,7 @@ function! airline#update_statusline()
|
||||||
if airline#util#getwinvar(winnr(), 'airline_disabled', 0)
|
if airline#util#getwinvar(winnr(), 'airline_disabled', 0)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
let g:airline_theme_dict={}
|
||||||
for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||||
if airline#util#getwinvar(nr, 'airline_disabled', 0)
|
if airline#util#getwinvar(nr, 'airline_disabled', 0)
|
||||||
continue
|
continue
|
||||||
|
@ -117,6 +120,7 @@ function! airline#update_statusline()
|
||||||
let w:airline_active = 1
|
let w:airline_active = 1
|
||||||
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
|
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
|
||||||
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
||||||
|
unlet g:airline_theme_dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:contexts = {}
|
let s:contexts = {}
|
||||||
|
@ -198,9 +202,11 @@ function! airline#check_mode(winnr)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
if get(w:, 'airline_lastmode', '') != mode_string
|
if get(w:, 'airline_lastmode', '') != mode_string
|
||||||
|
let g:airline_theme_dict = {}
|
||||||
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
||||||
call airline#highlighter#highlight(l:mode, context.bufnr)
|
call airline#highlighter#highlight(l:mode, context.bufnr)
|
||||||
let w:airline_lastmode = mode_string
|
let w:airline_lastmode = mode_string
|
||||||
|
unlet g:airline_theme_dict
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
|
@ -118,13 +118,18 @@ function! airline#extensions#tabline#get()
|
||||||
if !exists('#airline#BufAdd#*')
|
if !exists('#airline#BufAdd#*')
|
||||||
autocmd airline BufAdd * call <sid>update_tabline()
|
autocmd airline BufAdd * call <sid>update_tabline()
|
||||||
endif
|
endif
|
||||||
if s:ctrlspace
|
try
|
||||||
return airline#extensions#tabline#ctrlspace#get()
|
let g:airline_theme_dict = {}
|
||||||
elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs
|
if s:ctrlspace
|
||||||
return airline#extensions#tabline#buffers#get()
|
return airline#extensions#tabline#ctrlspace#get()
|
||||||
else
|
elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs
|
||||||
return airline#extensions#tabline#tabs#get()
|
return airline#extensions#tabline#buffers#get()
|
||||||
endif
|
else
|
||||||
|
return airline#extensions#tabline#tabs#get()
|
||||||
|
endif
|
||||||
|
finally
|
||||||
|
unlet g:airline_theme_dict
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tabline#title(n)
|
function! airline#extensions#tabline#title(n)
|
||||||
|
|
|
@ -84,6 +84,10 @@ function! airline#highlighter#exec(group, colors)
|
||||||
if len(colors) == 4
|
if len(colors) == 4
|
||||||
call add(colors, '')
|
call add(colors, '')
|
||||||
endif
|
endif
|
||||||
|
if has_key(g:airline_theme_dict, 'a:group') &&
|
||||||
|
\ get(g:airline_theme_dict[a:group]) == a:colors
|
||||||
|
return
|
||||||
|
endif
|
||||||
if g:airline_gui_mode ==# 'gui'
|
if g:airline_gui_mode ==# 'gui'
|
||||||
let new_hi = [colors[0], colors[1], '', '', colors[4]]
|
let new_hi = [colors[0], colors[1], '', '', colors[4]]
|
||||||
else
|
else
|
||||||
|
@ -98,6 +102,7 @@ function! airline#highlighter#exec(group, colors)
|
||||||
\ s:Get(colors, 4, 'term=', ''))
|
\ s:Get(colors, 4, 'term=', ''))
|
||||||
exe cmd
|
exe cmd
|
||||||
endif
|
endif
|
||||||
|
let g:airline_theme_dict[a:group] = a:colors
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:CheckDefined(colors)
|
function! s:CheckDefined(colors)
|
||||||
|
@ -160,6 +165,7 @@ function! airline#highlighter#load_theme()
|
||||||
if pumvisible()
|
if pumvisible()
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
let g:airline_theme_dict = {}
|
||||||
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||||
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||||
endfor
|
endfor
|
||||||
|
@ -169,6 +175,7 @@ function! airline#highlighter#load_theme()
|
||||||
else
|
else
|
||||||
call airline#highlighter#highlight(['normal'])
|
call airline#highlighter#highlight(['normal'])
|
||||||
endif
|
endif
|
||||||
|
unlet g:airline_theme_dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#highlighter#add_separator(from, to, inverse)
|
function! airline#highlighter#add_separator(from, to, inverse)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user