1*********************** 2Configuration reference 3*********************** 4 5.. _config-main: 6 7Main configuration 8================== 9 10:Location: :file:`powerline/config.json` 11 12The main configuration file defines some common options that applies to all 13extensions, as well as some extension-specific options like themes and 14colorschemes. 15 16Common configuration 17-------------------- 18 19Common configuration is a subdictionary that is a value of ``common`` key in 20:file:`powerline/config.json` file. 21 22.. _config-common-term_truecolor: 23 24``term_truecolor`` 25 Defines whether to output cterm indices (8-bit) or RGB colors (24-bit) 26 to the terminal emulator. See the :ref:`term-feature-support-matrix` for 27 information on whether used terminal emulator supports 24-bit colors. 28 29 This variable is forced to be ``false`` if :ref:`term_escape_style 30 <config-common-term_escape_style>` option is set to ``"fbterm"`` or if it is 31 set to ``"auto"`` and powerline detected fbterm. 32 33.. _config-common-term_escape_style: 34 35``term_escape_style`` 36 Defines what escapes sequences should be used. Accepts three variants: 37 38 ======= =================================================================== 39 Variant Description 40 ======= =================================================================== 41 auto ``xterm`` or ``fbterm`` depending on ``$TERM`` variable value: 42 ``TERM=fbterm`` implies ``fbterm`` escaping style, all other values 43 select ``xterm`` escaping. 44 xterm Uses ``\e[{fb};5;{color}m`` for colors (``{fb}`` is either ``38`` 45 (foreground) or ``48`` (background)). Should be used for most 46 terminals. 47 fbterm Uses ``\e[{fb};{color}}`` for colors (``{fb}`` is either ``1`` 48 (foreground) or ``2`` (background)). Should be used for fbterm: 49 framebuffer terminal. 50 ======= =================================================================== 51 52.. _config-common-ambiwidth: 53 54``ambiwidth`` 55 Tells powerline what to do with characters with East Asian Width Class 56 Ambiguous (such as Euro, Registered Sign, Copyright Sign, Greek 57 letters, Cyrillic letters). Valid values: any positive integer; it is 58 suggested that this option is only set it to 1 (default) or 2. 59 60.. _config-common-watcher: 61 62``watcher`` 63 Select filesystem watcher. Variants are 64 65 ======= =================================== 66 Variant Description 67 ======= =================================== 68 auto Selects most performant watcher. 69 inotify Select inotify watcher. Linux only. 70 stat Select stat-based polling watcher. 71 uv Select libuv-based watcher. 72 ======= =================================== 73 74 Default is ``auto``. 75 76.. _config-common-additional_escapes: 77 78``additional_escapes`` 79 Valid for shell extensions, makes sense only if :ref:`term_truecolor 80 <config-common-term_truecolor>` is enabled. Is to be set from command-line. 81 Controls additional escaping that is needed for tmux/screen to work with 82 terminal true color escape codes: normally tmux/screen prevent terminal 83 emulator from receiving these control codes thus rendering powerline prompt 84 colorless. Valid values: ``"tmux"``, ``"screen"``, ``null`` (default). 85 86.. _config-common-paths: 87 88``paths`` 89 Defines additional paths which will be searched for modules when using 90 :ref:`function segment option <config-themes-seg-function>` or :ref:`Vim 91 local_themes option <config-ext-local_themes>`. Paths defined here have 92 priority when searching for modules. 93 94.. _config-common-log: 95 96``log_file`` 97 Defines how logs will be handled. There are three variants here: 98 99 #. Absent. In this case logging will be done to stderr: equivalent to 100 ``[["logging.StreamHandler", []]]`` or ``[null]``. 101 #. Plain string. In this case logging will be done to the given file: 102 ``"/file/name"`` is equivalent to ``[["logging.FileHandler", 103 [["/file/name"]]]]`` or ``["/file/name"]``. Leading ``~/`` is expanded in 104 the file name, so using ``"~/.log/foo"`` is permitted. If directory 105 pointed by the option is absent, it will be created, but not its parent. 106 #. List of handler definitions. Handler definition may either be ``null``, 107 a string or a list with two or three elements: 108 109 #. Logging class name and module. If module name is absent, it is 110 equivalent to ``logging.handlers``. 111 #. Class constructor arguments in a form ``[[args[, kwargs]]]``: accepted 112 variants are ``[]`` (no arguments), ``[args]`` (e.g. 113 ``[["/file/name"]]``: only positional arguments) or ``[args, kwargs]`` 114 (e.g. ``[[], {"host": "localhost", "port": 6666}]``: positional and 115 keyword arguments, but no positional arguments in the example). 116 #. Optional logging level. Overrides :ref:`log_level key 117 <config-common-log_level>` and has the same format. 118 #. Optional format string. Partially overrides :ref:`log_format key 119 <config-common-log_format>` and has the same format. “Partially” here 120 means that it may only specify more critical level. 121 122.. _config-common-log_level: 123 124``log_level`` 125 String, determines logging level. Defaults to ``WARNING``. 126 127.. _config-common-log_format: 128 129``log_format`` 130 String, determines format of the log messages. Defaults to 131 ``'%(asctime)s:%(level)s:%(message)s'``. 132 133``interval`` 134 Number, determines time (in seconds) between checks for changed 135 configuration. Checks are done in a separate thread. Use ``null`` to check 136 for configuration changes on ``.render()`` call in main thread. 137 Defaults to ``None``. 138 139``reload_config`` 140 Boolean, determines whether configuration should be reloaded at all. 141 Defaults to ``True``. 142 143.. _config-common-default_top_theme: 144 145``default_top_theme`` 146 String, determines which top-level theme will be used as the default. 147 Defaults to ``powerline_terminus`` in unicode locales and ``ascii`` in 148 non-unicode locales. See `Themes`_ section for more details. 149 150Extension-specific configuration 151-------------------------------- 152 153Common configuration is a subdictionary that is a value of ``ext`` key in 154:file:`powerline/config.json` file. 155 156``colorscheme`` 157 Defines the colorscheme used for this extension. 158 159.. _config-ext-theme: 160 161``theme`` 162 Defines the theme used for this extension. 163 164.. _config-ext-top_theme: 165 166``top_theme`` 167 Defines the top-level theme used for this extension. See `Themes`_ section 168 for more details. 169 170.. _config-ext-local_themes: 171 172``local_themes`` 173 Defines themes used when certain conditions are met, e.g. for 174 buffer-specific statuslines in vim. Value depends on extension used. For vim 175 it is a dictionary ``{matcher_name : theme_name}``, where ``matcher_name`` 176 is either ``matcher_module.module_attribute`` or ``module_attribute`` 177 (``matcher_module`` defaults to ``powerline.matchers.vim``) and 178 ``module_attribute`` should point to a function that returns boolean value 179 indicating that current buffer has (not) matched conditions. There is an 180 exception for ``matcher_name`` though: if it is ``__tabline__`` no functions 181 are loaded. This special theme is used for ``tabline`` Vim option. 182 183 For shell and ipython it is a simple ``{prompt_type : theme_name}``, where 184 ``prompt_type`` is a string with no special meaning (specifically it does 185 not refer to any Python function). Shell has ``continuation``, and 186 ``select`` prompts with rather self-explanatory names, IPython has ``in2``, 187 ``out`` and ``rewrite`` prompts (refer to IPython documentation for more 188 details) while ``in`` prompt is the default. 189 190 For wm (:ref:`lemonbar <lemonbar-usage>` only) it is a dictionary 191 ``{output : theme_name}`` that maps the ``xrandr`` output names to the 192 local themes to use on that output. 193 194.. _config-ext-components: 195 196``components`` 197 Determines which extension components should be enabled. This key is highly 198 extension-specific, here is the table of extensions and corresponding 199 components: 200 201 +---------+----------+-----------------------------------------------------+ 202 |Extension|Component |Description | 203 +---------+----------+-----------------------------------------------------+ 204 |vim |statusline|Makes Vim use powerline statusline. | 205 | +----------+-----------------------------------------------------+ 206 | |tabline |Makes Vim use powerline tabline. | 207 +---------+----------+-----------------------------------------------------+ 208 |shell |prompt |Makes shell display powerline prompt. | 209 | +----------+-----------------------------------------------------+ 210 | |tmux |Makes shell report its current working directory | 211 | | |and screen width to tmux for tmux powerline | 212 | | |bindings. | 213 | | | | 214 +---------+----------+-----------------------------------------------------+ 215 216 All components are enabled by default. 217 218.. _config-ext-update_interval: 219 220``update_interval`` 221 Determines how often WM status bars need to be updated, in seconds. Only 222 valid for WM extensions which use ``powerline-daemon``. Defaults to 223 2 seconds. 224 225.. _config-colors: 226 227Color definitions 228================= 229 230:Location: :file:`powerline/colors.json` 231 232.. _config-colors-colors: 233 234``colors`` 235 Color definitions, consisting of a dict where the key is the name of the 236 color, and the value is one of the following: 237 238 * A cterm color index. 239 * A list with a cterm color index and a hex color string (e.g. ``[123, 240 "aabbcc"]``). This is useful for colorschemes that use colors that 241 aren’t available in color terminals. 242 243``gradients`` 244 Gradient definitions, consisting of a dict where the key is the name of the 245 gradient, and the value is a list containing one or two items, second item 246 is optional: 247 248 * A list of cterm color indices. 249 * A list of hex color strings. 250 251 It is expected that gradients are defined from least alert color to most 252 alert or non-alert colors are used. 253 254.. _config-colorschemes: 255 256Colorschemes 257============ 258 259:Location: :file:`powerline/colorschemes/{name}.json`, 260 :file:`powerline/colorschemes/__main__.json`, 261 :file:`powerline/colorschemes/{extension}/{name}.json` 262 263Colorscheme files are processed in order given: definitions from each next file 264override those from each previous file. It is required that either 265:file:`powerline/colorschemes/{name}.json`, or 266:file:`powerline/colorschemes/{extension}/{name}.json` exists. 267 268``name`` 269 Name of the colorscheme. 270 271.. _config-colorschemes-groups: 272 273``groups`` 274 Segment highlighting groups, consisting of a dict where the key is the 275 name of the highlighting group (usually the function name for function 276 segments), and the value is either 277 278 #) a dict that defines the foreground color, background color and 279 attributes: 280 281 ``fg`` 282 Foreground color. Must be defined in :ref:`colors 283 <config-colors-colors>`. 284 285 ``bg`` 286 Background color. Must be defined in :ref:`colors 287 <config-colors-colors>`. 288 289 ``attrs`` 290 List of attributes. Valid values are one or more of ``bold``, 291 ``italic`` and ``underline``. Note that some attributes may be 292 unavailable in some applications or terminal emulators. If no 293 attributes are needed this list should be left empty. 294 295 #) a string (an alias): a name of existing group. This group’s definition 296 will be used when this color is requested. 297 298``mode_translations`` 299 Mode-specific highlighting for extensions that support it (e.g. the vim 300 extension). It’s an easy way of changing a color in a specific mode. 301 Consists of a dict where the key is the mode and the value is a dict 302 with the following options: 303 304 ``colors`` 305 A dict where the key is the color to be translated in this mode, and 306 the value is the new color. Both the key and the value must be defined 307 in :ref:`colors <config-colors-colors>`. 308 309 ``groups`` 310 Segment highlighting groups for this mode. Same syntax as the main 311 :ref:`groups <config-colorschemes-groups>` option. 312 313.. _config-themes: 314 315Themes 316====== 317 318:Location: :file:`powerline/themes/{top_theme}.json`, 319 :file:`powerline/themes/{extension}/__main__.json`, 320 :file:`powerline/themes/{extension}/{name}.json` 321 322Theme files are processed in order given: definitions from each next file 323override those from each previous file. It is required that file 324:file:`powerline/themes/{extension}/{name}.json` exists. 325 326`{top_theme}` component of the file name is obtained either from :ref:`top_theme 327extension-specific key <config-ext-top_theme>` or from :ref:`default_top_theme 328common configuration key <config-common-default_top_theme>`. Powerline ships 329with the following top themes: 330 331.. _config-top_themes-list: 332 333========================== ==================================================== 334Theme Description 335========================== ==================================================== 336powerline Default powerline theme with fancy powerline symbols 337powerline_unicode7 Theme with powerline dividers and unicode-7 symbols 338unicode Theme without any symbols from private use area 339unicode_terminus Theme containing only symbols from terminus PCF font 340unicode_terminus_condensed Like above, but occupies as less space as possible 341powerline_terminus Like unicode_terminus, but with powerline symbols 342ascii Theme without any unicode characters at all 343========================== ==================================================== 344 345``name`` 346 Name of the theme. 347 348.. _config-themes-default_module: 349 350``default_module`` 351 Python module where segments will be looked by default. Defaults to 352 ``powerline.segments.{ext}``. 353 354``spaces`` 355 Defines number of spaces just before the divider (on the right side) or just 356 after it (on the left side). These spaces will not be added if divider is 357 not drawn. 358 359``use_non_breaking_spaces`` 360 Determines whether non-breaking spaces should be used in place of the 361 regular ones. This option is needed because regular spaces are not displayed 362 properly when using powerline with some font configuration. Defaults to 363 ``True``. 364 365 .. note:: 366 Unlike all other options this one is only checked once at startup using 367 whatever theme is :ref:`the default <config-ext-theme>`. If this option 368 is set in the local themes it will be ignored. This option may also be 369 ignored in some bindings. 370 371``outer_padding`` 372 Defines number of spaces at the end of output (on the right side) or at 373 the start of output (on the left side). Defaults to ``1``. 374 375 376``dividers`` 377 Defines the dividers used in all Powerline extensions. 378 379 The ``hard`` dividers are used to divide segments with different 380 background colors, while the ``soft`` dividers are used to divide 381 segments with the same background color. 382 383.. _config-themes-cursor_space: 384 385``cursor_space`` 386 Space reserved for user input in shell bindings. It is measured in per 387 cents. 388 389``cursor_columns`` 390 Space reserved for user input in shell bindings. Unlike :ref:`cursor_space 391 <config-themes-cursor_space>` it is measured in absolute amount of columns. 392 393.. _config-themes-segment_data: 394 395``segment_data`` 396 A dict where keys are segment names or strings ``{module}.{function}``. Used 397 to specify default values for various keys: 398 :ref:`after <config-themes-seg-after>`, 399 :ref:`before <config-themes-seg-before>`, 400 :ref:`contents <config-themes-seg-contents>` (only for string segments 401 if :ref:`name <config-themes-seg-name>` is defined), 402 :ref:`display <config-themes-seg-display>`. 403 404 Key :ref:`args <config-themes-seg-args>` (only for function and 405 segment_list segments) is handled specially: unlike other values it is 406 merged with all other values, except that a single ``{module}.{function}`` 407 key if found prevents merging all ``{function}`` values. 408 409 When using :ref:`local themes <config-ext-local_themes>` values of these 410 keys are first searched in the segment description, then in ``segment_data`` 411 key of a local theme, then in ``segment_data`` key of a :ref:`default theme 412 <config-ext-theme>`. For the :ref:`default theme <config-ext-theme>` itself 413 step 2 is obviously avoided. 414 415 .. note:: Top-level themes are out of equation here: they are merged 416 before the above merging process happens. 417 418.. _config-themes-segments: 419 420``segments`` 421 A dict with a ``left`` and a ``right`` lists, consisting of segment 422 dictionaries. Shell themes may also contain ``above`` list of dictionaries. 423 Each item in ``above`` list may have ``left`` and ``right`` keys like this 424 dictionary, but no ``above`` key. 425 426 .. _config-themes-above: 427 428 ``above`` list is used for multiline shell configurations. 429 430 ``left`` and ``right`` lists are used for segments that should be put on the 431 left or right side in the output. Actual mechanizm of putting segments on 432 the left or the right depends on used renderer, but most renderers require 433 one to specify segment with :ref:`width <config-themes-seg-width>` ``auto`` 434 on either side to make generated line fill all of the available width. 435 436 Each segment dictionary has the following options: 437 438 .. _config-themes-seg-type: 439 440 ``type`` 441 The segment type. Can be one of ``function`` (default), ``string`` or 442 ``segment_list``: 443 444 ``function`` 445 The segment contents is the return value of the function defined in 446 the :ref:`function option <config-themes-seg-function>`. 447 448 List of function segments is available in :ref:`Segment reference 449 <config-segments>` section. 450 451 ``string`` 452 A static string segment where the contents is defined in the 453 :ref:`contents option <config-themes-seg-contents>`, and the 454 highlighting group is defined in the :ref:`highlight_groups option 455 <config-themes-seg-highlight_groups>`. 456 457 ``segment_list`` 458 Sub-list of segments. This list only allows :ref:`function 459 <config-themes-seg-function>`, :ref:`segments 460 <config-themes-seg-segments>` and :ref:`args 461 <config-themes-seg-args>` options. 462 463 List of lister segments is available in :ref:`Lister reference 464 <config-listers>` section. 465 466 .. _config-themes-seg-name: 467 468 ``name`` 469 Segment name. If present allows referring to this segment in 470 :ref:`segment_data <config-themes-segment_data>` dictionary by this 471 name. If not ``string`` segments may not be referred there at all and 472 ``function`` and ``segment_list`` segments may be referred there using 473 either ``{module}.{function_name}`` or ``{function_name}``, whichever 474 will be found first. Function name is taken from :ref:`function key 475 <config-themes-seg-function>`. 476 477 .. note:: 478 If present prevents ``function`` key from acting as a segment name. 479 480 .. _config-themes-seg-function: 481 482 ``function`` 483 Function used to get segment contents, in format ``{module}.{function}`` 484 or ``{function}``. If ``{module}`` is omitted :ref:`default_module 485 option <config-themes-default_module>` is used. 486 487 .. _config-themes-seg-highlight_groups: 488 489 ``highlight_groups`` 490 Highlighting group for this segment. Consists of a prioritized list of 491 highlighting groups, where the first highlighting group that is 492 available in the colorscheme is used. 493 494 Ignored for segments that have ``function`` type. 495 496 .. _config-themes-seg-before: 497 498 ``before`` 499 A string which will be prepended to the segment contents. 500 501 .. _config-themes-seg-after: 502 503 ``after`` 504 A string which will be appended to the segment contents. 505 506 .. _config-themes-seg-contents: 507 508 ``contents`` 509 Segment contents, only required for ``string`` segments. 510 511 .. _config-themes-seg-args: 512 513 ``args`` 514 A dict of arguments to be passed to a ``function`` segment. 515 516 .. _config-themes-seg-align: 517 518 ``align`` 519 Aligns the segments contents to the left (``l``), center (``c``) or 520 right (``r``). Has no sense if ``width`` key was not specified or if 521 segment provides its own function for ``auto`` ``width`` handling and 522 does not care about this option. 523 524 .. _config-themes-seg-width: 525 526 ``width`` 527 Enforces a specific width for this segment. 528 529 This segment will work as a spacer if the width is set to ``auto``. 530 Several spacers may be used, and the space will be distributed 531 equally among all the spacer segments. Spacers may have contents, 532 either returned by a function or a static string, and the contents 533 can be aligned with the ``align`` property. 534 535 .. _config-themes-seg-priority: 536 537 ``priority`` 538 Optional segment priority. Segments with priority ``None`` (the default 539 priority, represented by ``null`` in json) will always be included, 540 regardless of the width of the prompt/statusline. 541 542 If the priority is any number, the segment may be removed if the 543 prompt/statusline width is too small for all the segments to be 544 rendered. A lower number means that the segment has a higher priority. 545 546 Segments are removed according to their priority, with low priority 547 segments (i.e. with a greater priority number) being removed first. 548 549 .. _config-themes-seg-draw_divider: 550 551 ``draw_hard_divider``, ``draw_soft_divider`` 552 Whether to draw a divider between this and the adjacent segment. The 553 adjacent segment is to the *right* for segments on the *left* side, and 554 vice versa. Hard dividers are used between segments with different 555 background colors, soft ones are used between segments with same 556 background. Both options default to ``True``. 557 558 .. _config-themes-seg-draw_inner_divider: 559 560 ``draw_inner_divider`` 561 Determines whether inner soft dividers are to be drawn for function 562 segments. Only applicable for functions returning multiple segments. 563 Defaults to ``False``. 564 565 .. _config-themes-seg-exclude_modes: 566 567 ``exclude_modes``, ``include_modes`` 568 A list of modes where this segment will be excluded: the segment is not 569 included or is included in all modes, *except* for the modes in one of 570 these lists respectively. If ``exclude_modes`` is not present then it 571 acts like an empty list (segment is not excluded from any modes). 572 Without ``include_modes`` it acts like a list with all possible modes 573 (segment is included in all modes). When there are both 574 ``exclude_modes`` overrides ``include_modes``. 575 576 .. _config-themes-seg-exclude_function: 577 578 ``exclude_function``, ``include_function`` 579 Function name in a form ``{name}`` or ``{module}.{name}`` (in the first 580 form ``{module}`` defaults to ``powerline.selectors.{ext}``). Determines 581 under which condition specific segment will be included or excluded. By 582 default segment is always included and never excluded. 583 ``exclude_function`` overrides ``include_function``. 584 585 .. note:: 586 Options :ref:`exclude_/include_modes 587 <config-themes-seg-exclude_modes>` complement 588 ``exclude_/include_functions``: segment will be included if it is 589 included by either ``include_mode`` or ``include_function`` and will 590 be excluded if it is excluded by either ``exclude_mode`` or 591 ``exclude_function``. 592 593 .. _config-themes-seg-display: 594 595 ``display`` 596 Boolean. If false disables displaying of the segment. 597 Defaults to ``True``. 598 599 .. _config-themes-seg-segments: 600 601 ``segments`` 602 A list of subsegments. 603