diff --git a/autoload/airline/builder.vim b/autoload/airline/builder.vim index 4048d726..f69752e7 100644 --- a/autoload/airline/builder.vim +++ b/autoload/airline/builder.vim @@ -23,7 +23,17 @@ function! s:prototype.add_section(group, contents) let self._line .= '%#'.a:group.'#' endif - let self._line .= a:contents + let contents = [] + let content_parts = split(a:contents, 'airline_accent') + for cpart in content_parts + let accent = matchstr(cpart, '_\zs[^#]*\ze') + call airline#highlighter#add_accent(a:group, accent) + call add(contents, cpart) + endfor + let line = join(contents, a:group) + let line = substitute(line, '__restore__', a:group, 'g') + + let self._line .= line let self._curgroup = a:group endfunction diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim old mode 100755 new mode 100644 diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index 205a64c3..c6623ab4 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -17,9 +17,6 @@ let s:builder_context = { let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0) -" TODO: temporary -let s:buf_max = get(g:, 'airline#extensions#tabline#buffer_max', winwidth(0) / 24) - function! airline#extensions#tabline#init(ext) if has('gui_running') set guioptions-=e @@ -103,18 +100,58 @@ function! s:get_buffer_list() endif endfor - " TODO: temporary fix; force the active buffer to be first when there are many buffers open - if len(buffers) > s:buf_max && index(buffers, cur) > -1 - while buffers[1] != cur - let first = remove(buffers, 0) - call add(buffers, first) - endwhile - let buffers = buffers[:s:buf_max] - call insert(buffers, -1, 0) - call add(buffers, -1) + let s:current_buffer_list = buffers + return buffers +endfunction + +function! s:get_visible_buffers() + let buffers = s:get_buffer_list() + let cur = bufnr('%') + + let total_width = 0 + let max_width = 0 + + for nr in buffers + let width = len(airline#extensions#tabline#get_buffer_name(nr)) + 4 + let total_width += width + let max_width = max([max_width, width]) + endfor + + " only show current and surrounding buffers if there are too many buffers + let position = index(buffers, cur) + if total_width > winwidth(0) && position > -1 + let buf_count = len(buffers) + + " determine how many buffers to show based on the longest buffer width, + " use one on the right side and put the rest on the left + let buf_max = winwidth(0) / max_width + let buf_right = 1 + let buf_left = max([0, buf_max - buf_right]) + + let start = max([0, position - buf_left]) + let end = min([buf_count, position + buf_right]) + + " fill up available space on the right + if position < buf_left + let end += (buf_left - position) + endif + + " fill up available space on the left + if end > buf_count - 1 - buf_right + let start -= max([0, buf_right - (buf_count - 1 - position)]) + endif + + let buffers = eval('buffers[' . start . ':' . end . ']') + + if start > 0 + call insert(buffers, -1, 0) + endif + + if end < buf_count - 1 + call add(buffers, -1) + endif endif - let s:current_buffer_list = buffers return buffers endfunction @@ -122,7 +159,7 @@ function! s:get_buffers() let b = airline#builder#new(s:builder_context) let cur = bufnr('%') let tab_bufs = tabpagebuflist(tabpagenr()) - for nr in s:get_buffer_list() + for nr in s:get_visible_buffers() if nr < 0 call b.add_raw('%#airline_tabhid#...') continue diff --git a/autoload/airline/highlighter.vim b/autoload/airline/highlighter.vim index 38e05c4a..b677c2eb 100644 --- a/autoload/airline/highlighter.vim +++ b/autoload/airline/highlighter.vim @@ -94,6 +94,28 @@ function! airline#highlighter#add_separator(from, to, inverse) call exec_separator({}, a:from, a:to, a:inverse, '') endfunction +function! airline#highlighter#add_accent(group, accent) + let p = g:airline#themes#{g:airline_theme}#palette + if exists('p.accents') + if has_key(p.accents, a:accent) + for kvp in items(p) + let mode_colors = kvp[1] + if has_key(mode_colors, a:group) + let colors = copy(mode_colors[a:group]) + if p.accents[a:accent][0] != '' + let colors[0] = p.accents[a:accent][0] + endif + if p.accents[a:accent][2] != '' + let colors[2] = p.accents[a:accent][2] + endif + let colors[4] = get(p.accents[a:accent], 4, '') + let mode_colors[a:group.'_'.a:accent] = colors + endif + endfor + endif + endif +endfunction + function! airline#highlighter#highlight_modified_inactive(bufnr) if getbufvar(a:bufnr, '&modified') let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index a5a59582..07ea2ceb 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -64,9 +64,10 @@ function! airline#init#bootstrap() call airline#parts#define_function('filetype', 'airline#parts#filetype') call airline#parts#define('readonly', { \ 'function': 'airline#parts#readonly', - \ 'highlight': 'airline_file', + \ 'accent': 'red', \ }) call airline#parts#define_raw('file', '%f%m') + call airline#parts#define_raw('linenr', (g:airline_symbols.linenr).' %#airline_accent_bold#%3l%#__restore__#') call airline#parts#define_function('ffenc', 'airline#parts#ffenc') call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'whitespace']) endfunction @@ -79,10 +80,10 @@ function! airline#init#sections() let g:airline_section_b = airline#section#create(['hunks', 'branch']) endif if !exists('g:airline_section_c') - let g:airline_section_c = airline#section#create(['%<', 'file']) + let g:airline_section_c = airline#section#create(['%<', 'file', ' ', 'readonly']) endif if !exists('g:airline_section_gutter') - let g:airline_section_gutter = airline#section#create([' ', 'readonly', '%=']) + let g:airline_section_gutter = airline#section#create(['%=']) endif if !exists('g:airline_section_x') let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype']) @@ -91,7 +92,7 @@ function! airline#init#sections() let g:airline_section_y = airline#section#create_right(['ffenc']) endif if !exists('g:airline_section_z') - let g:airline_section_z = airline#section#create_right(['%3p%% %{g:airline_symbols.linenr} %3l:%3c ']) + let g:airline_section_z = airline#section#create(['%3p%% ', 'linenr', ':%3c ']) endif if !exists('g:airline_section_warning') let g:airline_section_warning = airline#section#create(['syntastic', 'whitespace']) diff --git a/autoload/airline/parts.vim b/autoload/airline/parts.vim index f1b7c00a..e5cbd38e 100644 --- a/autoload/airline/parts.vim +++ b/autoload/airline/parts.vim @@ -30,6 +30,10 @@ function! airline#parts#define_condition(key, predicate) call airline#parts#define(a:key, { 'condition': a:predicate }) endfunction +function! airline#parts#define_accent(key, accent) + call airline#parts#define(a:key, { 'accent': a:accent }) +endfunction + function! airline#parts#define_empty(keys) for key in a:keys call airline#parts#define_raw(key, '') diff --git a/autoload/airline/section.vim b/autoload/airline/section.vim index 516d000d..ef1e0431 100644 --- a/autoload/airline/section.vim +++ b/autoload/airline/section.vim @@ -9,8 +9,8 @@ function! s:create(parts, append) let part = airline#parts#get(a:parts[idx]) let val = '' - if exists('part.highlight') - let val .= '%#'.(part.highlight).'#' + if exists('part.accent') + let val .= '%#airline_accent_'.(part.accent).'#' endif if exists('part.function') @@ -49,6 +49,9 @@ function! s:create(parts, append) endif let val .= partval + if exists('part.accent') + let val .= '%#__restore__#' + endif let _ .= val endfor return _ diff --git a/autoload/airline/themes.vim b/autoload/airline/themes.vim index 94501f8b..c457dde9 100644 --- a/autoload/airline/themes.vim +++ b/autoload/airline/themes.vim @@ -2,26 +2,24 @@ " vim: et ts=2 sts=2 sw=2 " generates a dictionary which defines the colors for each highlight group -function! airline#themes#generate_color_map(section1, section2, section3, ...) +function! airline#themes#generate_color_map(sect1, sect2, sect3, ...) let palette = { - \ 'airline_a': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , get(a:section1 , 4 , 'bold') ] , - \ 'airline_b': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , get(a:section2 , 4 , '' ) ] , - \ 'airline_c': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3 , 4 , '' ) ] , + \ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , 'bold') ] , + \ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '' ) ] , + \ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '' ) ] , \ } - if a:0 > 1 + if a:0 > 0 call extend(palette, { - \ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] , - \ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] , - \ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] , - \ 'airline_file': [ a:4[0] , a:4[1] , a:4[2] , a:4[3] , get(a:4 , 4 , '' ) ] , + \ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] , + \ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] , + \ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] , \ }) else call extend(palette, { - \ 'airline_file': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] , - \ 'airline_x': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3 , 4 , '' ) ] , - \ 'airline_y': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , get(a:section2 , 4 , '' ) ] , - \ 'airline_z': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , get(a:section1 , 4 , '' ) ] , + \ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '' ) ] , + \ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '' ) ] , + \ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '' ) ] , \ }) endif @@ -43,25 +41,27 @@ function! airline#themes#patch(palette) endif endfor - " this is a pretty heavy handed, but it works... - " basically, look for the 'airline_file' group and copy the bg - " colors from 'airline_c' into it. - for mode in keys(a:palette) - let overrides = split(mode, '_') - let mode_colors = a:palette[overrides[0]] - if exists('mode_colors.airline_file') - let file_colors = mode_colors.airline_file - let file_colors[1] = mode_colors.airline_c[1] - let file_colors[3] = mode_colors.airline_c[3] + let a:palette.accents = get(a:palette, 'accents', {}) + let a:palette.accents.bold = [ '', '', '', '', 'bold' ] + let a:palette.accents.italic = [ '', '', '', '', 'italic' ] - if len(overrides) > 1 - let override_colors = a:palette[overrides[0].'_'.overrides[1]] - let override_colors.airline_file = copy(file_colors) - let override_status_colors = get(override_colors, 'airline_c', mode_colors.airline_c) - let override_colors.airline_file[1] = override_status_colors[1] - let override_colors.airline_file[3] = override_status_colors[3] - endif - endif - endfor + if !has_key(a:palette.accents, 'red') + let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ] + endif + if !has_key(a:palette.accents, 'green') + let a:palette.accents.green = [ '#008700' , '' , 22 , '' ] + endif + if !has_key(a:palette.accents, 'blue') + let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ] + endif + if !has_key(a:palette.accents, 'yellow') + let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ] + endif + if !has_key(a:palette.accents, 'orange') + let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ] + endif + if !has_key(a:palette.accents, 'purple') + let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ] + endif endfunction diff --git a/autoload/airline/themes/badwolf.vim b/autoload/airline/themes/badwolf.vim index c57d6931..41a25d1f 100644 --- a/autoload/airline/themes/badwolf.vim +++ b/autoload/airline/themes/badwolf.vim @@ -15,18 +15,21 @@ let s:V4 = [ '#c7915b' , 173 ] " coffee let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde let s:RE = [ '#ff9eb8' , 211 ] " dress -let s:file = [ '#ff2c4b' , '' , 196 , '' , '' ] -let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] +let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] let g:airline#themes#badwolf#palette = {} -let g:airline#themes#badwolf#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#badwolf#palette.accents = { + \ 'red': [ '#ff2c4b' , '' , 196 , '' , '' ] + \ } + +let g:airline#themes#badwolf#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#badwolf#palette.normal_modified = { \ 'airline_b': [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] , \ 'airline_c': [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] } -let g:airline#themes#badwolf#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#badwolf#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#badwolf#palette.insert_modified = { \ 'airline_c': [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] } let g:airline#themes#badwolf#palette.insert_paste = { @@ -38,12 +41,12 @@ let g:airline#themes#badwolf#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s let g:airline#themes#badwolf#palette.replace_modified = g:airline#themes#badwolf#palette.insert_modified -let g:airline#themes#badwolf#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#badwolf#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#badwolf#palette.visual_modified = { \ 'airline_c': [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] } -let g:airline#themes#badwolf#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) +let g:airline#themes#badwolf#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#badwolf#palette.inactive_modified = { \ 'airline_c': [ s:V1[1] , '' , s:V1[3] , '' , '' ] } diff --git a/autoload/airline/themes/base16.vim b/autoload/airline/themes/base16.vim index 2306fd31..c5af59f5 100644 --- a/autoload/airline/themes/base16.vim +++ b/autoload/airline/themes/base16.vim @@ -23,13 +23,11 @@ function! s:load_constant() let s:gui_pink = '#d7afd7' let s:cterm_pink = 182 - let s:file = ['#ff0000', '', 160, '', ''] - " Normal mode let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green] let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo] let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi] - let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) + let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#base16#palette.normal_modified = { \ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''], \ } @@ -37,7 +35,7 @@ function! s:load_constant() " Insert mode let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue] let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi] - let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3, s:file) + let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3) let g:airline#themes#base16#palette.insert_modified = copy(g:airline#themes#base16#palette.normal_modified) let g:airline#themes#base16#palette.insert_paste = { \ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''], @@ -53,12 +51,12 @@ function! s:load_constant() " Visual mode let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink] let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi] - let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3, s:file) + let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3) let g:airline#themes#base16#palette.visual_modified = copy(g:airline#themes#base16#palette.insert_modified) " Inactive window let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, ''] - let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) + let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#base16#palette.inactive_modified = { \ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], \ } @@ -66,12 +64,15 @@ endfunction function! s:load_dynamic() let g:airline#themes#base16#palette = {} - let s:file = airline#themes#get_highlight('Constant') + + let g:airline#themes#base16#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } let s:N1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['DiffText', 'fg'], 'bold') let s:N2 = airline#themes#get_highlight('Visual') let s:N3 = airline#themes#get_highlight('CursorLine') - let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) + let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let group = airline#themes#get_highlight('vimCommand') let g:airline#themes#base16#palette.normal_modified = { @@ -81,23 +82,23 @@ function! s:load_dynamic() let s:I1 = airline#themes#get_highlight2(['DiffAdded', 'bg'], ['DiffAdded', 'fg'], 'bold') let s:I2 = airline#themes#get_highlight2(['DiffAdded', 'fg'], ['Normal', 'bg']) let s:I3 = s:N3 - let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) + let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#base16#palette.insert_modified = g:airline#themes#base16#palette.normal_modified let s:R1 = airline#themes#get_highlight2(['WarningMsg', 'bg'], ['WarningMsg', 'fg'], 'bold') let s:R2 = s:N2 let s:R3 = s:N3 - let g:airline#themes#base16#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3, s:file) + let g:airline#themes#base16#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) let g:airline#themes#base16#palette.replace_modified = g:airline#themes#base16#palette.normal_modified let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold') let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) let s:V3 = s:N3 - let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) + let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#base16#palette.visual_modified = g:airline#themes#base16#palette.normal_modified let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg']) - let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) + let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#base16#palette.inactive_modified = { \ 'airline_c': [ group[0], '', group[2], '', '' ] \ } diff --git a/autoload/airline/themes/bubblegum.vim b/autoload/airline/themes/bubblegum.vim index d4d142cb..d18e0324 100644 --- a/autoload/airline/themes/bubblegum.vim +++ b/autoload/airline/themes/bubblegum.vim @@ -20,15 +20,13 @@ let s:cterm_red = 174 let s:gui_pink = '#d7afd7' let s:cterm_pink = 182 -let s:file = ['#ff0000', '', 160, '', ''] - let g:airline#themes#bubblegum#palette = {} " Normal mode let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green] let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo] let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi] -let g:airline#themes#bubblegum#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#bubblegum#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#bubblegum#palette.normal_modified = { \ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''], \ } @@ -36,7 +34,7 @@ let g:airline#themes#bubblegum#palette.normal_modified = { " Insert mode let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue] let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi] -let g:airline#themes#bubblegum#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3, s:file) +let g:airline#themes#bubblegum#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3) let g:airline#themes#bubblegum#palette.insert_modified = copy(g:airline#themes#bubblegum#palette.normal_modified) let g:airline#themes#bubblegum#palette.insert_paste = { \ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''], @@ -52,12 +50,12 @@ let g:airline#themes#bubblegum#palette.replace_modified = copy(g:airline#themes# " Visual mode let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink] let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi] -let g:airline#themes#bubblegum#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3, s:file) +let g:airline#themes#bubblegum#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3) let g:airline#themes#bubblegum#palette.visual_modified = copy(g:airline#themes#bubblegum#palette.insert_modified) " Inactive window let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, ''] -let g:airline#themes#bubblegum#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) +let g:airline#themes#bubblegum#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#bubblegum#palette.inactive_modified = { \ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], \ } diff --git a/autoload/airline/themes/dark.vim b/autoload/airline/themes/dark.vim index 62522b18..10f89a00 100644 --- a/autoload/airline/themes/dark.vim +++ b/autoload/airline/themes/dark.vim @@ -16,35 +16,22 @@ " simply overwrite the previous colors. If you want simultaneous overrides, " then they will need to change different parts of the statusline so they do " not conflict with each other. - -" First let's define some arrays. The s: is just a VimL thing for scoping the -" variables to the current script. Without this, these variables would be -" declared globally. " -" The array is in the format [ guifg, guibg, ctermfg, ctermbg, opts ]. -" The opts takes in values from ":help attr-list". +" First, let's define an empty dictionary and assign it to the "palette" +" variable. The # is a separator that maps with the directory structure. If +" you get this wrong, Vim will complain loudly. +let g:airline#themes#dark#palette = {} + +" First let's define some arrays. The s: is just a VimL thing for scoping the +" variables to the current script. Without this, these variables would be +" declared globally. Now let's declare some colors for normal mode and add it +" to the dictionary. The array is in the format: +" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid +" values for the "opt" value. let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ] let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ] let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ] - -" The file array is a special case, where only the foreground colors are -" specified. The background colors are automatically filled. -let s:file = [ '#ff0000' , '' , 160 , '' ] - -" vim-airline is made up of multiple sections, but for theming purposes there -" is only 3 sections: the mode, the branch indicator, and the gutter (which -" then get mirrored on the right side). generate_color_map is a helper -" function which generates a dictionary which declares the full colorscheme -" for the statusline. See the source code of "autoload/airline/themes.vim" -" for the full set of keys available for theming. - -" First, let's define a palette. Airline will search for this variable. -" The # is a separator that maps with the directory structure. If you get -" this wrong, Vim will complain loudly. -let g:airline#themes#dark#palette = {} - -" Now let's declare some colors for normal mode and add it to the dictionary. -let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) " Here we define overrides for when the buffer is modified. This will be " applied after g:airline#themes#dark#palette.normal, hence why only certain keys are @@ -57,7 +44,7 @@ let g:airline#themes#dark#palette.normal_modified = { let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ] let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ] let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ] -let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#dark#palette.insert_modified = { \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , \ } @@ -74,7 +61,7 @@ let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palet let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ] let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ] let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ] -let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#dark#palette.visual_modified = { \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , \ } @@ -83,12 +70,20 @@ let g:airline#themes#dark#palette.visual_modified = { let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ] let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ] -let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3, s:file) +let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) let g:airline#themes#dark#palette.inactive_modified = { \ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , \ } +" Accents are used to give parts within a section a slightly different look. +" Here we are defining a "red" accent, which is used by the 'readonly' part by +" default. +let g:airline#themes#dark#palette.accents = { + \ 'red': [ '#ff0000' , '' , 160 , '' ] + \ } + + " Here we define the color map for ctrlp. We check for the g:loaded_ctrlp " variable so that related functionality is loaded iff the user is using " ctrlp. Note that this is optional, and if you do not define ctrlp colors diff --git a/autoload/airline/themes/jellybeans.vim b/autoload/airline/themes/jellybeans.vim index 61072f1e..332abf36 100644 --- a/autoload/airline/themes/jellybeans.vim +++ b/autoload/airline/themes/jellybeans.vim @@ -11,9 +11,12 @@ function! s:generate() let s:N1 = airline#themes#get_highlight('DbgCurrent', 'bold') let s:N2 = airline#themes#get_highlight('Folded') let s:N3 = airline#themes#get_highlight('NonText') - let s:file = airline#themes#get_highlight('Constant') - let g:airline#themes#jellybeans#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) + let g:airline#themes#jellybeans#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + + let g:airline#themes#jellybeans#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#jellybeans#palette.normal_modified = { \ 'airline_c': [ '#ffb964', '', 215, '', '' ] \ } @@ -21,13 +24,13 @@ function! s:generate() let s:I1 = airline#themes#get_highlight('DiffAdd', 'bold') let s:I2 = s:N2 let s:I3 = s:N3 - let g:airline#themes#jellybeans#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) + let g:airline#themes#jellybeans#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#jellybeans#palette.insert_modified = g:airline#themes#jellybeans#palette.normal_modified let s:R1 = airline#themes#get_highlight('WildMenu', 'bold') let s:R2 = s:N2 let s:R3 = s:N3 - let g:airline#themes#jellybeans#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3, s:file) + let g:airline#themes#jellybeans#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) let g:airline#themes#jellybeans#palette.replace_modified = g:airline#themes#jellybeans#palette.normal_modified " Sometimes you want to mix and match colors from different groups, you can do @@ -35,12 +38,12 @@ function! s:generate() let s:V1 = airline#themes#get_highlight2(['TabLineSel', 'bg'], ['DiffDelete', 'bg'], 'bold') let s:V2 = s:N2 let s:V3 = s:N3 - let g:airline#themes#jellybeans#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) + let g:airline#themes#jellybeans#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#jellybeans#palette.visual_modified = g:airline#themes#jellybeans#palette.normal_modified " And of course, you can always do it manually as well. let s:IA = [ '#444444', '#1c1c1c', 237, 234 ] - let g:airline#themes#jellybeans#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) + let g:airline#themes#jellybeans#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#jellybeans#palette.inactive_modified = g:airline#themes#jellybeans#palette.normal_modified endfunction diff --git a/autoload/airline/themes/laederon.vim b/autoload/airline/themes/laederon.vim index 9b374846..115c1079 100644 --- a/autoload/airline/themes/laederon.vim +++ b/autoload/airline/themes/laederon.vim @@ -24,19 +24,22 @@ let s:RE = [ '#233e09' , 22 ] " oakleaf " Paste mode let s:PA = [ '#ab3e5d' , 161 ] " raspberry -let s:file = [ '#ef393d' , '' , 196 , '' , '' ] let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ] let g:airline#themes#laederon#palette = {} -let g:airline#themes#laederon#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#laederon#palette.accents = { + \ 'red': [ '#ef393d' , '' , 196 , '' , '' ] + \ } + +let g:airline#themes#laederon#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#laederon#palette.normal_modified = { \ 'airline_a' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] , \ 'airline_c' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] } -let g:airline#themes#laederon#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#laederon#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#laederon#palette.insert_modified = { \ 'airline_c' : [ s:V2[1] , s:N2[1] , s:V2[3] , s:N2[3] , '' ] } let g:airline#themes#laederon#palette.insert_paste = { @@ -48,12 +51,12 @@ let g:airline#themes#laederon#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , let g:airline#themes#laederon#palette.replace_modified = g:airline#themes#laederon#palette.insert_modified -let g:airline#themes#laederon#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#laederon#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#laederon#palette.visual_modified = { \ 'airline_c' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] } -let g:airline#themes#laederon#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) +let g:airline#themes#laederon#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#laederon#palette.inactive_modified = { \ 'airline_c' : [ s:V1[1] , '' , s:V1[3] , '' , '' ] } diff --git a/autoload/airline/themes/light.vim b/autoload/airline/themes/light.vim index 591155fa..d9fe8441 100644 --- a/autoload/airline/themes/light.vim +++ b/autoload/airline/themes/light.vim @@ -1,10 +1,9 @@ let g:airline#themes#light#palette = {} -let s:file = [ '#df0000' , '' , 160 , '' ] let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ] let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ] let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ] -let g:airline#themes#light#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#light#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#light#palette.normal_modified = { \ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , \ } @@ -13,7 +12,7 @@ let g:airline#themes#light#palette.normal_modified = { let s:I1 = [ '#ffffff' , '#00875f' , 255 , 29 ] let s:I2 = [ '#005f00' , '#00df87' , 22 , 42 ] let s:I3 = [ '#005f5f' , '#afff87' , 23 , 156 ] -let g:airline#themes#light#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#light#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#light#palette.insert_modified = { \ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , \ } @@ -30,7 +29,7 @@ let g:airline#themes#light#palette.replace_modified = g:airline#themes#light#pal let s:V1 = [ '#ffffff' , '#ff5f00' , 255 , 202 ] let s:V2 = [ '#5f0000' , '#ffaf00' , 52 , 214 ] let s:V3 = [ '#df5f00' , '#ffff87' , 166 , 228 ] -let g:airline#themes#light#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#light#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#light#palette.visual_modified = { \ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , \ } @@ -39,7 +38,7 @@ let g:airline#themes#light#palette.visual_modified = { let s:IA1 = [ '#666666' , '#b2b2b2' , 242 , 249 , '' ] let s:IA2 = [ '#8a8a8a' , '#d0d0d0' , 245 , 252 , '' ] let s:IA3 = [ '#a8a8a8' , '#ffffff' , 248 , 255 , '' ] -let g:airline#themes#light#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3, s:file) +let g:airline#themes#light#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) let g:airline#themes#light#palette.inactive_modified = { \ 'airline_c': [ '#df0000' , '' , 160 , '' , '' ] , \ } diff --git a/autoload/airline/themes/luna.vim b/autoload/airline/themes/luna.vim index 878dcf69..5999ee77 100644 --- a/autoload/airline/themes/luna.vim +++ b/autoload/airline/themes/luna.vim @@ -2,13 +2,16 @@ " (https://github.com/Pychimp/vim-luna) let g:airline#themes#luna#palette = {} -let s:file = [ '#ffffff' , '' , 231 , '' , '' ] + +let g:airline#themes#luna#palette.accents = { + \ 'red': [ '#ffffff' , '' , 231 , '' , '' ], + \ } let s:N1 = [ '#ffffff' , '#005252' , 231 , 36 ] let s:N2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] let s:N3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] -let g:airline#themes#luna#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#luna#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#luna#palette.normal_modified = { \ 'airline_c': [ '#ffffff' , '#450000' , 231 , 52 , '' ] , \ } @@ -17,7 +20,7 @@ let g:airline#themes#luna#palette.normal_modified = { let s:I1 = [ '#ffffff' , '#789f00' , 231 , 106 ] let s:I2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] let s:I3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] -let g:airline#themes#luna#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#luna#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#luna#palette.insert_modified = { \ 'airline_c': [ '#ffffff' , '#005e5e' , 255 , 52 , '' ] , \ } @@ -33,13 +36,13 @@ let g:airline#themes#luna#palette.replace_modified = g:airline#themes#luna#palet let s:V1 = [ '#ffff9a' , '#ff8036' , 222 , 208 ] let s:V2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] let s:V3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] -let g:airline#themes#luna#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#luna#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#luna#palette.visual_modified = { \ 'airline_c': [ '#ffffff' , '#450000' , 231 , 52 , '' ] , \ } let s:IA = [ '#4e4e4e' , '#002b2b' , 59 , 23 , '' ] -let g:airline#themes#luna#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) +let g:airline#themes#luna#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#luna#palette.inactive_modified = { \ 'airline_c': [ '#450000' , '' , 52 , '' , '' ] , \ } diff --git a/autoload/airline/themes/molokai.vim b/autoload/airline/themes/molokai.vim index 040c4bf9..1998f002 100644 --- a/autoload/airline/themes/molokai.vim +++ b/autoload/airline/themes/molokai.vim @@ -1,14 +1,16 @@ let g:airline#themes#molokai#palette = {} +let g:airline#themes#molokai#palette.accents = { + \ 'red': [ '#66d9ef' , '' , 81 , '' , '' ], + \ } -let s:file = [ '#66d9ef' , '' , 81 , '' , '' ] " Normal mode let s:N1 = [ '#080808' , '#e6db74' , 232 , 144 ] " mode let s:N2 = [ '#f8f8f0' , '#232526' , 253 , 16 ] " info let s:N3 = [ '#f8f8f0' , '#465457' , 253 , 67 ] " statusline -let g:airline#themes#molokai#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#molokai#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#molokai#palette.normal_modified = { \ 'airline_c': [ '#080808' , '#e6db74' , 232 , 144 , '' ] , \ } @@ -19,7 +21,7 @@ let s:I1 = [ '#080808' , '#66d9ef' , 232 , 81 ] let s:I2 = [ '#f8f8f0' , '#232526' , 253 , 16 ] let s:I3 = [ '#f8f8f0' , '#465457' , 253 , 67 ] -let g:airline#themes#molokai#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#molokai#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#molokai#palette.insert_modified = { \ 'airline_c': [ '#080808' , '#66d9ef' , 232 , 81 , '' ] , \ } @@ -38,7 +40,7 @@ let s:V1 = [ '#080808' , '#fd971f' , 232 , 208 ] let s:V2 = [ '#f8f8f0' , '#232526' , 253 , 16 ] let s:V3 = [ '#f8f8f0' , '#465457' , 253 , 67 ] -let g:airline#themes#molokai#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#molokai#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#molokai#palette.visual_modified = { \ 'airline_c': [ '#080808' , '#fd971f' , 232 , 208 , '' ] , \ } @@ -46,7 +48,7 @@ let g:airline#themes#molokai#palette.visual_modified = { " Inactive let s:IA = [ '#1b1d1e' , '#465457' , 233 , 67 , '' ] -let g:airline#themes#molokai#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) +let g:airline#themes#molokai#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#molokai#palette.inactive_modified = { \ 'airline_c': [ '#f8f8f0' , '' , 253 , '' , '' ] , \ } diff --git a/autoload/airline/themes/powerlineish.vim b/autoload/airline/themes/powerlineish.vim index de9d89f8..d550e110 100644 --- a/autoload/airline/themes/powerlineish.vim +++ b/autoload/airline/themes/powerlineish.vim @@ -26,13 +26,11 @@ let s:V1 = [ '#080808' , '#ffaf00' , 232 , 214 ] " gray3 & brightestora " Replace mode " fg & bg let s:RE = [ '#ffffff' , '#d70000' , 231 , 160 ] " white & brightred -let s:file = copy(s:N3) - let g:airline#themes#powerlineish#palette = {} -let g:airline#themes#powerlineish#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#powerlineish#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) -let g:airline#themes#powerlineish#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#powerlineish#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#powerlineish#palette.insert_replace = { \ 'airline_a': [ s:RE[0] , s:I1[1] , s:RE[1] , s:I1[3] , '' ] } @@ -44,5 +42,5 @@ let g:airline#themes#powerlineish#palette.replace.airline_a = [ s:RE[0] , s:RE[1 let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] -let g:airline#themes#powerlineish#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) +let g:airline#themes#powerlineish#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) diff --git a/autoload/airline/themes/serene.vim b/autoload/airline/themes/serene.vim index 4ca88756..fd220252 100644 --- a/autoload/airline/themes/serene.vim +++ b/autoload/airline/themes/serene.vim @@ -5,12 +5,11 @@ let s:termbg = 232 let s:termsep = 236 let s:guisep = '#303030' -let s:file = [ '#ff0000' , s:guibg , 160 , s:termbg , '' ] let s:N1 = [ '#00dfff' , s:guibg , 45 , s:termbg ] let s:N2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ] let s:N3 = [ '#767676' , s:guibg, 7 , s:termbg ] -let g:airline#themes#serene#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#serene#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#serene#palette.normal_modified = { \ 'airline_c': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] , \ } @@ -18,7 +17,7 @@ let g:airline#themes#serene#palette.normal_modified = { let s:I1 = [ '#5fff00' , s:guibg, 82 , s:termbg ] let s:I2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ] let s:I3 = [ '#767676' , s:guibg, 7 , s:termbg ] -let g:airline#themes#serene#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#serene#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#serene#palette.insert_modified = copy(g:airline#themes#serene#palette.normal_modified) let g:airline#themes#serene#palette.insert_paste = { \ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , @@ -32,10 +31,10 @@ let g:airline#themes#serene#palette.replace_modified = copy(g:airline#themes#ser let s:V1 = [ '#dfdf00' , s:guibg, 184 , s:termbg ] let s:V2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ] let s:V3 = [ '#767676' , s:guibg, 243 , s:termbg ] -let g:airline#themes#serene#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#serene#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#serene#palette.visual_modified = copy(g:airline#themes#serene#palette.normal_modified) let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ] let s:IA2 = [ '#4e4e4e' , s:guisep , 239 , s:termsep , '' ] -let g:airline#themes#serene#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2, s:file) +let g:airline#themes#serene#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2) let g:airline#themes#serene#palette.inactive_modified = copy(g:airline#themes#serene#palette.normal_modified) diff --git a/autoload/airline/themes/simple.vim b/autoload/airline/themes/simple.vim index f48c6c9d..a111a1cb 100644 --- a/autoload/airline/themes/simple.vim +++ b/autoload/airline/themes/simple.vim @@ -5,11 +5,10 @@ let s:guibg2 = '#1c1c1c' let s:termbg = 232 let s:termbg2= 234 -let s:file = [ '#ff0000' , '' , 160 , '' , '' ] let s:N1 = [ s:guibg , '#00dfff' , s:termbg , 45 ] let s:N2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ] let s:N3 = [ '#767676' , s:guibg, 243 , s:termbg] -let g:airline#themes#simple#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#simple#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#simple#palette.normal_modified = { \ 'airline_c': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] , \ } @@ -18,7 +17,7 @@ let g:airline#themes#simple#palette.normal_modified = { let s:I1 = [ s:guibg, '#5fff00' , s:termbg , 82 ] let s:I2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ] let s:I3 = [ '#767676' , s:guibg, 243 , s:termbg ] -let g:airline#themes#simple#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#simple#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#simple#palette.insert_modified = copy(g:airline#themes#simple#palette.normal_modified) let g:airline#themes#simple#palette.insert_paste = { \ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , @@ -34,13 +33,13 @@ let g:airline#themes#simple#palette.replace_modified = copy(g:airline#themes#sim let s:V1 = [ s:guibg, '#dfdf00' , s:termbg , 184 ] let s:V2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ] let s:V3 = [ '#767676' , s:guibg, 243 , s:termbg ] -let g:airline#themes#simple#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#simple#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#simple#palette.visual_modified = copy(g:airline#themes#simple#palette.normal_modified) let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ] let s:IA2 = [ '#4e4e4e' , s:guibg2 , 239 , s:termbg2 , '' ] -let g:airline#themes#simple#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2, s:file) +let g:airline#themes#simple#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2) let g:airline#themes#simple#palette.inactive_modified = { \ 'airline_c': [ '#df0000', '', 160, '', '' ] , \ } diff --git a/autoload/airline/themes/solarized.vim b/autoload/airline/themes/solarized.vim index d3ef4cbe..efbf4942 100644 --- a/autoload/airline/themes/solarized.vim +++ b/autoload/airline/themes/solarized.vim @@ -89,19 +89,21 @@ function! s:generate() let s:VFa = [s:VF[0].g, s:VF[1].g, s:VF[0].t, s:VF[1].t, s:VF[2]] let s:RFa = [s:RF[0].g, s:RF[1].g, s:RF[0].t, s:RF[1].t, s:RF[2]] + let g:airline#themes#solarized#palette.accents = { + \ 'red': s:NFa, + \ } + let g:airline#themes#solarized#palette.inactive = airline#themes#generate_color_map( \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]], \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]], - \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]], - \ s:NFa) + \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]]) let g:airline#themes#solarized#palette.inactive_modified = { \ 'airline_c': [s:NM[0].g, '', s:NM[0].t, '', s:NM[2]]} let g:airline#themes#solarized#palette.normal = airline#themes#generate_color_map( \ [s:N1[0].g, s:N1[1].g, s:N1[0].t, s:N1[1].t, s:N1[2]], \ [s:N2[0].g, s:N2[1].g, s:N2[0].t, s:N2[1].t, s:N2[2]], - \ [s:N3[0].g, s:N3[1].g, s:N3[0].t, s:N3[1].t, s:N3[2]], - \ s:NFa) + \ [s:N3[0].g, s:N3[1].g, s:N3[0].t, s:N3[1].t, s:N3[2]]) let g:airline#themes#solarized#palette.normal.airline_warning = [ \ s:NW[0].g, s:NW[1].g, s:NW[0].t, s:NW[1].t, s:NW[2]] @@ -116,8 +118,7 @@ function! s:generate() let g:airline#themes#solarized#palette.insert = airline#themes#generate_color_map( \ [s:I1[0].g, s:I1[1].g, s:I1[0].t, s:I1[1].t, s:I1[2]], \ [s:I2[0].g, s:I2[1].g, s:I2[0].t, s:I2[1].t, s:I2[2]], - \ [s:I3[0].g, s:I3[1].g, s:I3[0].t, s:I3[1].t, s:I3[2]], - \ s:IFa) + \ [s:I3[0].g, s:I3[1].g, s:I3[0].t, s:I3[1].t, s:I3[2]]) let g:airline#themes#solarized#palette.insert_modified = { \ 'airline_c': [s:IM[0].g, s:IM[1].g, @@ -126,8 +127,7 @@ function! s:generate() let g:airline#themes#solarized#palette.visual = airline#themes#generate_color_map( \ [s:V1[0].g, s:V1[1].g, s:V1[0].t, s:V1[1].t, s:V1[2]], \ [s:V2[0].g, s:V2[1].g, s:V2[0].t, s:V2[1].t, s:V2[2]], - \ [s:V3[0].g, s:V3[1].g, s:V3[0].t, s:V3[1].t, s:V3[2]], - \ s:VFa) + \ [s:V3[0].g, s:V3[1].g, s:V3[0].t, s:V3[1].t, s:V3[2]]) let g:airline#themes#solarized#palette.visual_modified = { \ 'airline_c': [s:VM[0].g, s:VM[1].g, diff --git a/autoload/airline/themes/tomorrow.vim b/autoload/airline/themes/tomorrow.vim index e385ba72..1df78055 100644 --- a/autoload/airline/themes/tomorrow.vim +++ b/autoload/airline/themes/tomorrow.vim @@ -1,12 +1,14 @@ let g:airline#themes#tomorrow#palette = {} function! s:generate() - let s:file = airline#themes#get_highlight('Constant') + let g:airline#themes#tomorrow#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Directory', 'fg'], 'bold') let s:N2 = airline#themes#get_highlight('Pmenu') let s:N3 = airline#themes#get_highlight('CursorLine') - let g:airline#themes#tomorrow#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) + let g:airline#themes#tomorrow#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let group = airline#themes#get_highlight('vimCommand') let g:airline#themes#tomorrow#palette.normal_modified = { @@ -16,23 +18,23 @@ function! s:generate() let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['MoreMsg', 'fg'], 'bold') let s:I2 = airline#themes#get_highlight2(['MoreMsg', 'fg'], ['Normal', 'bg']) let s:I3 = s:N3 - let g:airline#themes#tomorrow#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) + let g:airline#themes#tomorrow#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#tomorrow#palette.insert_modified = g:airline#themes#tomorrow#palette.normal_modified let s:R1 = airline#themes#get_highlight('Error', 'bold') let s:R2 = s:N2 let s:R3 = s:N3 - let g:airline#themes#tomorrow#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3, s:file) + let g:airline#themes#tomorrow#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) let g:airline#themes#tomorrow#palette.replace_modified = g:airline#themes#tomorrow#palette.normal_modified let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold') let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) let s:V3 = s:N3 - let g:airline#themes#tomorrow#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) + let g:airline#themes#tomorrow#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#tomorrow#palette.visual_modified = g:airline#themes#tomorrow#palette.normal_modified let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg']) - let g:airline#themes#tomorrow#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) + let g:airline#themes#tomorrow#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#tomorrow#palette.inactive_modified = { \ 'airline_c': [ group[0], '', group[2], '', '' ] \ } diff --git a/autoload/airline/themes/ubaryd.vim b/autoload/airline/themes/ubaryd.vim index adbc636a..70232ef8 100644 --- a/autoload/airline/themes/ubaryd.vim +++ b/autoload/airline/themes/ubaryd.vim @@ -24,21 +24,25 @@ let s:RE = [ '#c7915b' , 173 ] " nut " Paste mode let s:PA = [ '#f9ef6d' , 154 ] " bleaklemon -let s:file = [ '#ff7400' , '' , 196 , '' , '' ] let s:IA = [ s:N2[1], s:N3[1], s:N2[3], s:N3[3], '' ] let g:airline#themes#ubaryd#palette = {} + +let g:airline#themes#ubaryd#palette.accents = { + \ 'red': [ '#ff7400' , '' , 196 , '' , '' ], + \ } + let g:airline#themes#ubaryd#palette.inactive = { \ 'airline_a' : [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] } -let g:airline#themes#ubaryd#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#ubaryd#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#ubaryd#palette.normal_modified = { \ 'airline_a' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] , \ 'airline_c' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] } -let g:airline#themes#ubaryd#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#ubaryd#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#ubaryd#palette.insert_modified = { \ 'airline_c' : [ s:V2[1] , s:N2[1] , s:V2[3] , s:N2[3] , '' ] } let g:airline#themes#ubaryd#palette.insert_paste = { @@ -50,11 +54,11 @@ let g:airline#themes#ubaryd#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s: let g:airline#themes#ubaryd#palette.replace_modified = g:airline#themes#ubaryd#palette.insert_modified -let g:airline#themes#ubaryd#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#ubaryd#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#ubaryd#palette.visual_modified = { \ 'airline_c' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] } -let g:airline#themes#ubaryd#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) +let g:airline#themes#ubaryd#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#ubaryd#palette.inactive_modified = { \ 'airline_c' : [ s:V1[1] , '' , s:V1[3] , '' , '' ] } diff --git a/autoload/airline/themes/wombat.vim b/autoload/airline/themes/wombat.vim index 7c6faf42..39fdc4c1 100644 --- a/autoload/airline/themes/wombat.vim +++ b/autoload/airline/themes/wombat.vim @@ -32,38 +32,37 @@ let s:PA = [ '#94E42C' , 47 ] " Info modified let s:IM = [ '#40403C' , 238 ] -" File permissions (RO, etc) -let s:file = [ '#E5786D' , '' , 203 , '' , '' ] - " Inactive mode let s:IA = [ '#767676' , s:N3[1] , 243 , s:N3[3] , '' ] - let g:airline#themes#wombat#palette = {} +let g:airline#themes#wombat#palette.accents = { + \ 'red': [ '#E5786D' , '' , 203 , '' , '' ], + \ } -let g:airline#themes#wombat#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) +let g:airline#themes#wombat#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#wombat#palette.normal_modified = { \ 'airline_a': [ s:N1[0] , s:N4[0] , s:N1[2] , s:N4[1] , '' ] , \ 'airline_b': [ s:N4[0] , s:IM[0] , s:N4[1] , s:IM[1] , '' ] , \ 'airline_c': [ s:N4[0] , s:N3[1] , s:N4[1] , s:N3[3] , '' ] } -let g:airline#themes#wombat#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) +let g:airline#themes#wombat#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#wombat#palette.insert_modified = { \ 'airline_a': [ s:I1[0] , s:I4[0] , s:I1[2] , s:I4[1] , '' ] , \ 'airline_b': [ s:I4[0] , s:IM[0] , s:I4[1] , s:IM[1] , '' ] , \ 'airline_c': [ s:I4[0] , s:N3[1] , s:I4[1] , s:N3[3] , '' ] } -let g:airline#themes#wombat#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) +let g:airline#themes#wombat#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#wombat#palette.visual_modified = { \ 'airline_a': [ s:V1[0] , s:V4[0] , s:V1[2] , s:V4[1] , '' ] , \ 'airline_b': [ s:V4[0] , s:IM[0] , s:V4[1] , s:IM[1] , '' ] , \ 'airline_c': [ s:V4[0] , s:N3[1] , s:V4[1] , s:N3[3] , '' ] } -let g:airline#themes#wombat#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3, s:file) +let g:airline#themes#wombat#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) let g:airline#themes#wombat#palette.replace_modified = { \ 'airline_a': [ s:R1[0] , s:R4[0] , s:R1[2] , s:R4[1] , '' ] , \ 'airline_b': [ s:R4[0] , s:IM[0] , s:R4[1] , s:IM[1] , '' ] , @@ -76,7 +75,7 @@ let g:airline#themes#wombat#palette.insert_paste = { \ 'airline_c': [ s:PA[0] , s:N3[1] , s:PA[1] , s:N3[3] , '' ] } -let g:airline#themes#wombat#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) +let g:airline#themes#wombat#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#wombat#palette.inactive_modified = { \ 'airline_c': [ s:N4[0] , '' , s:N4[1] , '' , '' ] } diff --git a/autoload/airline/themes/zenburn.vim b/autoload/airline/themes/zenburn.vim index 061fed4b..311d0337 100644 --- a/autoload/airline/themes/zenburn.vim +++ b/autoload/airline/themes/zenburn.vim @@ -1,12 +1,15 @@ let g:airline#themes#zenburn#palette = {} function! s:generate() + let g:airline#themes#zenburn#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + let s:N1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Folded', 'fg'], 'bold') let s:N2 = airline#themes#get_highlight('Folded') let s:N3 = airline#themes#get_highlight('NonText') - let s:file = airline#themes#get_highlight('Constant') - let g:airline#themes#zenburn#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) + let g:airline#themes#zenburn#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let s:Nmod = airline#themes#get_highlight('Comment') let g:airline#themes#zenburn#palette.normal_modified = { \ 'airline_c': s:Nmod @@ -15,23 +18,23 @@ function! s:generate() let s:I1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['String', 'fg'], 'bold') let s:I2 = airline#themes#get_highlight2(['String', 'fg'], ['Folded', 'bg']) let s:I3 = s:N3 - let g:airline#themes#zenburn#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) + let g:airline#themes#zenburn#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#zenburn#palette.insert_modified = g:airline#themes#zenburn#palette.normal_modified let s:R1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Comment', 'fg'], 'bold') let s:R2 = airline#themes#get_highlight2(['Comment', 'fg'], ['Folded', 'bg']) let s:R3 = s:N3 - let g:airline#themes#zenburn#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3, s:file) + let g:airline#themes#zenburn#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) let g:airline#themes#zenburn#palette.replace_modified = g:airline#themes#zenburn#palette.normal_modified let s:V1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Identifier', 'fg'], 'bold') let s:V2 = airline#themes#get_highlight2(['Identifier', 'fg'], ['Folded', 'bg']) let s:V3 = s:N3 - let g:airline#themes#zenburn#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) + let g:airline#themes#zenburn#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#zenburn#palette.visual_modified = g:airline#themes#zenburn#palette.normal_modified let s:IA = airline#themes#get_highlight('NonText') - let g:airline#themes#zenburn#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) + let g:airline#themes#zenburn#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#zenburn#palette.inactive_modified = { \ 'airline_c': s:Nmod \ } diff --git a/t/builder.vim b/t/builder.vim index 2ba99814..07df4b8c 100644 --- a/t/builder.vim +++ b/t/builder.vim @@ -1,3 +1,4 @@ +let g:airline_theme = 'dark' call airline#init#bootstrap() describe 'active builder' @@ -37,6 +38,25 @@ describe 'active builder' let stl = s:builder.build() Expect stl == '%#Normal#hello>hello' end + + it 'should replace accent groups with the specified group' + call s:builder.add_section('Normal', '%#airline_accent_foo#hello') + let stl = s:builder.build() + Expect stl == '%#Normal#%#Normal_foo#hello' + end + + it 'should replace two accent groups with correct groups' + call s:builder.add_section('Normal', '%#airline_accent_foo#hello%#airline_accent_bar#world') + let stl = s:builder.build() + Expect stl =~ '%#Normal_foo#hello%#Normal_bar#world' + end + + it 'should special restore group should go back to previous group' + call s:builder.add_section('Normal', '%#__restore__#') + let stl = s:builder.build() + Expect stl !~ '%#__restore__#' + Expect stl =~ '%#Normal#' + end end describe 'inactive builder' diff --git a/t/extensions_default.vim b/t/extensions_default.vim index 475884a1..b98e8166 100644 --- a/t/extensions_default.vim +++ b/t/extensions_default.vim @@ -1,3 +1,4 @@ +let g:airline_theme = 'dark' call airline#init#bootstrap() call airline#init#sections() source plugin/airline.vim diff --git a/t/highligher.vim b/t/highligher.vim deleted file mode 100644 index 658e8167..00000000 --- a/t/highligher.vim +++ /dev/null @@ -1,10 +0,0 @@ -describe 'highlighter' - it 'should create separator highlight groups' - hi Foo1 ctermfg=1 ctermbg=2 - hi Foo2 ctermfg=3 ctermbg=4 - call airline#highlighter#add_separator('Foo1', 'Foo2', 0) - let hl = airline#highlighter#get_highlight('Foo1_to_Foo2') - Expect hl == [ '', '', '4', '2', '' ] - end -end - diff --git a/t/highlighter.vim b/t/highlighter.vim new file mode 100644 index 00000000..c0f7c38e --- /dev/null +++ b/t/highlighter.vim @@ -0,0 +1,20 @@ +let g:airline_theme = 'dark' + +describe 'highlighter' + it 'should create separator highlight groups' + hi Foo1 ctermfg=1 ctermbg=2 + hi Foo2 ctermfg=3 ctermbg=4 + call airline#highlighter#add_separator('Foo1', 'Foo2', 0) + let hl = airline#highlighter#get_highlight('Foo1_to_Foo2') + Expect hl == [ '', '', '4', '2', '' ] + end + + it 'should populate accent colors' + Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_false + Expect exists('g:airline#themes#dark#palette.insert.airline_c_red') to_be_false + call airline#highlighter#add_accent('airline_c', 'red') + Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_true + Expect exists('g:airline#themes#dark#palette.insert.airline_c_red') to_be_true + end +end + diff --git a/t/init.vim b/t/init.vim index e937de0a..b9f8fb6f 100644 --- a/t/init.vim +++ b/t/init.vim @@ -28,7 +28,7 @@ describe 'init' end it 'section c should be file' - Expect g:airline_section_c == '%<%f%m' + Expect g:airline_section_c == '%<%f%m %#airline_accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#' end it 'section x should be filetype' diff --git a/t/parts.vim b/t/parts.vim index ba4341d7..ee7c92e3 100644 --- a/t/parts.vim +++ b/t/parts.vim @@ -30,5 +30,10 @@ describe 'parts' call airline#parts#define_condition('part', '1') Expect airline#parts#get('part').condition == '1' end + + it 'can define a accent' + call airline#parts#define_accent('part', 'red') + Expect airline#parts#get('part').accent == 'red' + end end diff --git a/t/section.vim b/t/section.vim index de9f2081..8d3a4fcb 100644 --- a/t/section.vim +++ b/t/section.vim @@ -26,13 +26,13 @@ describe 'section' Expect s == '%{airline#util#prepend("text",0)}%{airline#util#wrap("text",0)}' end - it 'should prefix with highlight group if provided' + it 'should prefix with accent group if provided' call airline#parts#define('hi', { \ 'raw': 'hello', - \ 'highlight': 'hlgroup', + \ 'accent': 'red', \ }) let s = airline#section#create(['hi']) - Expect s == '%#hlgroup#hello' + Expect s == '%#airline_accent_red#hello' end it 'should parse out a section from the distro' diff --git a/t/themes.vim b/t/themes.vim index 2998a608..d735229e 100644 --- a/t/themes.vim +++ b/t/themes.vim @@ -39,12 +39,10 @@ describe 'themes' \ [ 1, 1, 1, 1, '1' ], \ [ 2, 2, 2, 2, '2' ], \ [ 3, 3, 3, 3, '3' ], - \ [ 4, 4, 4, 4, '4' ], \ ) Expect map.airline_a[0] == 1 Expect map.airline_b[0] == 2 Expect map.airline_c[0] == 3 - Expect map.airline_file[0] == 4 Expect map.airline_x[0] == 3 Expect map.airline_y[0] == 2 Expect map.airline_z[0] == 1 @@ -58,7 +56,6 @@ describe 'themes' \ [ 4, 4, 4, 4, '4' ], \ [ 5, 5, 5, 5, '5' ], \ [ 6, 6, 6, 6, '6' ], - \ [ 7, 7, 7, 7, '7' ], \ ) Expect map.airline_a[0] == 1 Expect map.airline_b[0] == 2 @@ -66,7 +63,6 @@ describe 'themes' Expect map.airline_x[0] == 4 Expect map.airline_y[0] == 5 Expect map.airline_z[0] == 6 - Expect map.airline_file[0] == 7 end end