extract all plugin related functionality out of the core

This commit is contained in:
Bailey Ling
2013-08-06 03:34:45 +00:00
parent 98f3d13705
commit ac211a58eb
5 changed files with 39 additions and 33 deletions

View File

@@ -57,9 +57,7 @@ call s:check_defined('g:airline_section_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen
call s:check_defined('g:airline_section_z', '%3p%% '.g:airline_linecolumn_prefix.'%3l:%3c')
let s:airline_initialized = 0
let s:active_winnr = -1
function! s:on_window_changed()
let s:active_winnr = winnr()
if !s:airline_initialized
call airline#extensions#load()
call airline#load_theme(g:airline_theme)
@@ -68,17 +66,6 @@ function! s:on_window_changed()
call airline#update_statusline()
endfunction
" non-trivial number of external plugins use eventignore=all, so we need to account for that
function! s:sync_active_winnr()
if winnr() != s:active_winnr
" prevent ctrlp statusline from getting overwritten
if get(g:, 'loaded_ctrlp', 0) && match(&statusline, 'CtrlPlight') >= 0
return
endif
call s:on_window_changed()
endif
endfunction
function! s:get_airline_themes(a, l, p)
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n")
return map(files, 'fnamemodify(v:val, ":t:r")')
@@ -97,5 +84,4 @@ augroup airline
autocmd ColorScheme * call airline#highlight(['normal'])
autocmd WinEnter,BufWinEnter,FileType,BufUnload,ShellCmdPost *
\ call <sid>on_window_changed()
autocmd CursorMoved * call <sid>sync_active_winnr()
augroup END