summaryrefslogtreecommitdiffstats
path: root/docs/source/develop/local-themes.rst
blob: 959e1c4b2d2029b712ef29521911edccdb14803b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
************
Local themes
************

From the user point of view local themes are the regular themes with a specific 
scope where they are applied (i.e. specific vim window or specific kind of 
prompt). Used themes are defined in :ref:`local_themes key 
<config-ext-local_themes>`.

Vim local themes
================

Vim is the only available extension that has a wide variaty of options for local 
themes. It is the only extension where local theme key refers to a function as 
described in :ref:`local_themes value documentation <config-ext-local_themes>`. 

This function always takes a single value named ``matcher_info`` which is the 
same dictionary as :ref:`segment_info dictionary <dev-segment_info-vim>`. Unlike 
segments it takes this single argument as a *positional* argument, not as 
a keyword one.

Matcher function should return a boolean value: ``True`` if theme applies for 
the given ``matcher_info`` dictionary or ``False`` if it is not. When one of the 
matcher functions returns ``True`` powerline takes the corresponding theme at 
uses it for the given window. Matchers are not tested in any particular order.

In addition to :ref:`local_themes configuration key <config-ext-local_themes>` 
developer of some plugin which wishes to support powerline without including his 
code in powerline tree may use 
:py:meth:`powerline.vim.VimPowerline.add_local_theme` method. It accepts two 
arguments: matcher name (same as in :ref:`local_themes 
<config-ext-local_themes>`) and dictionary with theme. This dictionary is merged 
with :ref:`top theme <config-ext-top_theme>` and 
:file:`powerline/themes/vim/__main__.json`. Note that if user already specified 
the matcher in his configuration file ``KeyError`` is raised.

Other local themes
==================

Except for Vim only IPython and shells have local themes. Unlike Vim these 
themes are names with no special meaning (they do not refer to or cause loading 
of any Python functions):

+---------+------------+-------------------------------------------------------+
|Extension|Theme name  |Description                                            |
+---------+------------+-------------------------------------------------------+
|Shell    |continuation|Shown for unfinished command (unclosed quote,          |
|         |            |unfinished cycle).                                     |
|         +------------+-------------------------------------------------------+
|         |select      |Shown for ``select`` command available in some shells. |
+---------+------------+-------------------------------------------------------+
|IPython  |in2         |Continuation prompt: shown for unfinished (multiline)  |
|         |            |expression, unfinished class or function definition.   |
|         +------------+-------------------------------------------------------+
|         |out         |Displayed before the result.                           |
|         +------------+-------------------------------------------------------+
|         |rewrite     |Displayed before the actually executed code when       |
|         |            |``autorewrite`` IPython feature is enabled.            |
+---------+------------+-------------------------------------------------------+