mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 14:49:06 +08:00
virtualenv: Enable for additional filetypes beside python
So with https://github.com/jmcantrell/vim-virtualenv you can display the virtualenv in your statusline section (if you have enabled it). However it would only become active for python buffers. Now perhaps you want to show the virtualenv also in other filetypes like markdown or CI scripts, so allow this by adding a variable `airline#extensions#virtualenv#ft'` to the list of filetypes you want to have enabled. So set: let g:airline#extensions#virtualenv#enabled = 1 let g:airline#extensions#virtualenv#ft = ['python', 'markdown'] To allow displaying the virtual environment for python and markdown buffers (but remember you need to have the plugin https://github.com/jmcantrell/vim-virtualenv installed as well!) fixes #2483
This commit is contained in:
parent
8e36c0a8ed
commit
bf5d785932
|
@ -11,7 +11,7 @@ function! airline#extensions#virtualenv#init(ext)
|
|||
endfunction
|
||||
|
||||
function! airline#extensions#virtualenv#apply(...)
|
||||
if &filetype =~# "python"
|
||||
if match(get(g:, 'airline#extensions#virtualenv#ft', ['python']), &filetype) > -1
|
||||
if get(g:, 'virtualenv_loaded', 0)
|
||||
let statusline = virtualenv#statusline()
|
||||
else
|
||||
|
@ -25,7 +25,7 @@ function! airline#extensions#virtualenv#apply(...)
|
|||
endfunction
|
||||
|
||||
function! airline#extensions#virtualenv#update()
|
||||
if &filetype =~# "python"
|
||||
if match(get(g:, 'airline#extensions#virtualenv#ft', ['python']), &filetype) > -1
|
||||
call airline#extensions#virtualenv#apply()
|
||||
call airline#update_statusline()
|
||||
endif
|
||||
|
|
|
@ -1538,6 +1538,10 @@ virtualenv <https://github.com/jmcantrell/vim-virtualenv>
|
|||
* enable/disable virtualenv integration >
|
||||
let g:airline#extensions#virtualenv#enabled = 1
|
||||
<
|
||||
* enable virtualenv for additional filetypes:
|
||||
(default: python): >
|
||||
let g:airline#extensions#virtualenv#ft = ['python', 'markdown']
|
||||
<
|
||||
------------------------------------- *airline-vista*
|
||||
vista.vim <https://github.com/liuchengxu/vista.vim>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user