2014-08-02 21:51:20 +02:00
|
|
|
|
*******************************
|
|
|
|
|
Configuration and customization
|
|
|
|
|
*******************************
|
|
|
|
|
|
2015-01-08 16:24:09 +01:00
|
|
|
|
.. note::
|
|
|
|
|
**Forking the main GitHub repo is not needed to personalize Powerline
|
|
|
|
|
configuration!** Please read through the :ref:`quick-guide` for a quick
|
|
|
|
|
introduction to user configuration.
|
2014-08-02 21:51:20 +02:00
|
|
|
|
|
|
|
|
|
Powerline is configured with one main configuration file, and with separate
|
|
|
|
|
configuration files for themes and colorschemes. All configuration files are
|
|
|
|
|
written in JSON, with the exception of segment definitions, which are
|
|
|
|
|
written in Python.
|
|
|
|
|
|
|
|
|
|
Powerline provides default configurations in the following locations:
|
|
|
|
|
|
|
|
|
|
:ref:`Main configuration <config-main>`
|
2015-05-30 13:24:30 +02:00
|
|
|
|
:file:`{powerline}/config.json`
|
2015-02-07 22:31:53 +01:00
|
|
|
|
:ref:`Colorschemes <config-colorschemes>`
|
2015-05-30 13:24:30 +02:00
|
|
|
|
:file:`{powerline}/colorschemes/{name}.json`,
|
|
|
|
|
:file:`{powerline}/colorschemes/{extension}/__main__.json`,
|
|
|
|
|
:file:`{powerline}/colorschemes/{extension}/{name}.json`
|
2014-08-02 21:51:20 +02:00
|
|
|
|
:ref:`Themes <config-themes>`
|
2015-05-30 13:24:30 +02:00
|
|
|
|
:file:`{powerline}/themes/{top_theme}.json`,
|
|
|
|
|
:file:`{powerline}/themes/{extension}/__main__.json`,
|
|
|
|
|
:file:`{powerline}/themes/{extension}/default.json`
|
2014-08-02 21:51:20 +02:00
|
|
|
|
|
2015-05-30 13:24:30 +02:00
|
|
|
|
Here `{powerline}` is one of the following:
|
|
|
|
|
|
|
|
|
|
#. The default configuration directory located in the main package:
|
|
|
|
|
:file:`{powerline_root}/powerline/config_files`. May be absent in some
|
|
|
|
|
packages (e.g. when installing via Gentoo ebuilds).
|
|
|
|
|
#. If variable ``$XDG_CONFIG_DIRS`` is set and non-empty then to any
|
|
|
|
|
:file:`{directory}/powerline` where `{directory}` is a directory listed in
|
|
|
|
|
a colon-separated ``$XDG_CONFIG_DIRS`` list. Directories are checked in
|
|
|
|
|
reverse order.
|
|
|
|
|
#. User configuration directory located in :file:`$XDG_CONFIG_HOME/powerline`.
|
|
|
|
|
This usually corresponds to :file:`~/.config/powerline` on all platforms.
|
2014-08-02 21:51:20 +02:00
|
|
|
|
|
2015-01-08 16:24:09 +01:00
|
|
|
|
If per-instance configuration is needed please refer to :ref:`Local
|
|
|
|
|
configuration overrides <local-configuration-overrides>`.
|
|
|
|
|
|
2015-02-07 16:50:47 +01:00
|
|
|
|
.. _configuration-merging:
|
|
|
|
|
|
2015-01-08 16:24:09 +01:00
|
|
|
|
.. note::
|
|
|
|
|
Existing multiple configuration files that have the same name, but are placed
|
2015-05-30 13:24:30 +02:00
|
|
|
|
in different directories, will be merged. Merging happens in the order given
|
|
|
|
|
in the above list of possible `{powerline}` meanings.
|
2015-01-08 16:24:09 +01:00
|
|
|
|
|
|
|
|
|
When merging configuration only dictionaries are merged and they are merged
|
|
|
|
|
recursively: keys from next file overrule those from the previous unless
|
|
|
|
|
corresponding values are both dictionaries in which case these dictionaries
|
|
|
|
|
are merged and key is assigned the result of the merge.
|
2014-07-13 21:27:44 +02:00
|
|
|
|
|
2014-08-05 18:29:03 +02:00
|
|
|
|
.. note:: Some configuration files (i.e. themes and colorschemes) have two level
|
|
|
|
|
of merging: first happens merging described above, second theme- or
|
|
|
|
|
colorscheme-specific merging happens.
|
|
|
|
|
|
2014-08-02 21:51:20 +02:00
|
|
|
|
.. _quick-guide:
|
|
|
|
|
|
|
|
|
|
Quick setup guide
|
|
|
|
|
=================
|
|
|
|
|
|
|
|
|
|
This guide will help you with the initial configuration of Powerline.
|
|
|
|
|
|
2015-02-07 16:50:47 +01:00
|
|
|
|
Look at configuration in :file:`{powerline_root}/powerline/config_files`. If you
|
|
|
|
|
want to modify some file you can create :file:`~/.config/powerline` directory
|
|
|
|
|
and put modifications there: all configuration files are :ref:`merged
|
|
|
|
|
<configuration-merging>` with each other.
|
2014-08-02 21:51:20 +02:00
|
|
|
|
|
|
|
|
|
Each extension (vim, tmux, etc.) has its own theme, and they are located in
|
2015-02-07 16:50:47 +01:00
|
|
|
|
:file:`{config directory}/themes/{extension}/default.json`. Best way to modify
|
|
|
|
|
it is to copy this theme as a whole, remove ``segment_data`` key with
|
|
|
|
|
corresponding value if present (unless you need to modify it, in which case only
|
|
|
|
|
modifications must be left) and do necessary modifications in the list of
|
|
|
|
|
segments (lists are not subject to merging: this is why you need a copy).
|
2014-08-02 21:51:20 +02:00
|
|
|
|
|
2015-02-07 16:50:47 +01:00
|
|
|
|
If you want to move, remove or customize any of the provided segments in the
|
|
|
|
|
copy, you can do that by updating the segment dictionary in the theme you want
|
|
|
|
|
to customize. A segment dictionary looks like this:
|
2014-08-02 21:51:20 +02:00
|
|
|
|
|
|
|
|
|
.. code-block:: javascript
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"name": "segment_name"
|
|
|
|
|
...
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
You can move the segment dictionaries around to change the segment
|
|
|
|
|
positions, or remove the entire dictionary to remove the segment from the
|
|
|
|
|
prompt or statusline.
|
|
|
|
|
|
2014-09-20 15:40:33 +02:00
|
|
|
|
.. note:: It’s essential that the contents of all your configuration files
|
|
|
|
|
is valid JSON! It’s strongly recommended that you run your configuration
|
2014-08-02 21:51:20 +02:00
|
|
|
|
files through ``jsonlint`` after changing them.
|
|
|
|
|
|
2015-02-07 16:50:47 +01:00
|
|
|
|
.. note::
|
|
|
|
|
If your modifications appear not to work, run :ref:`powerline-lint script
|
|
|
|
|
<command-powerline-lint>`. This script should show you the location of the
|
|
|
|
|
error.
|
|
|
|
|
|
2014-09-20 15:40:33 +02:00
|
|
|
|
Some segments need a user configuration to work properly. Here’s a couple of
|
2014-08-02 21:51:20 +02:00
|
|
|
|
segments that you may want to customize right away:
|
|
|
|
|
|
|
|
|
|
**E-mail alert segment**
|
|
|
|
|
You have to set your username and password (and possibly server/port)
|
2014-09-20 15:40:33 +02:00
|
|
|
|
for the e-mail alert segment. If you’re using GMail it’s recommended
|
2014-08-02 21:51:20 +02:00
|
|
|
|
that you `generate an application-specific password
|
|
|
|
|
<https://accounts.google.com/IssuedAuthSubTokens>`_ for this purpose.
|
|
|
|
|
|
|
|
|
|
Open a theme file, scroll down to the ``email_imap_alert`` segment and
|
2014-09-20 15:40:33 +02:00
|
|
|
|
set your ``username`` and ``password``. The server defaults to GMail’s
|
2014-08-02 21:51:20 +02:00
|
|
|
|
IMAP server, but you can set the server/port by adding a ``server`` and
|
|
|
|
|
a ``port`` argument.
|
|
|
|
|
**Weather segment**
|
|
|
|
|
The weather segment will try to find your location using a GeoIP lookup,
|
2014-09-20 15:40:33 +02:00
|
|
|
|
so unless you’re on a VPN you probably won’t have to change the location
|
2014-08-02 21:51:20 +02:00
|
|
|
|
query.
|
2014-09-04 17:51:10 +02:00
|
|
|
|
|
2014-09-20 15:40:33 +02:00
|
|
|
|
If you want to change the location query or the temperature unit you’ll
|
2014-08-02 21:51:20 +02:00
|
|
|
|
have to update the segment arguments. Open a theme file, scroll down to
|
|
|
|
|
the weather segment and update it to include unit/location query
|
|
|
|
|
arguments:
|
|
|
|
|
|
|
|
|
|
.. code-block:: javascript
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"name": "weather",
|
|
|
|
|
"priority": 50,
|
|
|
|
|
"args": {
|
|
|
|
|
"unit": "F",
|
|
|
|
|
"location_query": "oslo, norway"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
==========
|
|
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
|
:glob:
|
|
|
|
|
|
|
|
|
|
configuration/reference
|
|
|
|
|
configuration/segments
|
2014-08-16 11:22:31 +02:00
|
|
|
|
configuration/listers
|
2014-09-04 18:43:35 +02:00
|
|
|
|
configuration/selectors
|
2014-08-02 21:51:20 +02:00
|
|
|
|
configuration/local
|