diff --git a/autoload/airline.vim b/autoload/airline.vim index 45d66888..81d02c0b 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -105,7 +105,11 @@ function! s:get_statusline(winnr, active) let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep let sl.=l:mode_color let sl.=s:get_section(a:winnr, 'z') - let sl.='%(%#warningmsg#'.s:getwinvar(a:winnr, 'airline_section_warning', '').'%)' + + if a:active + let warngroup = airline#themes#exec_highlight_separator('Al2', 'warningmsg') + let sl.='%(%#'.warngroup.'#'.g:airline_right_sep.'%#warningmsg#'.s:getwinvar(a:winnr, 'airline_section_warning', '').'%)' + endif endif return sl endfunction diff --git a/autoload/airline/themes.vim b/autoload/airline/themes.vim index c7a571ae..31d42444 100644 --- a/autoload/airline/themes.vim +++ b/autoload/airline/themes.vim @@ -44,3 +44,14 @@ function! airline#themes#get_highlight2(fg, bg, ...) let bg = s:get_syn(a:bg[0], a:bg[1]) return s:get_array(fg, bg, a:000) endfunction + +function! airline#themes#exec_highlight_separator(from, to) + let l:from = airline#themes#get_highlight(a:from) + let l:to = airline#themes#get_highlight(a:to) + let group = a:from.'_to_'.a:to + exec printf('highlight %s guifg=%s guibg=%s ctermfg=%s ctermbg=%s', + \ group, + \ l:to[1], l:from[1], + \ l:to[3], l:from[3]) + return group +endfunction