Merge pull request #652 from chenaren/venv_fallback
Add simple virtualenv fallback when vim-virtualenv is not presented
This commit is contained in:
commit
15666d71e3
@ -178,7 +178,7 @@ function! airline#extensions#load()
|
|||||||
call airline#extensions#bufferline#init(s:ext)
|
call airline#extensions#bufferline#init(s:ext)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get(g:, 'virtualenv_loaded', 0) && get(g:, 'airline#extensions#virtualenv#enabled', 1)
|
if isdirectory($VIRTUAL_ENV) && get(g:, 'airline#extensions#virtualenv#enabled', 1)
|
||||||
call airline#extensions#virtualenv#init(s:ext)
|
call airline#extensions#virtualenv#init(s:ext)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||||
" vim: et ts=2 sts=2 sw=2
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
if !get(g:, 'virtualenv_loaded', 0)
|
if !isdirectory($VIRTUAL_ENV)
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -13,8 +13,13 @@ endfunction
|
|||||||
|
|
||||||
function! airline#extensions#virtualenv#apply(...)
|
function! airline#extensions#virtualenv#apply(...)
|
||||||
if &filetype =~ "python"
|
if &filetype =~ "python"
|
||||||
|
if get(g:, 'virtualenv_loaded', 0)
|
||||||
|
let statusline = virtualenv#statusline()
|
||||||
|
else
|
||||||
|
let statusline = fnamemodify($VIRTUAL_ENV, ':t')
|
||||||
|
endif
|
||||||
call airline#extensions#append_to_section('x',
|
call airline#extensions#append_to_section('x',
|
||||||
\ s:spc.g:airline_right_alt_sep.s:spc.'%{virtualenv#statusline()}')
|
\ s:spc.g:airline_right_alt_sep.s:spc.statusline)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user