upgrade all funcrefs to support varargs.

This commit is contained in:
Bailey Ling 2013-08-21 15:14:12 +00:00
parent 47de191a80
commit 8452029e98
13 changed files with 30 additions and 28 deletions

View File

@ -32,7 +32,7 @@ function! airline#extensions#apply_left_override(section1, section2)
endfunction
let s:active_winnr = -1
function! airline#extensions#update_statusline()
function! airline#extensions#update_statusline(...)
let s:active_winnr = winnr()
if &buftype == 'quickfix'
@ -65,7 +65,7 @@ function! airline#extensions#update_statusline()
endfor
endfunction
function! airline#extensions#is_excluded_window()
function! airline#extensions#is_excluded_window(...)
for matchft in g:airline_exclude_filetypes
if matchft ==# &ft
return 1
@ -165,7 +165,7 @@ function! airline#extensions#load()
endif
if (get(g:, 'airline#extensions#whitespace#enabled', 1) && get(g:, 'airline_detect_whitespace', 1))
call airline#extensions#whitespace#init()
call airline#extensions#whitespace#init(s:ext)
endif
endif

View File

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" vim: et ts=2 sts=2 sw=2
function! airline#extensions#bufferline#apply()
function! airline#extensions#bufferline#apply(...)
" revert to default in non-active splits
for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
if matchstr(getwinvar(nr, '&statusline'), '%{bufferline') != ''

View File

@ -1,7 +1,7 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
function! airline#extensions#commandt#apply()
function! airline#extensions#commandt#apply(...)
if bufname('%') ==# 'GoToFile'
call airline#extensions#apply_left_override('CommandT', '')
endif

View File

@ -14,7 +14,7 @@ function! airline#extensions#csv#get_column()
return ''
endfunction
function! airline#extensions#csv#apply()
function! airline#extensions#csv#apply(...)
if &ft ==# "csv"
if !exists('w:airline_section_gutter')
let w:airline_section_gutter = '%='

View File

@ -1,5 +1,5 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
let s:color_template = get(g:, 'airline#extensions#ctrlp#color_template', 'insert')
@ -49,7 +49,7 @@ function! airline#extensions#ctrlp#ctrlp_airline_status(...)
return len.dir
endfunction
function! airline#extensions#ctrlp#is_statusline_overwritten()
function! airline#extensions#ctrlp#is_statusline_overwritten(...)
return match(&statusline, 'CtrlPlight') >= 0
endfunction
@ -60,3 +60,4 @@ function! airline#extensions#ctrlp#init(ext)
\ }
call a:ext.add_cursormove_funcref(function('airline#extensions#ctrlp#is_statusline_overwritten'))
endfunction

View File

@ -1,5 +1,5 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" vim: et ts=2 sts=2 sw=2
" Extension specific variables can be defined the usual fashion.
if !exists('g:airline#extensions#example#number_of_cats')
@ -23,7 +23,7 @@ function! airline#extensions#example#init(ext)
let g:airline_section_y .= '%{airline#extensions#example#nyancat()}'
endfunction
function! airline#extensions#example#apply()
function! airline#extensions#example#apply(...)
" Here we are checking for the filetype, allowing for the extension to
" be loaded only in certain cases.
if &filetype == "nyancat"

View File

@ -1,5 +1,5 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
function! airline#extensions#iminsert#get_text()
if &iminsert

View File

@ -1,7 +1,8 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
function! airline#extensions#syntastic#apply()
function! airline#extensions#syntastic#apply(...)
let w:airline_section_warning = get(w:, 'airline_section_warning', '')
let w:airline_section_warning = ' %{SyntasticStatuslineFlag()}'
endfunction

View File

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" vim: et ts=2 sts=2 sw=2
function! airline#extensions#tagbar#apply()
function! airline#extensions#tagbar#apply(...)
if &ft == 'tagbar'
call airline#extensions#apply_left_override('Tagbar', '%{TagbarGenerateStatusline()}')
endif

View File

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
function! airline#extensions#undotree#apply()
function! airline#extensions#undotree#apply(...)
if exists('t:undotree')
if &ft == 'undotree' && exists('*t:undotree.GetStatusLine')
call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}')

View File

@ -1,5 +1,5 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" vim: et ts=2 sts=2 sw=2
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
@ -53,7 +53,7 @@ function! airline#extensions#whitespace#check()
return b:airline_whitespace_check
endfunction!
function! airline#extensions#whitespace#apply()
function! airline#extensions#whitespace#apply(...)
if !exists('w:airline_section_warning')
let w:airline_section_warning = ' '
endif
@ -70,10 +70,10 @@ function! airline#extensions#whitespace#toggle()
endif
endfunction
function! airline#extensions#whitespace#init()
function! airline#extensions#whitespace#init(ext)
if !s:initialized
let s:initialized = 1
call add(g:airline_statusline_funcrefs, function('airline#extensions#whitespace#apply'))
call a:ext.add_statusline_funcref(function('airline#extensions#whitespace#apply'))
endif
unlet! b:airline_whitespace_check

View File

@ -13,7 +13,7 @@ else
endif
if v:version >= 704
function! airline#util#exec_funcrefs(list, break_early)
function! airline#util#exec_funcrefs(list, break_early, ...)
for Fn in a:list
if a:break_early
if Fn()
@ -25,7 +25,7 @@ if v:version >= 704
endfor
endfunction
else
function! airline#util#exec_funcrefs(list, break_early)
function! airline#util#exec_funcrefs(list, break_early, ...)
" for 7.2; we cannot iterate the list, hence why we use range()
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {}
for i in range(0, len(a:list) - 1)

View File

@ -104,7 +104,7 @@ COMMANDS *airline-commands*
Toggles whitespace detection.
:AirlineToggle *:AirlineToggle*
Toggles between the standard `statusline` or airline.
Toggles between the standard `statusline`
==============================================================================
CUSTOMIZATION *airline-customization*
@ -249,7 +249,7 @@ The g:airline_statusline_funcrefs variable is an array of funcrefs that get
invoked before the statusline gets overwritten for each window. The following
is an example of how you can extend vim-airline to support a new plugin.
>
function! MyPlugin()
function! MyPlugin(...)
if &filetype == 'MyPluginFileType'
let w:airline_section_a = 'MyPlugin'
let w:airline_section_b = '%f'