Get rid of g:airline_gui_mode

This is needed for Neovim, because an external UI could be attached to
the same neovim server, so it does not make sense to define highlighting
groups with either only the cterm or the guifg attribute set.

So refactor the code slightly got get rid of this variable (and since
this variable is not needed anymore, we can also get rid of the guienter
and OptionSet autocommand).

fixes: #2261
This commit is contained in:
Christian Brabandt
2020-10-26 21:16:31 +01:00
parent 38c9f9ca3d
commit c8c0e7d9ff
6 changed files with 73 additions and 63 deletions

View File

@@ -99,7 +99,6 @@ function! s:on_colorscheme_changed()
call s:init()
unlet! g:airline#highlighter#normal_fg_hi
call airline#highlighter#reset_hlcache()
let g:airline_gui_mode = airline#init#gui_mode()
if !s:theme_in_vimrc
call airline#switch_matching_theme()
endif
@@ -139,11 +138,7 @@ function! s:airline_toggle()
\ | call <sid>on_window_changed('CmdwinEnter')
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed()
if exists("##OptionSet")
" Make sure that g_airline_gui_mode is refreshed
autocmd OptionSet termguicolors call <sid>on_colorscheme_changed()
endif
autocmd ColorScheme * call <sid>on_colorscheme_changed()
" Set all statuslines to inactive
autocmd FocusLost * call airline#update_statusline_focuslost()
" Refresh airline for :syntax off