From bfd160a08b9443fe12d8736bbb6b0d051b9356fe Mon Sep 17 00:00:00 2001 From: Matt Seabold Date: Thu, 4 Sep 2014 15:38:12 -0400 Subject: [PATCH 1/2] Tabline: Highlight unselected modified buffer Use the modified airline_c color on unselected modified buffers in order to highlight them as modified while unselected. --- autoload/airline/extensions/tabline.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index 53dd825..0818ba5 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -71,12 +71,14 @@ function! airline#extensions#tabline#load_theme(palette) let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) + let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c) let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) call airline#highlighter#exec('airline_tab', l:tab) call airline#highlighter#exec('airline_tabsel', l:tabsel) call airline#highlighter#exec('airline_tabtype', l:tabtype) call airline#highlighter#exec('airline_tabfill', l:tabfill) call airline#highlighter#exec('airline_tabmod', l:tabmod) + call airline#highlighter#exec('airline_tabmod_unsel', l:tabmodu) call airline#highlighter#exec('airline_tabhid', l:tabhid) endfunction @@ -216,7 +218,9 @@ function! s:get_buffers() endif let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 else - if index(tab_bufs, nr) > -1 + if g:airline_detect_modified && getbufvar(nr, '&modified') + let group = 'airline_tabmod_unsel' + elseif index(tab_bufs, nr) > -1 let group = 'airline_tab' else let group = 'airline_tabhid' From a5e5d8ab4f24770bbc7fa35d626c5cfa39701985 Mon Sep 17 00:00:00 2001 From: Matt Seabold Date: Mon, 8 Sep 2014 09:43:15 -0400 Subject: [PATCH 2/2] Tabline protect against missing palletes If normal_modified or normal_modified.airline_c aren't present, fallback to the default normal.airline_c. --- autoload/airline/extensions/tabline.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index 0818ba5..00b6c96 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -71,7 +71,13 @@ function! airline#extensions#tabline#load_theme(palette) let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) - let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c) + if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') + let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c) + else + "Fall back to normal airline_c if modified airline_c isn't present + let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c) + endif + let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) call airline#highlighter#exec('airline_tab', l:tab) call airline#highlighter#exec('airline_tabsel', l:tabsel)