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 endfunction
let s:active_winnr = -1 let s:active_winnr = -1
function! airline#extensions#update_statusline() function! airline#extensions#update_statusline(...)
let s:active_winnr = winnr() let s:active_winnr = winnr()
if &buftype == 'quickfix' if &buftype == 'quickfix'
@ -65,7 +65,7 @@ function! airline#extensions#update_statusline()
endfor endfor
endfunction endfunction
function! airline#extensions#is_excluded_window() function! airline#extensions#is_excluded_window(...)
for matchft in g:airline_exclude_filetypes for matchft in g:airline_exclude_filetypes
if matchft ==# &ft if matchft ==# &ft
return 1 return 1
@ -165,7 +165,7 @@ function! airline#extensions#load()
endif endif
if (get(g:, 'airline#extensions#whitespace#enabled', 1) && get(g:, 'airline_detect_whitespace', 1)) 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
endif endif

View File

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013 Bailey Ling. " 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 " revert to default in non-active splits
for nr in filter(range(1, winnr('$')), 'v:val != winnr()') for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
if matchstr(getwinvar(nr, '&statusline'), '%{bufferline') != '' if matchstr(getwinvar(nr, '&statusline'), '%{bufferline') != ''

View File

@ -1,7 +1,7 @@
" MIT license. Copyright (c) 2013 Bailey Ling. " 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#commandt#apply() function! airline#extensions#commandt#apply(...)
if bufname('%') ==# 'GoToFile' if bufname('%') ==# 'GoToFile'
call airline#extensions#apply_left_override('CommandT', '') call airline#extensions#apply_left_override('CommandT', '')
endif endif

View File

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

View File

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

View File

@ -1,5 +1,5 @@
" MIT License. Copyright (c) 2013 Bailey Ling. " 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. " Extension specific variables can be defined the usual fashion.
if !exists('g:airline#extensions#example#number_of_cats') 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()}' let g:airline_section_y .= '%{airline#extensions#example#nyancat()}'
endfunction endfunction
function! airline#extensions#example#apply() function! airline#extensions#example#apply(...)
" Here we are checking for the filetype, allowing for the extension to " Here we are checking for the filetype, allowing for the extension to
" be loaded only in certain cases. " be loaded only in certain cases.
if &filetype == "nyancat" if &filetype == "nyancat"

View File

@ -1,5 +1,5 @@
" MIT license. Copyright (c) 2013 Bailey Ling. " 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#iminsert#get_text() function! airline#extensions#iminsert#get_text()
if &iminsert if &iminsert

View File

@ -1,7 +1,8 @@
" MIT License. Copyright (c) 2013 Bailey Ling. " MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " 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()}' let w:airline_section_warning = ' %{SyntasticStatuslineFlag()}'
endfunction endfunction

View File

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013 Bailey Ling. " 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' if &ft == 'tagbar'
call airline#extensions#apply_left_override('Tagbar', '%{TagbarGenerateStatusline()}') call airline#extensions#apply_left_override('Tagbar', '%{TagbarGenerateStatusline()}')
endif endif

View File

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013 Bailey Ling. " MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
function! airline#extensions#undotree#apply() function! airline#extensions#undotree#apply(...)
if exists('t:undotree') if exists('t:undotree')
if &ft == 'undotree' && exists('*t:undotree.GetStatusLine') if &ft == 'undotree' && exists('*t:undotree.GetStatusLine')
call airline#extensions#apply_left_override('undo', '%{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. " 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 " 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 return b:airline_whitespace_check
endfunction! endfunction!
function! airline#extensions#whitespace#apply() function! airline#extensions#whitespace#apply(...)
if !exists('w:airline_section_warning') if !exists('w:airline_section_warning')
let w:airline_section_warning = ' ' let w:airline_section_warning = ' '
endif endif
@ -70,10 +70,10 @@ function! airline#extensions#whitespace#toggle()
endif endif
endfunction endfunction
function! airline#extensions#whitespace#init() function! airline#extensions#whitespace#init(ext)
if !s:initialized if !s:initialized
let s:initialized = 1 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 endif
unlet! b:airline_whitespace_check unlet! b:airline_whitespace_check

View File

@ -13,7 +13,7 @@ else
endif endif
if v:version >= 704 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 for Fn in a:list
if a:break_early if a:break_early
if Fn() if Fn()
@ -25,7 +25,7 @@ if v:version >= 704
endfor endfor
endfunction endfunction
else 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.2; we cannot iterate the list, hence why we use range()
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {} " for 7.3-[97, 328]; we cannot reuse the variable, hence the {}
for i in range(0, len(a:list) - 1) for i in range(0, len(a:list) - 1)

View File

@ -104,7 +104,7 @@ COMMANDS *airline-commands*
Toggles whitespace detection. Toggles whitespace detection.
:AirlineToggle *:AirlineToggle* :AirlineToggle *:AirlineToggle*
Toggles between the standard `statusline` or airline. Toggles between the standard `statusline`
============================================================================== ==============================================================================
CUSTOMIZATION *airline-customization* 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 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. is an example of how you can extend vim-airline to support a new plugin.
> >
function! MyPlugin() function! MyPlugin(...)
if &filetype == 'MyPluginFileType' if &filetype == 'MyPluginFileType'
let w:airline_section_a = 'MyPlugin' let w:airline_section_a = 'MyPlugin'
let w:airline_section_b = '%f' let w:airline_section_b = '%f'