From 7aa233f59d2eeceede646c7ba44884857f76aa5f Mon Sep 17 00:00:00 2001 From: da99 Date: Wed, 3 Feb 2016 23:26:50 -0600 Subject: [PATCH] Adding a mention of add_inactive_statusline_func (as suggested in this issue: https://github.com/vim-airline/vim-airline/issues/987) --- Configuration-Examples-and-Snippets.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Configuration-Examples-and-Snippets.md b/Configuration-Examples-and-Snippets.md index a9845dc..4a01586 100644 --- a/Configuration-Examples-and-Snippets.md +++ b/Configuration-Examples-and-Snippets.md @@ -8,4 +8,21 @@ Feel free to add your special configuration, if it fixes a need. Prepend a '$' when obsession is enabled ([origin](https://github.com/vim-airline/vim-airline/issues/777#issuecomment-113704356)) ```viml let g:airline_section_z = airline#section#create(['%{ObsessionStatus(''$'', '''')}', 'windowswap', '%3p%% ', 'linenr', ':%3v ']) -``` \ No newline at end of file +``` + +## Overriding the inactive statusline + `add_inactive_statusline_func` (counterpart to `add_statusline_func`) can be used to add to (or completely override) the inactive statusline: +```viml +function! Render_Only_File(...) + let builder = a:1 + let context = a:2 + + call builder.add_section('file', '!! %F') + + return 0 " the default: draw the rest of the statusline + return -1 " do not modify the statusline + return 1 " modify the statusline with the current contents of the builder +endfunction +call airline#add_inactive_statusline_func('Render_Only_File') +``` +More information on the use of the `builder` and `context` arguments can be found in `:help` section [airline-funcrefs](https://github.com/vim-airline/vim-airline/blob/master/doc/airline.txt#L784). \ No newline at end of file