mirror of
https://github.com/vim-airline/vim-airline-themes.git
synced 2024-12-03 23:43:45 +08:00
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)
|
||||
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)
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !get(g:, 'virtualenv_loaded', 0)
|
||||
if !isdirectory($VIRTUAL_ENV)
|
||||
finish
|
||||
endif
|
||||
|
||||
|
@ -13,8 +13,13 @@ endfunction
|
|||
|
||||
function! airline#extensions#virtualenv#apply(...)
|
||||
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',
|
||||
\ s:spc.g:airline_right_alt_sep.s:spc.'%{virtualenv#statusline()}')
|
||||
\ s:spc.g:airline_right_alt_sep.s:spc.statusline)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user