add error code 1 for easier override.
This commit is contained in:
parent
30c3613924
commit
98eecd7ae2
|
@ -111,6 +111,8 @@ function! airline#update_statusline()
|
||||||
let err = airline#util#exec_funcrefs(g:airline_statusline_funcrefs, builder)
|
let err = airline#util#exec_funcrefs(g:airline_statusline_funcrefs, builder)
|
||||||
if err == 0
|
if err == 0
|
||||||
call setwinvar(winnr(), '&statusline', airline#get_statusline(builder, winnr(), 1))
|
call setwinvar(winnr(), '&statusline', airline#get_statusline(builder, winnr(), 1))
|
||||||
|
elseif err == 1
|
||||||
|
call setwinvar(winnr(), '&statusline', builder.build())
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -157,9 +157,11 @@ separators, as well as the powerline font glyths.
|
||||||
<
|
<
|
||||||
|
|
||||||
For more intricate customizations, you can replace the predefined sections
|
For more intricate customizations, you can replace the predefined sections
|
||||||
with the usual statusline syntax. Note that many of these settings can also be
|
with the usual statusline syntax.
|
||||||
controlled with |airline-configuration| variables, which is useful for
|
|
||||||
sections which by default host more than one extension.
|
Note: Many of these settings can also be controlled with |airline-configuration|
|
||||||
|
variables, which is useful for sections which by default host more than one
|
||||||
|
extension.
|
||||||
>
|
>
|
||||||
variable names default contents
|
variable names default contents
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
@ -180,6 +182,9 @@ sections which by default host more than one extension.
|
||||||
==============================================================================
|
==============================================================================
|
||||||
EXTENSIONS *airline-extensions*
|
EXTENSIONS *airline-extensions*
|
||||||
|
|
||||||
|
Most extensions are enabled by default and lazily loaded when the
|
||||||
|
corresponding plugin (if any) is detected.
|
||||||
|
|
||||||
*airline-branch*
|
*airline-branch*
|
||||||
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
||||||
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
|
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
|
||||||
|
@ -269,8 +274,8 @@ new plugin. >
|
||||||
call airline#add_statusline_func('MyPlugin')
|
call airline#add_statusline_func('MyPlugin')
|
||||||
<
|
<
|
||||||
*remove_statusline_func*
|
*remove_statusline_func*
|
||||||
You can also remove a function as well, if you only need to have something
|
You can also remove a function as well, which is useful for when you want a
|
||||||
activated temporarily. >
|
temporary override. >
|
||||||
call airline#remove_statusline_func('MyPlugin')
|
call airline#remove_statusline_func('MyPlugin')
|
||||||
<
|
<
|
||||||
|
|
||||||
|
@ -280,8 +285,7 @@ PIPELINE *airline-pipeline*
|
||||||
Sometimes you want to do more than just use overrides. The statusline funcref
|
Sometimes you want to do more than just use overrides. The statusline funcref
|
||||||
is invoked and passed a bunch of arguments. The first of these arguments is
|
is invoked and passed a bunch of arguments. The first of these arguments is
|
||||||
the statusline builder. You can use this to build completely custom
|
the statusline builder. You can use this to build completely custom
|
||||||
statuslines to your liking. Additionally, the return value of this function
|
statuslines to your liking. Here is an example: >
|
||||||
controls determines what airline will do next. Here is an example:
|
|
||||||
>
|
>
|
||||||
function! MyPlugin(...)
|
function! MyPlugin(...)
|
||||||
" first variable is the statusline builder
|
" first variable is the statusline builder
|
||||||
|
@ -293,15 +297,18 @@ controls determines what airline will do next. Here is an example:
|
||||||
call builder.add_section('WarningMsg', '%{getcwd()}')
|
call builder.add_section('WarningMsg', '%{getcwd()}')
|
||||||
call setwinvar(winnr(), '&statusline', builder.build())
|
call setwinvar(winnr(), '&statusline', builder.build())
|
||||||
|
|
||||||
" the default action: modify the statusline with the default rules
|
|
||||||
" (this would render the above code redundant)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
" do not modify the statusline, useful for excluding filetypes or when you
|
|
||||||
" have overridden the statusline yourself.
|
|
||||||
return -1
|
return -1
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
|
*airline-pipeline-return-codes*
|
||||||
|
The pipeline accepts various return codes and can be used to determine the
|
||||||
|
next action. The following are the supported codes: >
|
||||||
|
0 the default, continue on with the next funcref
|
||||||
|
-1 do not modify the statusline
|
||||||
|
1 modify the statusline with the current contents of the builder
|
||||||
|
<
|
||||||
|
Note: Any value other than 0 will halt the pipeline and prevent the next
|
||||||
|
funcref from executing.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
WRITING EXTENSIONS *airline-writing-extensions*
|
WRITING EXTENSIONS *airline-writing-extensions*
|
||||||
|
|
Loading…
Reference in New Issue