add virtualenv extension

This commit is contained in:
joe di castro 2013-08-24 22:49:54 +02:00
parent c98549913c
commit f0df8825df
4 changed files with 29 additions and 2 deletions

View File

@ -7,7 +7,7 @@ Lean & mean statusline for vim that's light as air.
# Features
* tiny core written with extensibility in mind ([open/closed principle][8]).
* integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [syntastic][5] and [lawrencium][21].
* integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [syntastic][5], [lawrencium][21] and [virtualenv][31]
* looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
* optimized for speed; it loads in under a millisecond.
* extensive suite of themes for popular colorschemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki.
@ -48,6 +48,9 @@ vim-airline provides seamless integration with a variety of plugins. These exte
### hunks ([vim-gitgutter][29] & [vim-signify][30])
![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png)
### [virtualenv][31]
![image](https://f.cloud.github.com/assets/390964/1021386/73ed49e4-0cfc-11e3-96df-8d5084cde7da.png)
# Rationale
There's already [powerline][2], why yet another statusline?
@ -151,3 +154,4 @@ MIT license. Copyright (c) 2013 Bailey Ling.
[28]: https://github.com/chrisbra/csv.vim
[29]: https://github.com/airblade/vim-gitgutter
[30]: https://github.com/mhinz/vim-signify
[31]: https://github.com/jmcantrell/vim-virtualenv

View File

@ -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_enable_virtualenv', 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')

View File

@ -0,0 +1,13 @@
" 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"
let w:airline_section_x = '%{virtualenv#statusline()} '.g:airline_section_x
endif
endfunction

View File

@ -169,7 +169,7 @@ extension.
let g:airline_section_b (the fugitive/lawrencium branch indicator)
let g:airline_section_c (bufferline or filename)
let g:airline_section_gutter (readonly, csv)
let g:airline_section_x (tagbar, filetype)
let g:airline_section_x (tagbar, virtualenv, filetype)
let g:airline_section_y (fileencoding, fileformat)
let g:airline_section_z (percentage, line number, column number)
let g:airline_section_warning (syntastic, whitespace)
@ -253,6 +253,12 @@ ctrlp <https://github.com/kien/ctrlp.vim>
let g:airline#extensions#ctrlp#color_template = 'visual'
let g:airline#extensions#ctrlp#color_template = 'replace'
<
*airline-virtualenv*
virtualenv <https://github.com/jmcantrell/vim-virtualenv>
* enable/disable virtualenv integration >
let g:airline#extensions#virtualenv#enabled = 1
==============================================================================
FUNCREFS *airline-funcrefs*