move part declarations back into init.

This commit is contained in:
Bailey Ling 2013-08-31 22:48:27 -04:00
parent c908d03cc0
commit 69f40d62ee
3 changed files with 20 additions and 16 deletions

View File

@ -55,6 +55,17 @@ function! airline#init#bootstrap()
\ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ''), \ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ''),
\ }, 'keep') \ }, 'keep')
call airline#parts#define_function('mode', 'airline#parts#mode')
call airline#parts#define_function('iminsert', 'airline#parts#iminsert')
call airline#parts#define_function('paste', 'airline#parts#paste')
call airline#parts#define('readonly', {
\ 'function': 'airline#parts#readonly',
\ 'highlight': 'airline_file',
\ })
call airline#parts#define_raw('file', '%f%m')
call airline#parts#define_raw('ffenc', '%{printf("%s%s",&fenc,strlen(&ff)>0?"[".&ff."]":"")}')
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic'])
call airline#extensions#load() call airline#extensions#load()
endfunction endfunction

View File

@ -57,15 +57,3 @@ function! airline#parts#readonly()
return &readonly ? g:airline_symbols.readonly : '' return &readonly ? g:airline_symbols.readonly : ''
endfunction endfunction
call airline#parts#define_function('mode', 'airline#parts#mode')
call airline#parts#define_function('iminsert', 'airline#parts#iminsert')
call airline#parts#define_function('paste', 'airline#parts#paste')
call airline#parts#define('readonly', {
\ 'function': 'airline#parts#readonly',
\ 'highlight': 'airline_file',
\ })
call airline#parts#define_raw('file', '%f%m')
call airline#parts#define_raw('ffenc', '%{printf("%s%s",&fenc,strlen(&ff)>0?"[".&ff."]":"")}')
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic'])

View File

@ -8,10 +8,6 @@ describe 'section'
call airline#parts#define_text('text', 'text') call airline#parts#define_text('text', 'text')
call airline#parts#define_raw('raw', 'raw') call airline#parts#define_raw('raw', 'raw')
call airline#parts#define_function('func', 'SectionSpec') call airline#parts#define_function('func', 'SectionSpec')
call airline#parts#define('hi', {
\ 'raw': 'hello',
\ 'highlight': 'hlgroup',
\ })
end end
it 'should create sections with no separators' it 'should create sections with no separators'
@ -30,6 +26,10 @@ describe 'section'
end end
it 'should prefix with highlight group if provided' it 'should prefix with highlight group if provided'
call airline#parts#define('hi', {
\ 'raw': 'hello',
\ 'highlight': 'hlgroup',
\ })
let s = airline#section#create(['hi']) let s = airline#section#create(['hi'])
Expect s == '%#hlgroup#hello' Expect s == '%#hlgroup#hello'
end end
@ -38,5 +38,10 @@ describe 'section'
let s = airline#section#create(['whitespace']) let s = airline#section#create(['whitespace'])
Expect s =~ 'airline#extensions#whitespace#check' Expect s =~ 'airline#extensions#whitespace#check'
end end
it 'should use parts as is if they are not found'
let s = airline#section#create(['asdf', 'func'])
Expect s == 'asdf%{airline#util#wrap(SectionSpec(),0)}'
end
end end