Merge pull request #180 from joedicastro/master

add virtualenv extension
This commit is contained in:
Bailey Ling
2013-08-25 08:24:53 -07:00
4 changed files with 31 additions and 2 deletions

View File

@@ -161,6 +161,10 @@ function! airline#extensions#load()
call airline#extensions#bufferline#init(s:ext)
endif
if (get(g:, 'virtualenv_loaded', 1) && get(g:, 'airline#extensions#virtualenv#enabled', 1))
call airline#extensions#virtualenv#init(s:ext)
endif
if g:airline_section_warning == '__'
if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1))
\ && exists(':SyntasticCheck')

View File

@@ -0,0 +1,15 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
function! airline#extensions#virtualenv#init(ext)
call a:ext.add_statusline_func('airline#extensions#virtualenv#apply')
endfunction
function! airline#extensions#virtualenv#apply(...)
if &filetype == "python"
if !exists('w:airline_section_x')
let w:airline_section_x = g:airline_section_x
endif
let w:airline_section_x = '%{virtualenv#statusline()} '.g:airline_right_alt_sep.' '.w:airline_section_x
endif
endfunction