Merge pull request #293 from xinleibird/eclim

add eclim's checker extension
This commit is contained in:
Bailey Ling 2013-10-01 13:30:05 -07:00
commit 6fc15ff321
6 changed files with 42 additions and 3 deletions

View File

@ -7,7 +7,7 @@ Lean & mean status/tabline for vim that's light as air.
# Features # Features
* Tiny core written with extensibility in mind ([open/closed principle][8]). * 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], [lawrencium][21] and [virtualenv][31]. * 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], [eclim][34], [lawrencium][21] and [virtualenv][31].
* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols. * 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. * 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), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki. * Extensive suite of themes for popular colorschemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki.
@ -61,6 +61,15 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
#### [syntastic][5] #### [syntastic][5]
![image](https://f.cloud.github.com/assets/306502/962864/9824c484-04f7-11e3-9928-da94f8c7da5a.png) ![image](https://f.cloud.github.com/assets/306502/962864/9824c484-04f7-11e3-9928-da94f8c7da5a.png)
#### [eclim][34]
*eclim* 's syntax checker extension works well with *syntastic* 's extension.
* By default, it turned on when *eclim* was installed.
* When you installed *eclim* but want to turn off this extension, add next line in your vimrc:
let g:airline#extensions#eclim#enabled = 0
#### hunks ([vim-gitgutter][29] & [vim-signify][30]) #### hunks ([vim-gitgutter][29] & [vim-signify][30])
![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png) ![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png)
@ -196,3 +205,4 @@ MIT License. Copyright (c) 2013 Bailey Ling.
[31]: https://github.com/jmcantrell/vim-virtualenv [31]: https://github.com/jmcantrell/vim-virtualenv
[32]: https://github.com/chriskempson/base16-vim [32]: https://github.com/chriskempson/base16-vim
[33]: https://github.com/bling/vim-airline/wiki/Test-Plan [33]: https://github.com/bling/vim-airline/wiki/Test-Plan
[34]: http://eclim.org

View File

@ -19,6 +19,7 @@ function! airline#deprecation#check()
\ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ], \ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ],
\ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ], \ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ],
\ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ], \ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ],
\ [ 'g:airline_enable_eclim', 'g:airline#extensions#eclim#enabled' ],
\ ] \ ]
for test in tests for test in tests
if exists(test[0]) if exists(test[0])

View File

@ -181,6 +181,10 @@ function! airline#extensions#load()
call airline#extensions#virtualenv#init(s:ext) call airline#extensions#virtualenv#init(s:ext)
endif endif
if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate'))
call airline#extensions#eclim#init(s:ext)
endif
if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1)) if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1))
\ && exists(':SyntasticCheck') \ && exists(':SyntasticCheck')
call airline#extensions#syntastic#init(s:ext) call airline#extensions#syntastic#init(s:ext)

View File

@ -0,0 +1,23 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
if !exists(':ProjectCreate')
finish
endif
function! airline#extensions#eclim#get_warnings()
let eclimList = eclim#display#signs#GetExisting()
if !empty(eclimList)
let errorsLine = eclimList[0]['line']
let errorsNumber = len(eclimList)
let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]"
if !exists(':SyntasticStatuslineFlag') || SyntasticStatuslineFlag() == ''
return errors.(g:airline_symbols.space)
endif
endif
return ''
endfunction
function! airline#extensions#eclim#init(ext)
call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings')
endfunction

View File

@ -78,7 +78,7 @@ function! airline#init#bootstrap()
call airline#parts#define_raw('file', '%f%m') call airline#parts#define_raw('file', '%f%m')
call airline#parts#define_raw('linenr', (g:airline_symbols.linenr).'%#__accent_bold#%4l%#__restore__#') call airline#parts#define_raw('linenr', (g:airline_symbols.linenr).'%#__accent_bold#%4l%#__restore__#')
call airline#parts#define_function('ffenc', 'airline#parts#ffenc') call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'whitespace']) call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace'])
unlet g:airline#init#bootstrapping unlet g:airline#init#bootstrapping
endfunction endfunction
@ -107,7 +107,7 @@ function! airline#init#sections()
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c ']) let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c '])
endif endif
if !exists('g:airline_section_warning') if !exists('g:airline_section_warning')
let g:airline_section_warning = airline#section#create(['syntastic', 'whitespace']) let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace'])
endif endif
endfunction endfunction

View File

@ -62,6 +62,7 @@ describe 'init sections'
Expect airline#parts#get('branch').raw == '' Expect airline#parts#get('branch').raw == ''
Expect airline#parts#get('tagbar').raw == '' Expect airline#parts#get('tagbar').raw == ''
Expect airline#parts#get('syntastic').raw == '' Expect airline#parts#get('syntastic').raw == ''
Expect airline#parts#get('eclim').raw == ''
Expect airline#parts#get('whitespace').raw == '' Expect airline#parts#get('whitespace').raw == ''
end end
end end