From 5582daf79c1678f2527c6bb90af1876ae21afb76 Mon Sep 17 00:00:00 2001 From: xinleibird Date: Tue, 1 Oct 2013 12:42:42 +0800 Subject: [PATCH 1/3] add eclim's checker extension, when eclim is running , it can instead of syntastic --- autoload/airline/deprecation.vim | 1 + autoload/airline/extensions.vim | 7 ++++++- autoload/airline/extensions/eclim.vim | 30 +++++++++++++++++++++++++++ autoload/airline/init.vim | 4 ++-- t/init.vim | 1 + 5 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 autoload/airline/extensions/eclim.vim diff --git a/autoload/airline/deprecation.vim b/autoload/airline/deprecation.vim index a39199c..dd0567f 100644 --- a/autoload/airline/deprecation.vim +++ b/autoload/airline/deprecation.vim @@ -19,6 +19,7 @@ function! airline#deprecation#check() \ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ], \ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ], \ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ], + \ [ 'g:airline_enable_eclim', 'g:airline#extensions#eclim#enabled' ], \ ] for test in tests if exists(test[0]) diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 814318f..166e155 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -181,8 +181,13 @@ function! airline#extensions#load() call airline#extensions#virtualenv#init(s:ext) endif + if (get(g:, 'airline#extensions#eclim#enabled', 1) && get(g:, 'airline_enable_eclim', 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)) - \ && exists(':SyntasticCheck') + \ && exists(':SyntasticCheck') && !exists('g:eclim_instead_syntastic') call airline#extensions#syntastic#init(s:ext) endif diff --git a/autoload/airline/extensions/eclim.vim b/autoload/airline/extensions/eclim.vim new file mode 100644 index 0000000..e3ebe31 --- /dev/null +++ b/autoload/airline/extensions/eclim.vim @@ -0,0 +1,30 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 +"if !exists('g:eclim_instead_syntastic') +"let g:eclim_instead_syntastic = 0 +"endif + +"if g:eclim_instead_syntastic == 1 +"finish +"endif +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 = "[Warring: line:".string(errorsLine)." (".string(errorsNumber).")]" + return errors.(g:airline_symbols.space) + endif + return '' +endfunction + +function! airline#extensions#eclim#init(ext) + if !exists('g:eclim_instead_syntastic') + let g:eclim_instead_syntastic = 1 + endif + call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings') +endfunction diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index f5276d4..98e662e 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -78,7 +78,7 @@ function! airline#init#bootstrap() 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_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 endfunction @@ -107,7 +107,7 @@ function! airline#init#sections() let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c ']) endif 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 endfunction diff --git a/t/init.vim b/t/init.vim index a7d3d2c..86efe58 100644 --- a/t/init.vim +++ b/t/init.vim @@ -62,6 +62,7 @@ describe 'init sections' Expect airline#parts#get('branch').raw == '' Expect airline#parts#get('tagbar').raw == '' Expect airline#parts#get('syntastic').raw == '' + Expect airline#parts#get('eclim').raw == '' Expect airline#parts#get('whitespace').raw == '' end end From 7365ccf3fecea2d913e761da5788fad2cd6e34a2 Mon Sep 17 00:00:00 2001 From: xinleibird Date: Wed, 2 Oct 2013 02:25:43 +0800 Subject: [PATCH 2/3] Add eclim's checker extension, now it conform to the specification --- autoload/airline/extensions.vim | 5 ++--- autoload/airline/extensions/eclim.vim | 15 ++++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 166e155..385fcb6 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -181,13 +181,12 @@ function! airline#extensions#load() call airline#extensions#virtualenv#init(s:ext) endif - if (get(g:, 'airline#extensions#eclim#enabled', 1) && get(g:, 'airline_enable_eclim', 1)) - \ && exists(':ProjectCreate') + 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)) - \ && exists(':SyntasticCheck') && !exists('g:eclim_instead_syntastic') + \ && exists(':SyntasticCheck') call airline#extensions#syntastic#init(s:ext) endif diff --git a/autoload/airline/extensions/eclim.vim b/autoload/airline/extensions/eclim.vim index e3ebe31..c0b5dbe 100644 --- a/autoload/airline/extensions/eclim.vim +++ b/autoload/airline/extensions/eclim.vim @@ -1,12 +1,6 @@ " MIT License. Copyright (c) 2013 Bailey Ling. " vim: et ts=2 sts=2 sw=2 -"if !exists('g:eclim_instead_syntastic') -"let g:eclim_instead_syntastic = 0 -"endif -"if g:eclim_instead_syntastic == 1 -"finish -"endif if !exists(':ProjectCreate') finish endif @@ -16,15 +10,14 @@ function! airline#extensions#eclim#get_warnings() if !empty(eclimList) let errorsLine = eclimList[0]['line'] let errorsNumber = len(eclimList) - let errors = "[Warring: line:".string(errorsLine)." (".string(errorsNumber).")]" - return errors.(g:airline_symbols.space) + let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]" + if SyntasticStatuslineFlag() == '' + return errors.(g:airline_symbols.space) + endif endif return '' endfunction function! airline#extensions#eclim#init(ext) - if !exists('g:eclim_instead_syntastic') - let g:eclim_instead_syntastic = 1 - endif call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings') endfunction From 4eec9cfa91dccf240fdcdb60d6eed0e81552a9db Mon Sep 17 00:00:00 2001 From: xinleibird Date: Wed, 2 Oct 2013 04:19:15 +0800 Subject: [PATCH 3/3] Add eclim extension and update documentation. --- README.md | 12 +++++++++++- autoload/airline/extensions/eclim.vim | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5da2671..ec85b6a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Lean & mean status/tabline 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], [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. * 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. @@ -61,6 +61,15 @@ vim-airline integrates with a variety of plugins out of the box. These extensio #### [syntastic][5] ![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]) ![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 [32]: https://github.com/chriskempson/base16-vim [33]: https://github.com/bling/vim-airline/wiki/Test-Plan +[34]: http://eclim.org diff --git a/autoload/airline/extensions/eclim.vim b/autoload/airline/extensions/eclim.vim index c0b5dbe..99b3f4e 100644 --- a/autoload/airline/extensions/eclim.vim +++ b/autoload/airline/extensions/eclim.vim @@ -11,7 +11,7 @@ function! airline#extensions#eclim#get_warnings() let errorsLine = eclimList[0]['line'] let errorsNumber = len(eclimList) let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]" - if SyntasticStatuslineFlag() == '' + if !exists(':SyntasticStatuslineFlag') || SyntasticStatuslineFlag() == '' return errors.(g:airline_symbols.space) endif endif