The README of a project is not meant to be a complete documentation, generally it is worth reading the doc. For example: :h airline-advanced-customization
------------------------------------- *airline-parts*
A part is something that contains metadata that eventually gets rendered into
the statusline. You can define parts that contain constant strings or
functions. Defining parts is needed if you want to use features like automatic
insertion of separators or hiding based on window width.
For example, this is how you would define a part function:
call airline#parts#define_function('foo', 'GetFooText')
Here is how you would define a part that is visible only if the window width
greater than a minimum width.
call airline#parts#define_minwidth('foo', 50)
Parts can be configured to be visible conditionally.
call airline#parts#define_condition('foo', 'getcwd() =~ "work_dir"')
Now add part "foo" to section section airline_section_y:
let g:airline_section_y = airline#section#create_right(['ffenc','foo'])
Note: Part definitions are combinative; e.g. the two examples above modify the
same `foo` part.
Note: Look at the source code and tests for the full API.
So you can simply create your function, create a new part with airline#parts#define_function
and add this part to one of your sections.