reduce the update frequency of fugitive (#11)

This commit is contained in:
Bailey Ling 2013-07-03 21:05:35 +00:00
parent 9a032ff059
commit 091b152105

View File

@ -87,11 +87,17 @@ function! s:is_excluded_window()
return 0 return 0
endfunction endfunction
function! s:update_externals()
let g:airline_externals_fugitive = g:airline_enable_fugitive && exists('g:loaded_fugitive') ? g:airline_fugitive_prefix.fugitive#head() : ''
let g:airline_externals_syntastic = g:airline_enable_syntastic && exists('g:loaded_syntastic_plugin') ? '%{SyntasticStatuslineFlag()}' : ''
endfunction
function! s:update_statusline(active) function! s:update_statusline(active)
if s:is_excluded_window() if s:is_excluded_window()
return return
endif endif
call s:update_externals()
let l:mode_color = a:active ? "%2*" : "%9*" let l:mode_color = a:active ? "%2*" : "%9*"
let l:mode_sep_color = a:active ? "%3*" : "%9*" let l:mode_sep_color = a:active ? "%3*" : "%9*"
let l:info_color = a:active ? "%4*" : "%9*" let l:info_color = a:active ? "%4*" : "%9*"
@ -101,15 +107,15 @@ function! s:update_statusline(active)
let sl = a:active ? l:mode_color."%{AirlineModePrefix()}".l:mode_sep_color : l:mode_color." NORMAL %9*" let sl = a:active ? l:mode_color."%{AirlineModePrefix()}".l:mode_sep_color : l:mode_color." NORMAL %9*"
let sl.="%{g:airline_left_sep}".l:info_color let sl.="%{g:airline_left_sep}".l:info_color
let sl.="%{g:airline_enable_fugitive&&exists('g:loaded_fugitive')? g:airline_fugitive_prefix.fugitive#head():''}\ " let sl.=g:airline_externals_fugitive
let sl.=l:info_sep_color."%{g:airline_left_sep}" let sl.=' '.l:info_sep_color."%{g:airline_left_sep}"
if a:active if a:active
let sl.=l:status_color.(exists('g:bufferline_loaded')?"\ %{bufferline#generate_string()}\ ":"\ %f%m\ ") let sl.=l:status_color.(exists('g:bufferline_loaded')?"\ %{bufferline#generate_string()}\ ":"\ %f%m\ ")
else else
let sl.=" ".bufname(winbufnr(winnr())) let sl.=" ".bufname(winbufnr(winnr()))
endif endif
let sl.="%#warningmsg#" let sl.="%#warningmsg#"
let sl.="%{g:airline_enable_syntastic&&exists('g:loaded_syntastic_plugin')?SyntasticStatuslineFlag():''}" let sl.=g:airline_externals_syntastic
let sl.=l:status_color."%<%=".l:file_flag_color."%{&ro? g:airline_readonly_symbol :''}" let sl.=l:status_color."%<%=".l:file_flag_color."%{&ro? g:airline_readonly_symbol :''}"
let sl.="%q%{&previewwindow?'[preview]':''}" let sl.="%q%{&previewwindow?'[preview]':''}"
let sl.=l:status_color."\ %{strlen(&filetype)>0?&filetype:''}\ " let sl.=l:status_color."\ %{strlen(&filetype)>0?&filetype:''}\ "