diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 2f1f5f2..1f8a919 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -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 diff --git a/autoload/airline/extensions/bufferline.vim b/autoload/airline/extensions/bufferline.vim index c95cdf3..a6b9848 100644 --- a/autoload/airline/extensions/bufferline.vim +++ b/autoload/airline/extensions/bufferline.vim @@ -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') != '' diff --git a/autoload/airline/extensions/commandt.vim b/autoload/airline/extensions/commandt.vim index ac74aff..644cc66 100644 --- a/autoload/airline/extensions/commandt.vim +++ b/autoload/airline/extensions/commandt.vim @@ -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 diff --git a/autoload/airline/extensions/csv.vim b/autoload/airline/extensions/csv.vim index 6f0087c..d669be8 100644 --- a/autoload/airline/extensions/csv.vim +++ b/autoload/airline/extensions/csv.vim @@ -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 = '%=' diff --git a/autoload/airline/extensions/ctrlp.vim b/autoload/airline/extensions/ctrlp.vim index 3744548..8f30e2d 100644 --- a/autoload/airline/extensions/ctrlp.vim +++ b/autoload/airline/extensions/ctrlp.vim @@ -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 + diff --git a/autoload/airline/extensions/example.vim b/autoload/airline/extensions/example.vim index d928120..637f83d 100644 --- a/autoload/airline/extensions/example.vim +++ b/autoload/airline/extensions/example.vim @@ -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" diff --git a/autoload/airline/extensions/iminsert.vim b/autoload/airline/extensions/iminsert.vim index 5357cad..9371016 100644 --- a/autoload/airline/extensions/iminsert.vim +++ b/autoload/airline/extensions/iminsert.vim @@ -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 diff --git a/autoload/airline/extensions/syntastic.vim b/autoload/airline/extensions/syntastic.vim index ff4e6a6..21ec0d8 100644 --- a/autoload/airline/extensions/syntastic.vim +++ b/autoload/airline/extensions/syntastic.vim @@ -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 diff --git a/autoload/airline/extensions/tagbar.vim b/autoload/airline/extensions/tagbar.vim index 66f80ea..3326e49 100644 --- a/autoload/airline/extensions/tagbar.vim +++ b/autoload/airline/extensions/tagbar.vim @@ -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 diff --git a/autoload/airline/extensions/undotree.vim b/autoload/airline/extensions/undotree.vim index b8dfe49..f869d0c 100644 --- a/autoload/airline/extensions/undotree.vim +++ b/autoload/airline/extensions/undotree.vim @@ -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()}') diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index 0e21a42..b108a4b 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -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 diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index c60249e..b63898e 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -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) diff --git a/doc/airline.txt b/doc/airline.txt index a0871f7..995f053 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -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'