Merge pull request #2046 from dlukes/master

Deduplicate virtualenv identifier sections
This commit is contained in:
Christian Brabandt 2020-01-24 12:48:20 +01:00 committed by GitHub
commit d4502d02a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -277,12 +277,18 @@ function! airline#extensions#load()
call add(s:loaded_ext, 'fugitiveline') call add(s:loaded_ext, 'fugitiveline')
endif endif
if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV))) " NOTE: This means that if both virtualenv and poetv are enabled and
" available, poetv silently takes precedence and the virtualenv
" extension won't be initialized. Since both extensions currently just
" add a virtualenv identifier section to the airline, this seems
" acceptable.
if (get(g:, 'airline#extensions#poetv#enabled', 1) && (exists(':PoetvActivate')))
call airline#extensions#poetv#init(s:ext)
call add(s:loaded_ext, 'poetv')
elseif (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList')))
call airline#extensions#virtualenv#init(s:ext) call airline#extensions#virtualenv#init(s:ext)
call add(s:loaded_ext, 'virtualenv') call add(s:loaded_ext, 'virtualenv')
endif elseif (isdirectory($VIRTUAL_ENV))
if (get(g:, 'airline#extensions#poetv#enabled', 1) && (exists(':PoetvActivate') || isdirectory($VIRTUAL_ENV)))
call airline#extensions#poetv#init(s:ext) call airline#extensions#poetv#init(s:ext)
call add(s:loaded_ext, 'poetv') call add(s:loaded_ext, 'poetv')
endif endif