allow g: gutter to be specified, integrate with vimshell, use get() for :w variables

This commit is contained in:
Bailey Ling 2013-07-17 22:28:21 -04:00
parent 1385667168
commit 6388005c46
3 changed files with 11 additions and 9 deletions

View File

@ -31,7 +31,6 @@ function! airline#load_theme(name)
let g:airline_theme = a:name
let inactive_colors = g:airline#themes#{g:airline_theme}#inactive "also lazy loads the theme
let w:airline_lastmode = ''
let w:airline_active = 1
call airline#highlight(['inactive'])
call airline#update_highlight()
endfunction
@ -126,8 +125,9 @@ function! airline#update_statusline(active)
let sl.=l:info_sep_color
let sl.=g:airline_left_sep
let sl.=l:status_color.' %<'.s:get_section('c').' '
let sl.=exists('w:airline_section_gutter')
\ ? s:get_section('gutter')
let gutter = get(w:, 'airline_section_gutter', get(g:, 'airline_section_gutter', ''))
let sl.=gutter != ''
\ ? gutter
\ : '%#warningmsg#'.g:airline_externals_syntastic.l:file_flag_color."%{&ro ? g:airline_readonly_symbol : ''}".l:status_color
else
let sl.=l:status_color.' %f%m'
@ -148,7 +148,7 @@ endfunction
let g:airline_current_mode_text = ''
function! airline#update_highlight()
if w:airline_active
if get(w:, 'airline_active', 1)
let l:m = mode()
if l:m ==# "i"
let l:mode = ['insert']
@ -168,7 +168,7 @@ function! airline#update_highlight()
if &paste | call add(l:mode, 'paste') | endif
let mode_string = join(l:mode)
if !exists('w:airline_lastmode') || w:airline_lastmode != mode_string
if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlight(l:mode)
let w:airline_lastmode = mode_string
endif

View File

@ -8,9 +8,9 @@ function! s:override_left_only(section1, section2)
endfunction
function! airline#extensions#clear_window_overrides()
silent! unlet w:airline_left_only
unlet! w:airline_left_only
for section in s:sections
silent! unlet w:airline_section_{section}
unlet! w:airline_section_{section}
endfor
endfunction
@ -29,6 +29,8 @@ function! airline#extensions#apply_window_overrides()
call s:override_left_only('diff', '')
elseif &ft == 'tagbar'
call s:override_left_only('Tagbar', '')
elseif &ft == 'vimshell'
call s:override_left_only('vimshell', vimshell#get_status_string())
elseif &ft == 'minibufexpl'
call s:override_left_only('MiniBufExplorer', '')
endif

View File

@ -121,8 +121,8 @@ separators, as well as the powerline font glyths.
" powerline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_fugitive_prefix = ' '
let g:airline_readonly_symbol = ''
let g:airline_linecolumn_prefix = ' '