2013-09-02 14:55:15 -04:00
|
|
|
let g:airline_theme = 'dark'
|
2013-08-31 12:03:39 -04:00
|
|
|
call airline#init#bootstrap()
|
2013-08-31 17:42:09 -04:00
|
|
|
call airline#init#sections()
|
2013-08-31 19:51:55 -04:00
|
|
|
source plugin/airline.vim
|
2013-08-31 12:03:39 -04:00
|
|
|
|
|
|
|
function! MyFuncref(...)
|
|
|
|
call a:1.add_raw('hello world')
|
|
|
|
return 1
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! MyIgnoreFuncref(...)
|
|
|
|
return -1
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! MyAppend1(...)
|
|
|
|
call a:1.add_raw('hello')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! MyAppend2(...)
|
|
|
|
call a:1.add_raw('world')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
describe 'airline'
|
|
|
|
before
|
|
|
|
let g:airline_statusline_funcrefs = []
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should run user funcrefs first'
|
|
|
|
call airline#add_statusline_func('MyFuncref')
|
|
|
|
let &statusline = ''
|
|
|
|
call airline#update_statusline()
|
2013-09-02 14:55:15 -04:00
|
|
|
Expect airline#statusline(1) =~ 'hello world'
|
2013-08-31 12:03:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not change the statusline with -1'
|
|
|
|
call airline#add_statusline_funcref(function('MyIgnoreFuncref'))
|
|
|
|
let &statusline = 'foo'
|
|
|
|
call airline#update_statusline()
|
|
|
|
Expect &statusline == 'foo'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should support multiple chained funcrefs'
|
|
|
|
call airline#add_statusline_func('MyAppend1')
|
|
|
|
call airline#add_statusline_func('MyAppend2')
|
|
|
|
call airline#update_statusline()
|
2013-09-02 14:55:15 -04:00
|
|
|
Expect airline#statusline(1) =~ 'helloworld'
|
2013-08-31 12:03:39 -04:00
|
|
|
end
|
2013-08-31 12:57:02 -04:00
|
|
|
|
|
|
|
it 'should allow users to redefine sections'
|
|
|
|
let g:airline_section_a = airline#section#create(['mode', 'mode'])
|
|
|
|
call airline#update_statusline()
|
2013-09-02 14:55:15 -04:00
|
|
|
Expect airline#statusline(1) =~ '%{airline#util#wrap(airline#parts#mode(),0)}%{airline#util#wrap(airline#parts#mode(),0)}'
|
2013-08-31 12:57:02 -04:00
|
|
|
end
|
2013-08-31 16:28:33 -04:00
|
|
|
|
|
|
|
it 'should remove funcrefs properly'
|
|
|
|
let c = len(g:airline_statusline_funcrefs)
|
|
|
|
call airline#add_statusline_func('MyIgnoreFuncref')
|
|
|
|
call airline#remove_statusline_func('MyIgnoreFuncref')
|
|
|
|
Expect len(g:airline_statusline_funcrefs) == c
|
|
|
|
end
|
2013-08-31 19:51:55 -04:00
|
|
|
|
|
|
|
it 'should overwrite the statusline with active and inactive splits'
|
|
|
|
wincmd s
|
2013-09-02 14:55:15 -04:00
|
|
|
Expect airline#statusline(1) !~ 'inactive'
|
|
|
|
Expect airline#statusline(2) =~ 'inactive'
|
2013-08-31 19:51:55 -04:00
|
|
|
wincmd c
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should collapse the inactive split if the variable is set true'
|
|
|
|
let g:airline_inactive_collapse = 1
|
|
|
|
wincmd s
|
|
|
|
Expect getwinvar(2, '&statusline') !~ 'airline#parts#mode'
|
|
|
|
wincmd c
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not collapse the inactive split if the variable is set false'
|
|
|
|
let g:airline_inactive_collapse = 0
|
|
|
|
wincmd s
|
|
|
|
Expect getwinvar(2, '&statusline') != 'airline#parts#mode'
|
|
|
|
wincmd c
|
|
|
|
end
|
2013-09-04 11:25:55 -04:00
|
|
|
|
|
|
|
it 'should include check_mode'
|
|
|
|
Expect airline#statusline(1) =~ 'airline#check_mode'
|
|
|
|
end
|
2013-08-31 12:03:39 -04:00
|
|
|
end
|
|
|
|
|