From 94895de8e2c61a514d57ecf696a72a7879cd393d Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Sat, 3 Aug 2013 11:14:02 -0400 Subject: [PATCH] rename window_override_funcrefs to statusline_funcrefs --- autoload/airline.vim | 2 +- autoload/airline/extensions.vim | 6 +++--- doc/airline.txt | 23 ++++++++++++++++------- plugin/airline.vim | 5 ++++- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/autoload/airline.vim b/autoload/airline.vim index 48af180b..b2124061 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -117,7 +117,7 @@ function! airline#update_statusline() for section in s:sections unlet! w:airline_section_{section} endfor - for Fn in g:airline_window_override_funcrefs + for Fn in g:airline_statusline_funcrefs call Fn() endfor diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 995b92fe..775d4b37 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -111,7 +111,7 @@ function! airline#extensions#load() endif if get(g:, 'command_t_loaded', 0) - call add(g:airline_window_override_funcrefs, function('airline#extensions#commandt#apply_window_override')) + call add(g:airline_statusline_funcrefs, function('airline#extensions#commandt#apply_window_override')) endif if g:airline_enable_bufferline && get(g:, 'loaded_bufferline', 0) @@ -124,8 +124,8 @@ function! airline#extensions#load() let g:bufferline_separator = ' ' endif - call add(g:airline_window_override_funcrefs, function('airline#extensions#update_external_values')) - call add(g:airline_window_override_funcrefs, function('airline#extensions#apply_window_overrides')) + call add(g:airline_statusline_funcrefs, function('airline#extensions#update_external_values')) + call add(g:airline_statusline_funcrefs, function('airline#extensions#apply_window_overrides')) call add(g:airline_exclude_funcrefs, function('airline#extensions#is_excluded_window')) call airline#extensions#update_external_values() diff --git a/doc/airline.txt b/doc/airline.txt index 3bbee442..3dcce4fd 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -169,22 +169,31 @@ with the usual statusline syntax. let g:airline_section_c = '%t' < -If there is a particular plugin or filetype that is not supported, you can -extend it by adding a function reference to the global array. Here is an -example that you could add to your vimrc: +============================================================================== +FUNCREFS *airline-funcrefs* + +vim-airline internally uses funcrefs to integrate with third party plugins, +and you can tap into this functionality to extend it for you needs. + + *g:airline_statusline_funcrefs* +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() if &filetype == 'MyPluginFileType' let w:airline_section_a = 'MyPlugin' let w:airline_section_b = '%f' let w:airline_section_c = '%{MyPlugin#function()}' + let g:airline_variable_referenced_in_statusline = 'foo' endif endfunction - call add(g:airline_window_override_funcrefs, function('MyPlugin')) + call add(g:airline_statusline_funcrefs, function('MyPlugin')) < - -In a similar fashion, you can define a function to exclude a window from -having its statusline modified. + *g:airline_exclude_funcrefs* +The g:airline_exclude_funcrefs variable is an array that's returns 1 or 0 to +determine whether that particular window should be excluded from having its +statusline modified. Here is an example: > function! ExcludeFoo() return &filetype == 'FooType' diff --git a/plugin/airline.vim b/plugin/airline.vim index 4f92ce02..578d002b 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -13,6 +13,9 @@ endfunction if exists('g:airline_enable_fugitive') || exists('g:airline_fugitive_prefix') echom 'The g:airline_enable_fugitive and g:airline_fugitive_prefix variables have been deprecated and renamed to g:airline_enable_branch and g:airline_branch_prefix respectively. Please update your vimrc.' endif +if exists('g:airline_window_override_funcrefs') + echom 'The g:airline_window_override_funcrefs variable has been deprecated. Please use g:airline_statusline_funcrefs instead.' +endif call s:check_defined('g:airline_left_sep', exists('g:airline_powerline_fonts')?"":">") call s:check_defined('g:airline_left_alt_sep', exists('g:airline_powerline_fonts')?"":">") call s:check_defined('g:airline_right_sep', exists('g:airline_powerline_fonts')?"":"<") @@ -32,7 +35,7 @@ call s:check_defined('g:airline_theme', 'dark') call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus']) call s:check_defined('g:airline_exclude_filetypes', []) call s:check_defined('g:airline_exclude_preview', 0) -call s:check_defined('g:airline_window_override_funcrefs', []) +call s:check_defined('g:airline_statusline_funcrefs', []) call s:check_defined('g:airline_exclude_funcrefs', []) call s:check_defined('g:airline_mode_map', {