Merge branch '127'

Resolves #127.

Conflicts:
	autoload/airline.vim
This commit is contained in:
bling 2013-08-10 12:15:14 -04:00
commit e1ff1edcf0
14 changed files with 46 additions and 29 deletions

View File

@ -32,7 +32,6 @@ endfunction
function! airline#reload_highlight()
call airline#highlight(['inactive'])
call airline#highlight(['normal'])
call airline#themes#exec_highlight_separator('Al2', 'warningmsg')
call airline#extensions#load_theme()
endfunction
@ -56,6 +55,7 @@ function! airline#highlight(modes)
endfor
endif
endfor
call airline#themes#exec_highlight_separator('Al2', 'warningmsg')
endfunction
" for 7.2 compatibility
@ -79,7 +79,7 @@ function! s:get_statusline(winnr, active)
let l:file_flag_color = a:active ? "%#Al7#" : "%#Al7_inactive#"
let sl = '%{airline#update_highlight()}'
if a:active || s:getwinvar(a:winnr, 'airline_left_only', 0)
if s:getwinvar(a:winnr, 'airline_render_left', a:active)
let sl.=l:mode_color.s:get_section(a:winnr, 'a')
let sl.='%{g:airline_detect_paste && &paste ? g:airline_paste_symbol." " : ""}'
let sl.=l:mode_sep_color
@ -95,7 +95,7 @@ function! s:get_statusline(winnr, active)
else
let sl.=l:status_color.' %f%m'
endif
if !s:getwinvar(a:winnr, 'airline_left_only', 0)
if s:getwinvar(a:winnr, 'airline_render_right', 1)
let sl.='%='
let sl.=s:get_section(a:winnr, 'x')
let sl.=l:info_sep_color
@ -146,7 +146,8 @@ function! airline#update_statusline()
let w:airline_active = 1
unlet! w:airline_left_only
unlet! w:airline_render_left
unlet! w:airline_render_right
for section in s:sections
unlet! w:airline_section_{section}
endfor

View File

@ -28,7 +28,8 @@ function! airline#extensions#apply_left_override(section1, section2)
let w:airline_section_b = a:section2
let w:airline_section_c = ''
let w:airline_section_gutter = ' '
let w:airline_left_only = 1
let w:airline_render_left = 1
let w:airline_render_right = 0
endfunction
let s:active_winnr = -1
@ -41,12 +42,10 @@ function! airline#extensions#update_statusline()
let w:airline_section_c = ''
let w:airline_section_x = ''
elseif &buftype == 'help'
let w:airline_section_a = 'Help'
let w:airline_section_b = '%f'
let w:airline_section_c = ''
let w:airline_section_gutter = ' '
call airline#extensions#apply_left_override('Help', '%f')
let w:airline_section_x = ''
let w:airline_section_y = ''
let w:airline_render_right = 1
endif
if &previewwindow

View File

@ -3,8 +3,11 @@
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
let s:initialized = 0
let s:vimrc_detect_whitespace = g:airline_detect_whitespace
function! airline#extensions#whitespace#check()
if &readonly || !g:airline_detect_whitespace
if &readonly || g:airline_detect_whitespace <= 0
return ''
endif
@ -40,15 +43,15 @@ function! airline#extensions#whitespace#apply()
endfunction
function! airline#extensions#whitespace#toggle()
let g:airline_detect_whitespace = !g:airline_detect_whitespace
if g:airline_detect_whitespace
call airline#extensions#whitespace#init()
else
if g:airline_detect_whitespace > 0
autocmd! airline_whitespace CursorHold,BufWritePost
let g:airline_detect_whitespace = 0
else
call airline#extensions#whitespace#init()
let g:airline_detect_whitespace = s:vimrc_detect_whitespace
endif
endfunction
let s:initialized = 0
function! airline#extensions#whitespace#init()
if !s:initialized
let s:initialized = 1

View File

@ -3,14 +3,19 @@
" generates a dictionary which defines the colors for each highlight group
function! airline#themes#generate_color_map(section1, section2, section3, file)
" provide matching background colors if not provided
let file = copy(a:file)
if file[1] == '' | let file[1] = a:section3[1] | endif
if file[3] == '' | let file[3] = a:section3[3] | endif
" guifg guibg ctermfg ctermbg gui/term
return {
\ 'mode': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , get(a:section1, 4, 'bold') ] ,
\ 'mode_separator': [ a:section1[1] , a:section2[1] , a:section1[3] , a:section2[3] , '' ] ,
\ 'info': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , get(a:section2, 4, '' ) ] ,
\ 'info_separator': [ a:section2[1] , a:section3[1] , a:section2[3] , a:section3[3] , '' ] ,
\ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3, 4, '' ) ] ,
\ 'file': [ a:file[0] , a:file[1] , a:file[2] , a:file[3] , get(a:file , 4, '' ) ] ,
\ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3 , 4 , '' ) ] ,
\ 'file': [ file[0] , file[1] , file[2] , file[3] , get(file , 4 , '' ) ] ,
\ }
endfunction

View File

@ -15,7 +15,7 @@ let s:V4 = [ '#c7915b' , 173 ] " coffee
let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde
let s:RE = [ '#ff9eb8' , 211 ] " dress
let s:file = [ '#ff2c4b' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ff2c4b' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ]

View File

@ -20,7 +20,7 @@ let s:cterm_red = 174
let s:gui_pink = '#d7afd7'
let s:cterm_pink = 182
let s:file = ['#ff0000', '#1c1c1c', 160, 233, '']
let s:file = ['#ff0000', '', 160, '', '']
" Normal mode
let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green]

View File

@ -23,10 +23,10 @@
"
" The array is in the format [ guifg, guibg, ctermfg, ctermbg, opts ].
" The opts takes in values from ":help attr-list".
let s:file = [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ]
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
let s:file = [ '#ff0000' , '' , 160 , '' , '' ]
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
" 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

View File

@ -6,10 +6,16 @@ function! s:generate()
" Here are examples where the entire highlight group is copied and an airline
" compatible color array is generated.
let s:file = airline#themes#get_highlight('Constant')
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')
" The file indicator is a special case where if the background values are
" empty the generate_color_map function will extract a matching color.
let s:file = airline#themes#get_highlight('Constant')
let s:file[1] = ''
let s:file[3] = ''
let g:airline#themes#jellybeans#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#jellybeans#normal_modified = {
\ 'statusline': [ '#ffb964', '', 215, '', '' ]

View File

@ -24,7 +24,7 @@ let s:RE = [ '#233e09' , 22 ] " oakleaf
" Paste mode
let s:PA = [ '#ab3e5d' , 161 ] " raspberry
let s:file = [ '#ef393d' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ef393d' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ]

View File

@ -1,4 +1,4 @@
let s:file = [ '#df0000' , '#ffffff' , 160 , 255 ]
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 ]

View File

@ -36,7 +36,7 @@ let s:termbg = 232
let s:termsep = 236
let s:guisep = '#303030'
let s:file = [ '#ff0000' , s:guibg , 160 , s:termbg , '' ]
let s:file = [ '#ff0000' , '' , 160 , '' , '' ]
let s:N1 = s:swap ? [ s:guibg , '#00dfff' , s:termbg , 45 ] : [ '#00dfff' , s:guibg , 45 , s:termbg ]
let s:N2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ]
let s:N3 = [ '#767676' , s:guibg, 243 , s:termbg ]

View File

@ -1,5 +1,8 @@
function! s:generate()
let s:file = airline#themes#get_highlight('Constant')
" clear out backgrounds so generate_color_map will fill them in
let s:file[1] = ''
let s:file[3] = ''
let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Directory', 'fg'], 'bold')
let s:N2 = airline#themes#get_highlight('Pmenu')

View File

@ -24,7 +24,7 @@ let s:RE = [ '#c7915b' , 173 ] " nut
" Paste mode
let s:PA = [ '#f9ef6d' , 154 ] " bleaklemon
let s:file = [ '#ff7400' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ff7400' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ]

View File

@ -33,7 +33,7 @@ let s:PA = [ '#94E42C' , 47 ]
let s:IM = [ '#40403C' , 238 ]
" File permissions (RO, etc)
let s:file = [ '#E5786D' , s:N3[1] , 203 , s:N3[3] , '' ]
let s:file = [ '#E5786D' , '' , 203 , '' , '' ]
" Inactive mode
let s:IA = [ '#767676' , s:N3[1] , 243 , s:N3[3] , '' ]