Configuration reference¶
Main configuration¶
- Location:
powerline/config.json
The main configuration file defines some common options that applies to all extensions, as well as some extension-specific options like themes and colorschemes.
Common configuration¶
Common configuration is a subdictionary that is a value of common key in
powerline/config.json file.
term_truecolorDefines whether to output cterm indices (8-bit) or RGB colors (24-bit) to the terminal emulator. See the Application/terminal emulator feature support matrix for information on whether used terminal emulator supports 24-bit colors.
This variable is forced to be
falseif term_escape_style option is set to"fbterm"or if it is set to"auto"and powerline detected fbterm.
term_escape_styleDefines what escapes sequences should be used. Accepts three variants:
Variant
Description
auto
xtermorfbtermdepending on$TERMvariable value:TERM=fbtermimpliesfbtermescaping style, all other values selectxtermescaping.xterm
Uses
\e[{fb};5;{color}mfor colors ({fb}is either38(foreground) or48(background)). Should be used for most terminals.fbterm
Uses
\e[{fb};{color}}for colors ({fb}is either1(foreground) or2(background)). Should be used for fbterm: framebuffer terminal.
ambiwidthTells powerline what to do with characters with East Asian Width Class Ambiguous (such as Euro, Registered Sign, Copyright Sign, Greek letters, Cyrillic letters). Valid values: any positive integer; it is suggested that this option is only set it to 1 (default) or 2.
watcherSelect filesystem watcher. Variants are
Variant
Description
auto
Selects most performant watcher.
inotify
Select inotify watcher. Linux only.
stat
Select stat-based polling watcher.
uv
Select libuv-based watcher.
Default is
auto.
additional_escapesValid for shell extensions, makes sense only if term_truecolor is enabled. Is to be set from command-line. Controls additional escaping that is needed for tmux/screen to work with terminal true color escape codes: normally tmux/screen prevent terminal emulator from receiving these control codes thus rendering powerline prompt colorless. Valid values:
"tmux","screen",null(default).
pathsDefines additional paths which will be searched for modules when using function segment option or Vim local_themes option. Paths defined here have priority when searching for modules.
log_fileDefines how logs will be handled. There are three variants here:
Absent. In this case logging will be done to stderr: equivalent to
[["logging.StreamHandler", []]]or[null].Plain string. In this case logging will be done to the given file:
"/file/name"is equivalent to[["logging.FileHandler", [["/file/name"]]]]or["/file/name"]. Leading~/is expanded in the file name, so using"~/.log/foo"is permitted. If directory pointed by the option is absent, it will be created, but not its parent.List of handler definitions. Handler definition may either be
null, a string or a list with two or three elements:Logging class name and module. If module name is absent, it is equivalent to
logging.handlers.Class constructor arguments in a form
[[args[, kwargs]]]: accepted variants are[](no arguments),[args](e.g.[["/file/name"]]: only positional arguments) or[args, kwargs](e.g.[[], {"host": "localhost", "port": 6666}]: positional and keyword arguments, but no positional arguments in the example).Optional logging level. Overrides log_level key and has the same format.
Optional format string. Partially overrides log_format key and has the same format. “Partially” here means that it may only specify more critical level.
log_levelString, determines logging level. Defaults to
WARNING.
log_formatString, determines format of the log messages. Defaults to
'%(asctime)s:%(level)s:%(message)s'.intervalNumber, determines time (in seconds) between checks for changed configuration. Checks are done in a separate thread. Use
nullto check for configuration changes on.render()call in main thread. Defaults toNone.reload_configBoolean, determines whether configuration should be reloaded at all. Defaults to
True.
default_top_themeString, determines which top-level theme will be used as the default. Defaults to
powerline_terminusin unicode locales andasciiin non-unicode locales. See Themes section for more details.
Extension-specific configuration¶
Common configuration is a subdictionary that is a value of ext key in
powerline/config.json file.
colorschemeDefines the colorscheme used for this extension.
themeDefines the theme used for this extension.
top_themeDefines the top-level theme used for this extension. See Themes section for more details.
local_themesDefines themes used when certain conditions are met, e.g. for buffer-specific statuslines in vim. Value depends on extension used. For vim it is a dictionary
{matcher_name : theme_name}, wherematcher_nameis eithermatcher_module.module_attributeormodule_attribute(matcher_moduledefaults topowerline.matchers.vim) andmodule_attributeshould point to a function that returns boolean value indicating that current buffer has (not) matched conditions. There is an exception formatcher_namethough: if it is__tabline__no functions are loaded. This special theme is used fortablineVim option.For shell and ipython it is a simple
{prompt_type : theme_name}, whereprompt_typeis a string with no special meaning (specifically it does not refer to any Python function). Shell hascontinuation, andselectprompts with rather self-explanatory names, IPython hasin2,outandrewriteprompts (refer to IPython documentation for more details) whileinprompt is the default.For wm (lemonbar only) it is a dictionary
{output : theme_name}that maps thexrandroutput names to the local themes to use on that output.
componentsDetermines which extension components should be enabled. This key is highly extension-specific, here is the table of extensions and corresponding components:
Extension
Component
Description
vim
statusline
Makes Vim use powerline statusline.
tabline
Makes Vim use powerline tabline.
shell
prompt
Makes shell display powerline prompt.
tmux
Makes shell report its current working directory and screen width to tmux for tmux powerline bindings.
All components are enabled by default.
update_intervalDetermines how often WM status bars need to be updated, in seconds. Only valid for WM extensions which use
powerline-daemon. Defaults to 2 seconds.
Color definitions¶
- Location:
powerline/colors.json
colorsColor definitions, consisting of a dict where the key is the name of the color, and the value is one of the following:
A cterm color index.
A list with a cterm color index and a hex color string (e.g.
[123, "aabbcc"]). This is useful for colorschemes that use colors that aren’t available in color terminals.
gradientsGradient definitions, consisting of a dict where the key is the name of the gradient, and the value is a list containing one or two items, second item is optional:
A list of cterm color indices.
A list of hex color strings.
It is expected that gradients are defined from least alert color to most alert or non-alert colors are used.
Colorschemes¶
- Location:
powerline/colorschemes/name.json,powerline/colorschemes/__main__.json,powerline/colorschemes/extension/name.json
Colorscheme files are processed in order given: definitions from each next file
override those from each previous file. It is required that either
powerline/colorschemes/name.json, or
powerline/colorschemes/extension/name.json exists.
nameName of the colorscheme.
groupsSegment highlighting groups, consisting of a dict where the key is the name of the highlighting group (usually the function name for function segments), and the value is either
a dict that defines the foreground color, background color and attributes:
fgForeground color. Must be defined in colors.
bgBackground color. Must be defined in colors.
attrsList of attributes. Valid values are one or more of
bold,italicandunderline. Note that some attributes may be unavailable in some applications or terminal emulators. If no attributes are needed this list should be left empty.
a string (an alias): a name of existing group. This group’s definition will be used when this color is requested.
mode_translationsMode-specific highlighting for extensions that support it (e.g. the vim extension). It’s an easy way of changing a color in a specific mode. Consists of a dict where the key is the mode and the value is a dict with the following options:
Themes¶
- Location:
powerline/themes/top_theme.json,powerline/themes/extension/__main__.json,powerline/themes/extension/name.json
Theme files are processed in order given: definitions from each next file
override those from each previous file. It is required that file
powerline/themes/extension/name.json exists.
{top_theme} component of the file name is obtained either from top_theme extension-specific key or from default_top_theme common configuration key. Powerline ships with the following top themes:
Theme |
Description |
|---|---|
powerline |
Default powerline theme with fancy powerline symbols |
powerline_unicode7 |
Theme with powerline dividers and unicode-7 symbols |
unicode |
Theme without any symbols from private use area |
unicode_terminus |
Theme containing only symbols from terminus PCF font |
unicode_terminus_condensed |
Like above, but occupies as less space as possible |
powerline_terminus |
Like unicode_terminus, but with powerline symbols |
ascii |
Theme without any unicode characters at all |
nameName of the theme.
default_modulePython module where segments will be looked by default. Defaults to
powerline.segments.{ext}.spacesDefines number of spaces just before the divider (on the right side) or just after it (on the left side). These spaces will not be added if divider is not drawn.
use_non_breaking_spacesDetermines whether non-breaking spaces should be used in place of the regular ones. This option is needed because regular spaces are not displayed properly when using powerline with some font configuration. Defaults to
True.Note
Unlike all other options this one is only checked once at startup using whatever theme is the default. If this option is set in the local themes it will be ignored. This option may also be ignored in some bindings.
outer_paddingDefines number of spaces at the end of output (on the right side) or at the start of output (on the left side). Defaults to
1.dividersDefines the dividers used in all Powerline extensions.
The
harddividers are used to divide segments with different background colors, while thesoftdividers are used to divide segments with the same background color.
cursor_spaceSpace reserved for user input in shell bindings. It is measured in per cents.
cursor_columnsSpace reserved for user input in shell bindings. Unlike cursor_space it is measured in absolute amount of columns.
segment_dataA dict where keys are segment names or strings
{module}.{function}. Used to specify default values for various keys: after, before, contents (only for string segments if name is defined), display.Key args (only for function and segment_list segments) is handled specially: unlike other values it is merged with all other values, except that a single
{module}.{function}key if found prevents merging all{function}values.When using local themes values of these keys are first searched in the segment description, then in
segment_datakey of a local theme, then insegment_datakey of a default theme. For the default theme itself step 2 is obviously avoided.Note
Top-level themes are out of equation here: they are merged before the above merging process happens.
segmentsA dict with a
leftand arightlists, consisting of segment dictionaries. Shell themes may also containabovelist of dictionaries. Each item inabovelist may haveleftandrightkeys like this dictionary, but noabovekey.abovelist is used for multiline shell configurations.leftandrightlists are used for segments that should be put on the left or right side in the output. Actual mechanizm of putting segments on the left or the right depends on used renderer, but most renderers require one to specify segment with widthautoon either side to make generated line fill all of the available width.Each segment dictionary has the following options:
typeThe segment type. Can be one of
function(default),stringorsegment_list:functionThe segment contents is the return value of the function defined in the function option.
List of function segments is available in Segment reference section.
stringA static string segment where the contents is defined in the contents option, and the highlighting group is defined in the highlight_groups option.
segment_listSub-list of segments. This list only allows function, segments and args options.
List of lister segments is available in Lister reference section.
nameSegment name. If present allows referring to this segment in segment_data dictionary by this name. If not
stringsegments may not be referred there at all andfunctionandsegment_listsegments may be referred there using either{module}.{function_name}or{function_name}, whichever will be found first. Function name is taken from function key.Note
If present prevents
functionkey from acting as a segment name.
functionFunction used to get segment contents, in format
{module}.{function}or{function}. If{module}is omitted default_module option is used.
highlight_groupsHighlighting group for this segment. Consists of a prioritized list of highlighting groups, where the first highlighting group that is available in the colorscheme is used.
Ignored for segments that have
functiontype.
beforeA string which will be prepended to the segment contents.
afterA string which will be appended to the segment contents.
contentsSegment contents, only required for
stringsegments.
argsA dict of arguments to be passed to a
functionsegment.
alignAligns the segments contents to the left (
l), center (c) or right (r). Has no sense ifwidthkey was not specified or if segment provides its own function forautowidthhandling and does not care about this option.
widthEnforces a specific width for this segment.
This segment will work as a spacer if the width is set to
auto. Several spacers may be used, and the space will be distributed equally among all the spacer segments. Spacers may have contents, either returned by a function or a static string, and the contents can be aligned with thealignproperty.
priorityOptional segment priority. Segments with priority
None(the default priority, represented bynullin json) will always be included, regardless of the width of the prompt/statusline.If the priority is any number, the segment may be removed if the prompt/statusline width is too small for all the segments to be rendered. A lower number means that the segment has a higher priority.
Segments are removed according to their priority, with low priority segments (i.e. with a greater priority number) being removed first.
draw_hard_divider,draw_soft_dividerWhether to draw a divider between this and the adjacent segment. The adjacent segment is to the right for segments on the left side, and vice versa. Hard dividers are used between segments with different background colors, soft ones are used between segments with same background. Both options default to
True.
draw_inner_dividerDetermines whether inner soft dividers are to be drawn for function segments. Only applicable for functions returning multiple segments. Defaults to
False.
exclude_modes,include_modesA list of modes where this segment will be excluded: the segment is not included or is included in all modes, except for the modes in one of these lists respectively. If
exclude_modesis not present then it acts like an empty list (segment is not excluded from any modes). Withoutinclude_modesit acts like a list with all possible modes (segment is included in all modes). When there are bothexclude_modesoverridesinclude_modes.
exclude_function,include_functionFunction name in a form
{name}or{module}.{name}(in the first form{module}defaults topowerline.selectors.{ext}). Determines under which condition specific segment will be included or excluded. By default segment is always included and never excluded.exclude_functionoverridesinclude_function.Note
Options exclude_/include_modes complement
exclude_/include_functions: segment will be included if it is included by eitherinclude_modeorinclude_functionand will be excluded if it is excluded by eitherexclude_modeorexclude_function.
displayBoolean. If false disables displaying of the segment. Defaults to
True.
segmentsA list of subsegments.