I want to add section to mu airline that will display the output of a function called SpinnerText() taken from here.

I honestly don't really understand how to do it and yes I did look at the documentation on the main page of airline's repo but I still didn't really understand it as there wasn't an example about using a function call.

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.