mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-10 05:51:49 +08:00
Merge pull request #180 from joedicastro/master
add virtualenv extension
This commit is contained in:
@@ -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')
|
||||
|
||||
15
autoload/airline/extensions/virtualenv.vim
Normal file
15
autoload/airline/extensions/virtualenv.vim
Normal 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
|
||||
Reference in New Issue
Block a user