define the rest of the extensions.

This commit is contained in:
Bailey Ling 2013-08-30 22:07:45 +00:00
parent 19910a26cb
commit c6d996d5ca
6 changed files with 6 additions and 16 deletions

View File

@ -11,7 +11,7 @@ function! airline#extensions#example#init(ext)
" Here we define a new part for the plugin. This allows users to place this
" extension in arbitrary locations.
let g:airline_parts.cats = '%{airline#extensions#example#get_cats()}'
call airline#parts#define_raw('cats', '%{airline#extensions#example#get_cats()}')
" Next up we add a funcref so that we can run some code prior to the
" statusline getting modifed.
@ -28,7 +28,7 @@ function! airline#extensions#example#apply(...)
" Let's use a helper function. It will take care of ensuring that the
" window-local override exists (and create one based on the global
" airline_section if not), and prepend to it.
call airline#extensions#prepend_to_section('x', g:airline_parts.cats)
call airline#extensions#prepend_to_section('x', airline#parts#get('cats').raw)
endif
endfunction

View File

@ -10,6 +10,6 @@ function! airline#extensions#syntastic#get_warnings()
endfunction
function! airline#extensions#syntastic#init(ext)
let g:airline_parts.syntastic = '%{airline#extensions#syntastic#get_warnings()}'
call airline#parts#define_function('syntastic', 'airline#extensions#syntastic#get_warnings')
endfunction

View File

@ -27,6 +27,6 @@ function! airline#extensions#tagbar#init(ext)
call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply')
let g:tagbar_status_func = 'airline#extensions#tagbar#get_status'
let g:airline_parts.tagbar = 'airline#extensions#tagbar#currenttag'
call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag')
endfunction

View File

@ -65,7 +65,7 @@ function! airline#extensions#whitespace#toggle()
endfunction
function! airline#extensions#whitespace#init(...)
let g:airline_parts.whitespace = '%{airline#extensions#whitespace#check()}'
call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check')
unlet! b:airline_whitespace_check
augroup airline_whitespace

View File

@ -37,14 +37,7 @@ function! airline#init#bootstrap()
\ 'highlight': 'airline_file',
\ })
call airline#parts#define_raw('file', '%f%m')
call s:check_defined('g:airline_parts', {})
call extend(g:airline_parts, {
\ 'ffenc': '%{printf("%s%s",&fenc,strlen(&ff)>0?"[".&ff."]":"")}',
\ 'tagbar': 'airline#parts#empty',
\ 'syntastic': 'airline#parts#empty',
\ 'whitespace': 'airline#parts#empty',
\ }, 'keep')
call airline#parts#define_raw('ffenc', '%{printf("%s%s",&fenc,strlen(&ff)>0?"[".&ff."]":"")}')
call s:check_defined('g:airline_mode_map', {})
call extend(g:airline_mode_map, {

View File

@ -388,9 +388,6 @@ For contributions into the plugin, here are the following guidelines:
b. Configuration variables for the extension should reside in the
extension, e.g. `g:airline#extensions#foo_plugin#bar_variable`.
c. A value should be added to the `g:airline_parts` dictionary such that
the extension can be arbitrarily positioned.
See the source of |example.vim| for a working extension.
==============================================================================