mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 15:49:14 +08:00
rename window_override_funcrefs to statusline_funcrefs
This commit is contained in:
parent
257a9f2ed9
commit
94895de8e2
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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', {
|
||||
|
|
Loading…
Reference in New Issue
Block a user