Segment reference

Segments

Segments are written in Python, and the default segments provided with Powerline are located in powerline/segments/extension.py. User-defined segments can be defined in any module in sys.path or paths common configuration option, import is always absolute.

Segments are regular Python functions, and they may accept arguments. All arguments should have a default value which will be used for themes that don’t provide an args dict.

A segment function must return one of the following values:

  • None, which will remove the segment from the prompt/statusline.
  • A string, which will be the segment contents.
  • A list of dicts consisting of a contents string, and a highlight_group list. This is useful for providing a particular highlighting group depending on the segment contents.

Table Of Contents

Previous topic

Configuration reference

Next topic

Common segments

This Page