Release 2.0

Added functionality:
- Added fbterm (framebuffer terminal emulator) support.
- Added theme with unicode-7.0 symbols. (Note: most software is not ready for it
  yet, including all Python-2\* versions.)
- Added support for PyPy3.
- Compiler is now called with CFLAGS from environment in setup.py if present.
- Added support for pyuv-1.\*.
- Added a way to write error log to Vim global variable.
- `powerline` script now supports overrides from `$POWERLINE_CONFIG_OVERRIDES`,
  `$POWERLINE_THEME_OVERRIDES` environment variables, so does `powerline-config`
  script.
- `powerline` and `powerline-config` scripts now support taking paths from
  `$POWERLINE_CONFIG_PATHS`.
- `powerline-lint` is now able to report dictionaries which were merged in to
  form marked dictionary and what were the previous values of overridden values.
- Added support for Byron Rakitzis’ rc shell reimplementation.
- Added support for querying battery status on cygwin platform.

Fixes:
- Vim: made all mode strings have equal width.
- Vim: fixed intermediate Vim-7.3\* support.
- Fixed typo in battery segment implementation that made it not possible to fall
  back to next implementation if UPower is not available, but dbus is.
- Fixed libzpython overrides and modes support.
- Fixed Python-3\* support in zpython bindings.
- Fixed checking of themes located in user configuration directories in
  `powerline-lint`.
- `powerline-daemon` now allows `--foreground` argument to be used in
  conjunction with `--replace`.
- Fixed outdated tmux versions support (1.6 and 1.7).

Incompatible changes:
- Removed CtrlP support. If one wants to readd it make sure to fix problems
  listed in 4e6b0a7ec8f2fa54053e4162c8b604a85e8d667d.
- `highlight_group` key in segment description (both in configuration and in
  function output) was renamed to `highlight_groups` (note the trailing `s`).
- `attr` key in colorschemes was renamed to `attrs` key (note the trailing `s`).
- All highlight groups looking like `foo.bar` were renamed to `foo:bar`: dot in
  highlight group names is no longer allowed.
- `detect` argument value was renamed to `auto` in network segments.
- `$POWERLINE_COMMAND` is now a single path to one executable. No arguments to
  the executable are allowed inside `$POWERLINE_COMMAND`. Overrides using
  argument to `$POWERLINE_COMMAND` are now deprecated.
- In place of overrides being part of `$POWERLINE_COMMAND` variable all shell
  and tmux bindings now support overrides from `$POWERLINE_CONFIG_OVERRIDES` and
  `$POWERLINE_THEME_OVERRIDES` environment variables.
- In place of config paths specified as a part of `$POWERLINE_COMMAND` variable
  paths are now taken from `$POWERLINE_CONFIG_PATHS` environment variable.
- `$POWERLINE_CONFIG` was replaced with `$POWERLINE_CONFIG_OVERRIDES` for
  zpython bindings when talking about overrides.
- `$POWERLINE_THEME_CONFIG` was renamed to `$POWERLINE_THEME_OVERRIDES` in
  zpython bindings.
- `$POWERLINE_CONFIG` was replaced with `$POWERLINE_CONFIG_COMMAND` in all shell
  bindings when talking about path to `powerline-config` executable.
- In Vim in place of `g:powerline_theme_overrides__{theme_name}` per-theme
  dictionaries `g:powerline_theme_overrides` dictionary should be used. Theme
  names in this case are top-level keys in the new dictionary.
- In IPython configuration paths list can be specified via `config_paths`
  option, not via `paths` option.
- Some long options that defined overrides were renamed:
  - `--theme_option` was renamed to `--theme-override`.
  - `--config` was renamed to `--config-override`.
  Note that these options are deprecated and shall be used for testing purposes
  only.
- All long options that used to have underscore in them are now using
  HYPHEN-MINUS instead. I.e.
  - `--config_path` was renamed to `--config-path`.
  - `--last_pipe_status` was renamed to `--last-pipe-status`.
  - `--renderer_arg` was renamed to `--renderer-arg`.
  - `--theme_option` was renamed to `--theme-override`.
  Short options were not touched.
- All segments from `powerline.segments.common` were removed. Now they live in
  `powerline.segments.common` submodules: e.g.
  `powerline.segments.common.weather` is now
  `powerline.segments.common.wthr.weather`. List of available segments can be
  found in documentation, section [Common segments][common-segments].
- Segments `powerline.segments.common.now_playing` and
  `powerline.segments.common.players.now_playing` were removed. In place of them
  all players should be accessed via their own segments. List of segments is
  available in [Media players][media-players].

[common-segments]: http://powerline.readthedocs.org/en/master/configuration/segments/common.html
[media-players]: http://powerline.readthedocs.org/en/master/configuration/segments/common.html#module-powerline.segments.common.players
This commit is contained in:
ZyX 2015-01-18 17:22:01 +03:00
commit 34f53acd78
173 changed files with 3802 additions and 1952 deletions

View File

@ -1,12 +1,22 @@
language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
- "pypy"
install: tests/install.sh
script: tests/test.sh
matrix:
include:
- python: "2.6"
- python: "2.7"
- python: "3.2"
- python: "3.3"
- python: "3.4"
- python: "pypy"
- python: "pypy3"
- python: "2.6"
env: >-
USE_UCS2_PYTHON=1
UCS2_PYTHON_VARIANT="2.6"
- python: "2.7"
env: >-
USE_UCS2_PYTHON=1
UCS2_PYTHON_VARIANT="2.7"
# vim: et

View File

@ -13,9 +13,8 @@ Getting started
===============
* Make sure you have a `GitHub account <https://github.com/signup/free>`_.
* Submit an `issue on GitHub
<https://github.com/Lokaltog/powerline/issues>`_, assuming one does not
already exist.
* Submit an `issue on GitHub <https://github.com/powerline/powerline/issues>`_,
assuming one does not already exist.
* Clearly describe the issue.
* If the issue is a bug: make sure you include steps to reproduce, and
@ -135,5 +134,5 @@ Submitting changes
* Push your changes to a topic branch in your fork of the repository.
* If necessary, use ``git rebase -i <revision>`` to squash or reword commits
before submitting a pull request.
* Submit a pull request to `Lokaltog's repository
<https://github.com/Lokaltog/powerline>`_.
* Submit a pull request to `powerline repository
<https://github.com/powerline/powerline>`_.

View File

@ -1,5 +1,5 @@
Copyright 2013 Kim Silkebækken and other contributors
https://github.com/Lokaltog/powerline
https://github.com/powerline/powerline
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -2,7 +2,7 @@ Powerline
=========
:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com)
:Source: https://github.com/Lokaltog/powerline
:Source: https://github.com/powerline/powerline
:Version: beta
**Powerline is a statusline plugin for vim, and provides statuslines and
@ -12,11 +12,11 @@ Awesome and Qtile.**
* `Support forum`_ (powerline-support@googlegroups.com)
* `Development discussion`_ (powerline-dev@googlegroups.com)
.. image:: https://api.travis-ci.org/Lokaltog/powerline.png?branch=develop
.. image:: https://api.travis-ci.org/powerline/powerline.png?branch=develop
:target: `travis-build-status`_
:alt: Build status
.. _travis-build-status: https://travis-ci.org/Lokaltog/powerline
.. _travis-build-status: https://travis-ci.org/powerline/powerline
.. _`Support forum`: https://groups.google.com/forum/#!forum/powerline-support
.. _`Development discussion`: https://groups.google.com/forum/#!forum/powerline-dev
@ -59,8 +59,8 @@ and feature-rich alternative is currently Bailey Lings `vim-airline
* Consult the `documentation
<https://powerline.readthedocs.org/en/latest/>`_ for more information and
installation instructions.
* Check out `powerline-fonts <https://github.com/Lokaltog/powerline-fonts>`_
for pre-patched versions of popular, open source coding fonts.
* Check out `powerline-fonts <https://github.com/powerline/fonts>`_ for
pre-patched versions of popular, open source coding fonts.
Screenshots
-----------
@ -70,22 +70,22 @@ Vim statusline
**Mode-dependent highlighting**
* .. image:: https://raw.github.com/Lokaltog/powerline/develop/docs/source/_static/img/pl-mode-normal.png
* .. image:: https://raw.github.com/powerline/powerline/develop/docs/source/_static/img/pl-mode-normal.png
:alt: Normal mode
* .. image:: https://raw.github.com/Lokaltog/powerline/develop/docs/source/_static/img/pl-mode-insert.png
* .. image:: https://raw.github.com/powerline/powerline/develop/docs/source/_static/img/pl-mode-insert.png
:alt: Insert mode
* .. image:: https://raw.github.com/Lokaltog/powerline/develop/docs/source/_static/img/pl-mode-visual.png
* .. image:: https://raw.github.com/powerline/powerline/develop/docs/source/_static/img/pl-mode-visual.png
:alt: Visual mode
* .. image:: https://raw.github.com/Lokaltog/powerline/develop/docs/source/_static/img/pl-mode-replace.png
* .. image:: https://raw.github.com/powerline/powerline/develop/docs/source/_static/img/pl-mode-replace.png
:alt: Replace mode
**Automatic truncation of segments in small windows**
* .. image:: https://raw.github.com/Lokaltog/powerline/develop/docs/source/_static/img/pl-truncate1.png
* .. image:: https://raw.github.com/powerline/powerline/develop/docs/source/_static/img/pl-truncate1.png
:alt: Truncation illustration
* .. image:: https://raw.github.com/Lokaltog/powerline/develop/docs/source/_static/img/pl-truncate2.png
* .. image:: https://raw.github.com/powerline/powerline/develop/docs/source/_static/img/pl-truncate2.png
:alt: Truncation illustration
* .. image:: https://raw.github.com/Lokaltog/powerline/develop/docs/source/_static/img/pl-truncate3.png
* .. image:: https://raw.github.com/powerline/powerline/develop/docs/source/_static/img/pl-truncate3.png
:alt: Truncation illustration
----

View File

@ -0,0 +1,6 @@
.wy-table-responsive > table > tbody > tr > td {
white-space: unset;
}
.wy-table-responsive > table > tbody > tr > td:first-child {
vertical-align: top;
}

View File

@ -59,3 +59,12 @@ if not on_rtd: # only import and set the theme if were building docs locally
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except ImportError:
pass
if on_rtd or html_theme == 'sphinx_rtd_theme':
html_context = {
'css_files': [
'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
'_static/css/theme_overrides.css',
],
}

View File

@ -2,9 +2,10 @@
Configuration and customization
*******************************
.. note:: **You DO NOT have to fork the main GitHub repo to personalize your
Powerline configuration!** Please read through the :ref:`quick-guide` for
a quick introduction to user configuration.
.. 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.
Powerline is configured with one main configuration file, and with separate
configuration files for themes and colorschemes. All configuration files are
@ -29,12 +30,13 @@ configuration files are stored in :file:`$XDG_CONFIG_HOME/powerline` for
Linux users, and in :file:`~/.config/powerline` for OS X users. This usually
corresponds to :file:`~/.config/powerline` on both platforms.
If you need per-instance configuration please refer to :ref:`Local configuration
overrides <local-configuration-overrides>`.
If per-instance configuration is needed please refer to :ref:`Local
configuration overrides <local-configuration-overrides>`.
.. note:: If you have multiple configuration files with the same name in
different directories then these files will be merged. Merging happens in
the following order:
.. note::
Existing multiple configuration files that have the same name, but are placed
in different directories, will be merged. Merging happens in the following
order:
* :file:`{powerline_root}/powerline/config_files` is checked for
configuration first. Configuration from this source has least priority.

View File

@ -16,11 +16,11 @@ Vim configuration can be overridden using the following options:
Dictionary, recursively merged with contents of
:file:`powerline/config.json`.
``g:powerline_theme_overrides__{theme_name}``
Dictionary, recursively merged with contents of
:file:`powerline/themes/vim/{theme_name}.json`. Note that this way you cant
redefine some value (e.g. segment) in list, only the whole list itself: only
dictionaries are merged recursively.
``g:powerline_theme_overrides``
Dictionary mapping theme names to theme overrides, recursively merged with
contents of :file:`powerline/themes/vim/{key}.json`. Note that this way some
value (e.g. segment) in a list cannot be redefined, only the whole list
itself: only dictionaries are merged recursively.
``g:powerline_config_paths``
Paths list (each path must be expanded, ``~`` shortcut is not supported).
@ -31,13 +31,21 @@ Vim configuration can be overridden using the following options:
If this variable is set to a true value it will prevent Powerline from reporting
an error when loaded in a copy of vim without the necessary Python support.
``g:powerline_use_var_handler``
This variable may be set to either 0 or 1. If it is set to 1 then Vim will
save log in ``g:powerline_log_messages`` variable in addition to whatever
was configured in :ref:`log_* options <config-common-log>`. Level is always
:ref:`log_level <config-common-log_level>`, same for format.
.. _local-configuration-overrides-script:
Powerline script overrides
==========================
Powerline script has a number of options controlling powerline behavior. Here
``VALUE`` always means “some JSON object”.
``-c KEY.NESTED_KEY=VALUE`` or ``--config=KEY.NESTED_KEY=VALUE``
``-c KEY.NESTED_KEY=VALUE`` or ``--config-override=KEY.NESTED_KEY=VALUE``
Overrides options from :file:`powerline/config.json`.
``KEY.KEY2.KEY3=VALUE`` is a shortcut for ``KEY={"KEY2": {"KEY3": VALUE}}``.
Multiple options (i.e. ``-c K1=V1 -c K2=V2``) are allowed, result (in the
@ -47,7 +55,7 @@ Powerline script has a number of options controlling powerline behavior. Here
If ``VALUE`` is omitted then corresponding key will be removed from the
configuration (if it was present).
``-t THEME_NAME.KEY.NESTED_KEY=VALUE`` or ``--theme_option=THEME_NAME.KEY.NESTED_KEY=VALUE``
``-t THEME_NAME.KEY.NESTED_KEY=VALUE`` or ``--theme-override=THEME_NAME.KEY.NESTED_KEY=VALUE``
Overrides options from :file:`powerline/themes/{ext}/{THEME_NAME}.json`.
``KEY.NESTED_KEY=VALUE`` is processed like described above, ``{ext}`` is the
first argument to powerline script. May be passed multiple times.
@ -55,46 +63,133 @@ Powerline script has a number of options controlling powerline behavior. Here
If ``VALUE`` is omitted then corresponding key will be removed from the
configuration (if it was present).
``-p PATH`` or ``--config_path=PATH``
``-p PATH`` or ``--config-path=PATH``
Sets directory where configuration should be read from. If present, no
default locations are searched for configuration. No expansions are
performed by powerline script itself, but ``-p ~/.powerline`` will likely be
expanded by the shell to something like ``-p /home/user/.powerline``.
.. warning::
Such overrides are suggested for testing purposes only. Use
:ref:`Environment variables overrides <local-configuration-overrides-env>`
for other purposes.
.. _local-configuration-overrides-env:
Environment variables overrides
===============================
All bindings that use ``POWERLINE_COMMAND`` environment variable support taking
overrides from environment variables. In this case overrides should look like
the following::
OVERRIDE='key1.key2.key3=value;key4.key5={"value":1};key6=true;key1.key7=10'
. This will be parsed into
.. code-block:: Python
{
"key1": {
"key2": {
"key3": "value"
},
"key7": 10,
},
"key4": {
"key5": {
"value": 1,
},
},
"key6": True,
}
. Rules:
#. Environment variable must form a semicolon-separated list of key-value pairs:
``key=value;key2=value2``.
#. Keys are always dot-separated strings that must not contain equals sign (as
well as semicolon) or start with an underscore. They are interpreted
literally and create a nested set of dictionaries: ``k1.k2.k3`` creates
``{"k1":{"k2":{}}}`` and inside the innermost dictionary last key (``k3`` in
the example) is contained with its value.
#. Value may be empty in which case they are interpreted as an order to remove
some value: ``k1.k2=`` will form ``{"k1":{"k2":REMOVE_THIS_KEY}}`` nested
dictionary where ``k2`` value is a special value that tells
dictionary-merging function to remove ``k2`` rather then replace it with
something.
#. Value may be a JSON strings like ``{"a":1}`` (JSON dictionary), ``["a",1]``
(JSON list), ``1`` or ``-1`` (JSON number), ``"abc"`` (JSON string) or
``true``, ``false`` and ``null`` (JSON boolean objects and ``Null`` object
from JSON). General rule is that anything starting with a digit (U+0030 till
U+0039, inclusive), a hyphenminus (U+002D), a quotation mark (U+0022), a left
curly bracket (U+007B) or a left square bracket (U+005B) is considered to be
some JSON object, same for *exact* values ``true``, ``false`` and ``null``.
#. Any other value is considered to be literal string: ``k1=foo:bar`` parses to
``{"k1": "foo:bar"}``.
The following environment variables may be used for overrides according to the
above rules:
``POWERLINE_CONFIG_OVERRIDES``
Overrides values from :file:`powerline/config.json`.
``POWERLINE_THEME_OVERRIDES``
Overrides values from :file:`powerline/themes/{ext}/{key}.json`. Top-level
key is treated as a name of the theme for which overrides are used: e.g. to
disable cwd segment defined in :file:`powerline/themes/shell/default.json`
one needs to use::
POWERLINE_THEME_OVERRIDES=default.segment_data.cwd.display=false
Additionally one environment variable is a usual *colon*-separated list of
directories: ``POWERLINE_CONFIG_PATHS``. This one defines paths which will be
searched for configuration. Empty paths in ``POWERLINE_CONFIG_PATHS`` are
ignored.
.. note::
Overrides from environment variables have lower priority then
:ref:`Powerline script overrides <local-configuration-overrides-script>`.
Latter are suggested for tests only.
Zsh/zpython overrides
=====================
Here overrides are controlled by similarly to the powerline script, but values
are taken from zsh variables.
are taken from zsh variables. :ref:`Environment variable overrides
<local-configuration-overrides-env>` are also supported: if variable is a string
this variant is used.
``POWERLINE_CONFIG``
``POWERLINE_CONFIG_OVERRIDES``
Overrides options from :file:`powerline/config.json`. Should be a zsh
associative array with keys equal to ``KEY.NESTED_KEY`` and values being
JSON strings. Pair ``KEY.KEY1 VALUE`` is equivalent to ``{"KEY": {"KEY1":
VALUE}}``. All pairs are then recursively merged into one dictionary and
this dictionary is recursively merged with the contents of the file.
``POWERLINE_THEME_CONFIG``
``POWERLINE_THEME_OVERRIDES``
Overrides options from :file:`powerline/themes/shell/*.json`. Should be
a zsh associative array with keys equal to ``THEME_NAME.KEY.NESTED_KEY`` and
values being JSON strings. Is processed like the above ``POWERLINE_CONFIG``,
but only subdictionaries for ``THEME_NAME`` key are merged with theme
configuration when theme with given name is requested.
values being JSON strings. Is processed like the above
``POWERLINE_CONFIG_OVERRIDES``, but only subdictionaries for ``THEME_NAME``
key are merged with theme configuration when theme with given name is
requested.
``POWERLINE_CONFIG_PATHS``
Sets directories where configuration should be read from. If present, no
default locations are searched for configuration. No expansions are
performed by powerline script itself, but zsh usually performs them on its
own if you set variable without quotes: ``POWERLINE_CONFIG_PATHS=( ~/example
)``. You should use array parameter or the usual colon-separated
``POWERLINE_CONFIG_PATHS=$HOME/path1:$HOME/path2``.
own if variable without is set without quotes: ``POWERLINE_CONFIG_PATHS=(
~/example )``. In addition to arrays usual colon-separated “array” string
can be used: ``POWERLINE_CONFIG_PATHS=$HOME/path1:$HOME/path2``.
Ipython overrides
=================
Ipython overrides depend on ipython version. Before ipython-0.11 you should pass
additional keyword arguments to setup() function. After ipython-0.11 you should
use ``c.Powerline.KEY``. Supported ``KEY`` strings or keyword argument names:
Ipython overrides depend on ipython version. Before ipython-0.11 additional
keyword arguments should be passed to setup() function. After ipython-0.11
``c.Powerline.KEY`` should be used. Supported ``KEY`` strings or keyword
argument names:
``config_overrides``
Overrides options from :file:`powerline/config.json`. Should be a dictionary
@ -105,43 +200,42 @@ use ``c.Powerline.KEY``. Supported ``KEY`` strings or keyword argument names:
a dictionary where keys are theme names and values are dictionaries which
will be recursively merged with the contents of the given theme.
``paths``
``config_paths``
Sets directories where configuration should be read from. If present, no
default locations are searched for configuration. No expansions are
performed thus you cannot use paths starting with ``~/``.
performed thus paths starting with ``~/`` cannot be used: use
:py:func:`os.path.expanduser`.
Prompt command
==============
In addition to the above configuration options you can use
``$POWERLINE_COMMAND`` environment variable to tell shell or tmux to use
specific powerline implementation and ``$POWERLINE_CONFIG`` to tell zsh or tmux
where ``powerline-config`` script is located. This is mostly useful for putting
In addition to the above configuration options ``$POWERLINE_COMMAND``
environment variable can be used to tell shell or tmux to use specific powerline
implementation and ``$POWERLINE_CONFIG_COMMAND`` to tell zsh or tmux where
``powerline-config`` script is located. This is mostly useful for putting
powerline into different directory.
.. note::
``$POWERLINE_COMMAND`` appears in shell scripts without quotes thus you can
specify additional parameters in bash. In tmux it is passed to ``eval`` and
depends on the shell used. POSIX-compatible shells, zsh, bash and fish will
split this variable in this case.
``$POWERLINE_COMMAND`` is always treated as one path in shell bindings, so
path with spaces in it may be used. To specify additional arguments one may
use ``$POWERLINE_COMMAND_ARGS``, but note that this variable exists for
testing purposes only and may be removed. One should use :ref:`Environment
variable overrides <local-configuration-overrides-env>` instead.
If you want to disable prompt in shell, but still have tmux support or if you
want to disable tmux support you can use variables
``$POWERLINE_NO_{SHELL}_PROMPT``/``$POWERLINE_NO_SHELL_PROMPT`` and
``$POWERLINE_NO_{SHELL}_TMUX_SUPPORT``/``$POWERLINE_NO_SHELL_TMUX_SUPPORT``
(substitute ``{SHELL}`` with the name of the shell (all-caps) you want to
disable support for (e.g. ``BASH``) or use all-inclusive ``SHELL`` that will
disable support for all shells). These variables have no effect after
configuration script was sourced (in fish case: after ``powerline-setup``
function was run). To disable specific feature support set one of these
variables to some non-empty value.
To disable prompt in shell, but still have tmux support or to disable tmux
support environment variables ``$POWERLINE_NO_{SHELL}_PROMPT`` and
``$POWERLINE_NO_{SHELL}_TMUX_SUPPORT`` can be used (substitute ``{SHELL}`` with
the name of the shell (all-caps) that should be affected (e.g. ``BASH``) or use
all-inclusive ``SHELL`` that will disable support for all shells). These
variables have no effect after configuration script was sourced (in fish case:
after ``powerline-setup`` function was run). To disable specific feature support
set one of these variables to some non-empty value.
If you do not want to disable prompt in shell, but yet do not want to launch
python twice to get :ref:`above <config-themes-above>` lines you do not use in
tcsh you should set ``$POWERLINE_NO_TCSH_ABOVE`` or
``$POWERLINE_NO_SHELL_ABOVE`` variable.
In order to keep shell prompt, but avoid launching Python twice to get unused
:ref:`above <config-themes-above>` lines in tcsh ``$POWERLINE_NO_TCSH_ABOVE`` or
``$POWERLINE_NO_SHELL_ABOVE`` variable should be set.
If you do not want to see additional space which is added to the right prompt in
fish in order to support multiline prompt you should set
``$POWERLINE_NO_FISH_ABOVE`` or ``$POWERLINE_NO_SHELL_ABOVE`` variables.
In order to remove additional space from the end of the right prompt in fish
that was added in order to support multiline prompt ``$POWERLINE_NO_FISH_ABOVE``
or ``$POWERLINE_NO_SHELL_ABOVE`` variable should be set.

View File

@ -24,7 +24,30 @@ Common configuration is a subdictionary that is a value of ``common`` key in
``term_truecolor``
Defines whether to output cterm indices (8-bit) or RGB colors (24-bit)
to the terminal emulator. See the :ref:`term-feature-support-matrix` for
information on whether your terminal emulator supports 24-bit colors.
information on whether used terminal emulator supports 24-bit colors.
This variable is forced to be ``false`` if :ref:`term_escape_style
<config-common-term_escape_style>` option is set to ``"fbterm"`` or if it is
set to ``"auto"`` and powerline detected fbterm.
.. _config-common-term_escape_style:
``term_escape_style``
Defines what escapes sequences should be used. Accepts three variants:
======= ===================================================================
Variant Description
======= ===================================================================
auto ``xterm`` or ``fbterm`` depending on ``$TERM`` variable value:
``TERM=fbterm`` implies ``fbterm`` escaping style, all other values
select ``xterm`` escaping.
xterm Uses ``\e[{fb};5;{color}m`` for colors (``{fb}`` is either ``38``
(foreground) or ``48`` (background)). Should be used for most
terminals.
fbterm Uses ``\e[{fb};{color}}`` for colors (``{fb}`` is either ``1``
(foreground) or ``2`` (background)). Should be used for fbterm:
framebuffer terminal.
======= ===================================================================
.. _config-common-ambiwidth:
@ -32,7 +55,7 @@ Common configuration is a subdictionary that is a value of ``common`` key in
Tells powerline what to do with characters with East Asian Width Class
Ambigious (such as Euro, Registered Sign, Copyright Sign, Greek
letters, Cyrillic letters). Valid values: any positive integer; it is
suggested that you only set it to 1 (default) or 2.
suggested that this option is only set it to 1 (default) or 2.
.. _config-common-watcher:
@ -54,12 +77,11 @@ Common configuration is a subdictionary that is a value of ``common`` key in
``additional_escapes``
Valid for shell extensions, makes sense only if :ref:`term_truecolor
<config-common-term_truecolor>` is enabled. Is to be set from command-line
(unless you are sure you always need it). 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).
<config-common-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).
.. _config-common-paths:
@ -75,6 +97,8 @@ Common configuration is a subdictionary that is a value of ``common`` key in
Defines path which will hold powerline logs. If not present, logging will be
done to stderr.
.. _config-common-log_level:
``log_level``
String, determines logging level. Defaults to ``WARNING``.
@ -187,8 +211,8 @@ Color definitions
* A list of cterm color indicies.
* A list of hex color strings.
It is expected that you define gradients from least alert color to most
alert or use non-alert colors.
It is expected that gradients are defined from least alert color to most
alert or non-alert colors are used.
.. _config-colorschemes:
@ -225,11 +249,11 @@ override those from each previous file. It is required that either
Background color. Must be defined in :ref:`colors
<config-colors-colors>`.
``attr``
``attrs``
List of attributes. Valid values are one or more of ``bold``,
``italic`` and ``underline``. Note that some attributes may be
unavailable in some applications or terminal emulators. If you do not
need any attributes leave this empty.
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 groups definition
will be used when this color is requested.
@ -273,6 +297,7 @@ 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
@ -307,9 +332,7 @@ ascii Theme without any unicode characters at all
``dividers``
Defines the dividers used in all Powerline extensions. This option
should usually only be changed if you dont have a patched font, or if
you use a font patched with the legacy font patcher.
Defines the dividers used in all Powerline extensions.
The ``hard`` dividers are used to divide segments with different
background colors, while the ``soft`` dividers are used to divide
@ -386,8 +409,8 @@ ascii Theme without any unicode characters at all
``string``
A static string segment where the contents is defined in the
:ref:`contents option <config-themes-seg-contents>`, and the
highlighting group is defined in the :ref:`highlight_group
option <config-themes-seg-highlight_group>`.
highlighting group is defined in the :ref:`highlight_groups option
<config-themes-seg-highlight_groups>`.
``segments_list``
Sub-list of segments. This list only allows :ref:`function
@ -419,9 +442,9 @@ ascii Theme without any unicode characters at all
or ``{function}``. If ``{module}`` is omitted :ref:`default_module
option <config-themes-default_module>` is used.
.. _config-themes-seg-highlight_group:
.. _config-themes-seg-highlight_groups:
``highlight_group``
``highlight_groups``
Highlighting 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.

View File

@ -15,12 +15,6 @@ Syntastic segments
.. automodule:: powerline.segments.vim.plugin.syntastic
:members:
Ctrl-P segments
---------------
.. automodule:: powerline.segments.vim.plugin.ctrlp
:members:
Command-T segments
------------------

View File

@ -24,8 +24,8 @@ segments in some set of applications. Specifically this means
computing text width.
This subclass must be placed directly in :file:`powerline/renderers`
directory (if you are creating powerline extension for a set of applications
use :file:`powerline/renderers/{ext}/*.py`) and named like ``ExtRenderer`` or
directory (for powerline extensions developed for a set of applications use
:file:`powerline/renderers/{ext}/*.py`) and named like ``ExtRenderer`` or
``AppPromptRenderer``. For technical reasons the class itself must be
referenced in ``renderer`` module attribute thus allowing only one renderer
per one module.

View File

@ -4,7 +4,7 @@
Writing listers
***************
Listers allow you to show some segments multiple times: once per each entity
Listers provide a way to show some segments multiple times: once per each entity
(buffer, tabpage, etc) lister knows. They are functions which receive the
following arguments:

View File

@ -32,7 +32,7 @@ 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
your matcher in his configuration file ``KeyError`` is raised.
the matcher in his configuration file ``KeyError`` is raised.
Other local themes
==================

View File

@ -12,7 +12,7 @@ object it should receive the following arguments:
``pl``
A :py:class:`powerline.PowerlineLogger` instance. It must be used every time
you need to log something.
something needs to be logged.
``segment_info``
A dictionary. It is only received if callable has
@ -32,20 +32,21 @@ And also any other argument(s) specified by user in :ref:`args key
.. note::
For powerline-lint to work properly the following things may be needed:
#. If your segment is a :py:class:`powerline.segments.Segment` and used
#. If segment is a :py:class:`powerline.segments.Segment` instance and used
arguments are scattered over multiple methods
:py:meth:`powerline.segments.Segment.argspecobjs` should be overridden in
subclass to tell powerline-lint which objects should be inspected for
arguments.
#. If your segment takes some arguments that are never listed, but accessed
via ``kwargs.get()`` or you cannot use previous function for whatever
reason :py:meth:`powerline.segments.Segment.additional_args` should be
#. If segment takes some arguments that are never listed, but accessed via
``kwargs.get()`` or previous function cannot be used for whatever reason
:py:meth:`powerline.segments.Segment.additional_args` should be
overridden in subclass.
#. If you are expecting user to use one :ref:`name <config-themes-seg-name>`
for multiple segments which cannot be linked to the segment function
#. If user is expected to use one :ref:`name <config-themes-seg-name>` for
multiple segments which cannot be linked to the segment function
automatically by powerline-lint (e.g. because there are no instances of
the segments in question in the default configuration) you should use
:py:func:`powerline.lint.checks.register_common_name`.
the segments in question in the default configuration)
:py:func:`powerline.lint.checks.register_common_name` function should be
used.
Object representing segment may have the following attributes used by
powerline:
@ -110,7 +111,7 @@ powerline:
.. warning::
“Amount of display cells” is *not* number of Unicode codepoints, string
length, or byte count. It is suggested that your function should look
length, or byte count. It is suggested that this function should look
something like ``return (' ' * amount) + segment['contents']`` where
``' '`` may be replaced with anything that is known to occupy exactly
one display cell.
@ -139,7 +140,7 @@ value:
[{
'contents': original_return,
'highlight_group': [segment_name],
'highlight_groups': [segment_name],
}]
.. _dev-segments-return:
@ -163,17 +164,18 @@ Detailed description of used dictionary keys:
as :ref:`the similar keys in configuration <config-themes-seg-draw_divider>`
(:ref:`draw_inner_divider <config-themes-seg-draw_inner_divider>`).
.. _dev-segments-highlight_group:
.. _dev-segments-highlight_groups:
``highlight_group``
``highlight_groups``
Determines segment highlighting. Refer to :ref:`themes documentation
<config-themes-seg-highlight_group>` for more details.
<config-themes-seg-highlight_groups>` for more details.
Defaults to the name of the segment.
.. note::
If you want to include your segment in powerline you must specify all
highlighting groups used in the segment documentation in the form::
If target is inclusion of the segment in powerline upstream all used
highlighting groups must be specified in the segment documentation in the
form::
Highlight groups used: ``g1``[ or ``g2``]*[, ``g3`` (gradient)[ or ``g4``]*]*.
@ -181,13 +183,13 @@ Detailed description of used dictionary keys:
Highlight groups used: ``foo_gradient`` (gradient) or ``foo``, ``bar``.
to specify that your segment uses *either* ``foo_gradient`` group or
to specify that the segment uses *either* ``foo_gradient`` group or
``foo`` group *and* ``bar`` group meaning that ``powerline-lint`` will
check that at least one of the first two groups is defined (and if
``foo_gradient`` is defined it must use at least one gradient color) and
third group is defined as well.
You must specify all groups on one line.
All groups must be specified on one line.
``divider_highlight_group``
Determines segment divider highlight group. Only applicable for soft
@ -195,19 +197,20 @@ Detailed description of used dictionary keys:
segments.
.. note::
If you want to include your segment in powerline you must specify used
groups in the segment documentation in the form::
If target is inclusion of the segment in powerline upstream used divider
highlight group must be specified in the segment documentation in the
form::
Divider highlight group used: ``group``.
This text must not wrap and you are supposed to end all divider
highlight group names with ``:divider``: e.g. ``cwd:divider``.
This text must not wrap and all divider highlight group names are
supposed to end with ``:divider``: e.g. ``cwd:divider``.
``gradient_level``
First and the only key that may not be specified in user configuration. It
determines which color should be used for this segment when one of the
highlighting groups specified by :ref:`highlight_group
<dev-segments-highlight_group>` was defined to use the color gradient.
highlighting groups specified by :ref:`highlight_groups
<dev-segments-highlight_groups>` was defined to use the color gradient.
This key may have any value from 0 to 100 inclusive, value is supposed to be
an ``int`` or ``float`` instance.
@ -243,7 +246,7 @@ Segment dictionary contains the following keys:
:ref:`Segment type <config-themes-seg-type>`. Always represents actual type
and is never ``None``.
``highlight_group``, ``divider_highlight_group``
``highlight_groups``, ``divider_highlight_group``
Used highlight groups. May be ``None``.
``highlight_group_prefix``
@ -330,16 +333,19 @@ keys:
have ``__getitem__`` and ``get`` methods and nothing more.
.. warning::
You must not ever use ``os.environ``. If your segment is run in daemon
you will get daemons environment which is not correct. If your segment
is run in Vim or in zsh with libzpython you will get Vim or zsh
environment at python startup.
``os.environ`` must not ever be used:
* If segment is run in the daemon this way it will get daemons
environment which is not correct.
* If segment is run in Vim or in zsh with libzpython ``os.environ`` will
contain Vim or zsh environ *at the moment Python interpreter was
loaded*.
``getcwd``
Function that returns current working directory being called with no
arguments. You must not use ``os.getcwd`` for the same reasons you must not
use ``os.environ``, except that current working directory is valid in Vim
and zsh (but not in daemon).
arguments. ``os.getcwd`` must not be used for the same reasons the use of
``os.environ`` is forbidden, except that current working directory is valid
in Vim and zsh (but not in daemon).
``home``
Current home directory. May be false.
@ -352,36 +358,36 @@ Vim
Vim ``segment_info`` argument is a dictionary with the following keys:
``window``
``vim.Window`` object. You may obtain one using ``vim.current.window`` or
``vim.windows[number - 1]``. May be a false object, in which case you should
not use any of this objects properties.
``vim.Window`` object. ``vim.current.window`` or ``vim.windows[number - 1]``
may be used to obtain such object. May be a false object, in which case any
of this objects properties must not be used.
``winnr``
Window number. Same as ``segment_info['window'].number`` *assuming* Vim is
new enough for ``vim.Window`` object to have ``number`` attribute.
``window_id``
Internal powerline window id, unique for each newly created window. You
should assume that this ID is hashable and supports equality comparison, but
you must not use any other assumptions about it. Currently uses integer
Internal powerline window id, unique for each newly created window. It is
safe to assume that this ID is hashable and supports equality comparison,
but no other assumptions about it should be used. Currently uses integer
numbers incremented each time window is created.
``buffer``
``vim.Buffer`` object. You may obtain one using ``vim.current.buffer``,
``vim.Buffer`` object. One may be obtained using ``vim.current.buffer``,
``segment_info['window'].buffer`` or ``vim.buffers[some_number]``. Note that
in the latter case depending on vim version ``some_number`` may be ``bufnr``
or the internal Vim buffer index which is *not* buffer number. For this
reason to get ``vim.Buffer`` object other then stored in ``segment_info``
dictionary you must iterate over ``vim.buffers`` and check their ``number``
attributes.
dictionary iteration over ``vim.buffers`` and checking their ``number``
attributes should be performed.
``bufnr``
Buffer number.
``tabpage``
``vim.Tabpage`` object. You may obtain one using ``vim.current.tabpage`` or
``vim.tabpages[number - 1]``. May be a false object, in which case you
should not use any of this objects properties.
``vim.Tabpage`` object. One may be obtained using ``vim.current.tabpage`` or
``vim.tabpages[number - 1]``. May be a false object, in which case no
objects properties can be used.
``tabnr``
Tabpage number.
@ -394,18 +400,18 @@ Vim ``segment_info`` argument is a dictionary with the following keys:
should be used to convert return values.
.. note::
Your segment generally should not assume that it is run for the current
window, current buffer or current tabpage. “Current window” and “current
buffer” restrictions may be ignored if you use ``window_cached`` decorator,
“current tabpage” restriction may be safely ignored if you do not plan to
ever see your segment in the tabline.
Segment generally should not assume that it is run for the current window,
current buffer or current tabpage. “Current window” and “current buffer”
restrictions may be ignored if ``window_cached`` decorator is used, “current
tabpage” restriction may be safely ignored if segment is not supposed to be
used in tabline.
.. warning::
Powerline is being tested with vim-7.2 and will be tested with it until
travis changes used vim version. This means that you may not use most of the
functionality like ``vim.Window.number``, ``vim.*.vars``, ``vim.*.options``
or even ``dir(vim object)`` if you want your segment to be included in
powerline.
Powerline is being tested with vim-7.0.112 (some minor sanity check) and
latest Vim. This means that most of the functionality like
``vim.Window.number``, ``vim.*.vars``, ``vim.*.options`` or even ``dir(vim
object)`` should be avoided in segments that want to be included in the
upstream.
Shell
-----
@ -416,18 +422,22 @@ Shell
Currently it is expected to contain at least the following attributes:
``last_exit_code``
Exit code returned by last shell command.
Exit code returned by last shell command. Is either one integer,
``sig{name}`` or ``sig{name}+core`` (latter two are only seen in ``rc``
shell).
``last_pipe_status``
List of exit codes returned by last programs in the pipe or some false
object. Only available in ``zsh``.
object. Only available in ``zsh`` and ``rc``. Is a list of either
integers, ``sig{name}`` or ``sig{name}+core`` (latter two are only seen
in ``rc`` shell).
``jobnum``
Number of background jobs.
``renderer_arg``
Dictionary containing some keys that are additional arguments used by
shell bindings. *You must not use this attribute directly*: all
shell bindings. *This attribute must not be used directly*: all
arguments from this dictionary are merged with ``segment_info``
dictionary. Known to have at least the following keys:

View File

@ -5,8 +5,8 @@ Installation
Generic requirements
====================
* Python 2.6 or later, 3.2 or later, PyPy 2.0 or later. It is the only
non-optional requirement.
* Python 2.6 or later, 3.2 or later, PyPy 2.0 or later, PyPy3 2.3 or later. It
is the only non-optional requirement.
.. warning:
It is highly advised to use UCS-4 version of Python because UCS-2 version
@ -40,51 +40,55 @@ Generic requirements
Pip installation
================
This project is currently unavailable from PyPI due to a naming conflict with an
unrelated project, thus you will have to use the following command to install
powerline with ``pip``:
.. code-block:: sh
pip install --user git+git://github.com/Lokaltog/powerline
. You may also choose to clone powerline repository somewhere and use
.. code-block:: sh
pip install --user --editable={path_to_powerline}
, but note that in this case ``pip`` will not install ``powerline`` executable
and you will have to do something like
.. code-block:: sh
ln -s {path_to_powerline}/scripts/powerline ~/.local/bin
(:file:`~/.local/bin` should be replaced with some path present in ``$PATH``).
.. note::
If your ISP blocks git protocol for some reason github also provides ``ssh``
(``git+ssh://git@github.com/Lokaltog/powerline``) and ``https``
(``git+https://github.com/Lokaltog/powerline``) protocols. ``git`` protocol
should be the fastest, but least secure one though.
To install release version uploaded to PyPI use
Due to a naming conflict with an unrelated project powerline is available on
PyPI under the ``powerline-status`` name:
.. code-block:: sh
pip install powerline-status
is the preferred method because this will get the latest release. To get current
development version
.. code-block:: sh
pip install --user git+git://github.com/powerline/powerline
may be used. If powerline was already checked out into some directory
.. code-block:: sh
pip install --user --editable={path_to_powerline}
is useful, but note that in this case ``pip`` will not install ``powerline``
executable and something like
.. code-block:: sh
ln -s {path_to_powerline}/scripts/powerline ~/.local/bin
will have to be done (:file:`~/.local/bin` should be replaced with some path
present in ``$PATH``).
.. note::
If ISP blocks git protocol for some reason github also provides ``ssh``
(``git+ssh://git@github.com/powerline/powerline``) and ``https``
(``git+https://github.com/powerline/powerline``) protocols. ``git`` protocol
should be the fastest, but least secure one though.
Fonts installation
==================
Powerline uses several special glyphs to get the arrow effect and some custom
symbols for developers. This requires that you either have a symbol font or
a patched font on your system. Your terminal emulator must also support either
patched fonts or fontconfig for Powerline to work properly.
symbols for developers. This requires having either a symbol font or a patched
font installed in the system. Used application (e.g. terminal emulator) must
also either be configured to use patched fonts (in some cases even support it
because custom glyphs live in private use area which some applications reserve
for themselves) or support fontconfig for powerline to work properly with
powerline-specific glyphs.
You can also enable :ref:`24-bit color support <config-common-term_truecolor>`
if your terminal emulator supports it (see :ref:`the terminal emulator support
:ref:`24-bit color support <config-common-term_truecolor>` may be enabled if
used terminal emulator supports it (see :ref:`the terminal emulator support
matrix <usage-terminal-emulators>`).
There are basically two ways to get powerline glyphs displayed: use
@ -99,11 +103,10 @@ Patched fonts
This method is the fallback method and works for every terminal, with the
exception of :ref:`rxvt-unicode <tips-and-tricks-urxvt>`.
Download the font of your choice from `powerline-fonts`_. If you cant find
your preferred font in the `powerline-fonts`_ repo, youll have to patch your
own font instead.
Download the font from `powerline-fonts`_. If preferred font cant be found in
the `powerline-fonts`_ repo, then patching the preferred font is needed instead.
.. _powerline-fonts: https://github.com/Lokaltog/powerline-fonts
.. _powerline-fonts: https://github.com/powerline/fonts
After downloading this font refer to platform-specific instructions.

View File

@ -4,7 +4,7 @@ Installation on Linux
The following distribution-specific packages are officially supported, and they
provide an easy way of installing and upgrading Powerline. The packages will
automatically do most of the configuration for you.
automatically do most of the configuration.
* `Arch Linux (AUR), Python 2 version <https://aur.archlinux.org/packages/python2-powerline-git/>`_
* `Arch Linux (AUR), Python 3 version <https://aur.archlinux.org/packages/python-powerline-git/>`_
@ -14,22 +14,33 @@ automatically do most of the configuration for you.
<https://packages.debian.org/search?keywords=powerline&searchon=names&suite=all&section=all>`_
to get more information.
If youre running a distribution without an official package youll have to
follow the installation guide below:
If used distribution does not have an official package installation guide below
should be followed:
1. Install Python 3.2+ or Python 2.6+ with ``pip``. This step is
distribution-specific, so no commands provided.
2. Install Powerline using the following command::
1. Install Python 3.2+, Python 2.6+ or PyPy and ``pip`` with ``setuptools``.
This step is distribution-specific, so no commands provided.
2. Install Powerline using one of the following commands:
pip install --user git+git://github.com/Lokaltog/powerline
.. code-block:: sh
pip install --user powerline-status
will get the latest release version and
.. code-block:: sh
pip install --user git+git://github.com/powerline/powerline
will get the latest development version.
.. note:: Due to the naming conflict with an unrelated project powerline is
named ``powerline-status`` in PyPI.
.. note:: If you are powerline developer you should be aware that ``pip install
--editable`` does not currently fully work. If you
install powerline this way you will be missing ``powerline`` executable and
need to symlink it. It will be located in ``scripts/powerline``.
.. note::
Powerline developers should be aware that``pip install --editable`` does
not currently fully work. Installation performed this way are missing
``powerline`` executable that needs to be symlinked. It will be located in
``scripts/powerline``.
Fonts installation
==================
@ -37,22 +48,22 @@ Fonts installation
Fontconfig
----------
This method only works on Linux. Its the recommended method if your
terminal emulator supports it as you dont have to patch any fonts, and it
generally works well with any coding font.
This method only works on Linux. Its the second recommended method if terminal
emulator supports it as patching fonts is not needed, and it generally works
with any coding font.
#. Download the latest version of the symbol font and fontconfig file::
wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
#. Move the symbol font to a valid X font path. Valid font paths can be
listed with ``xset q``::
mv PowerlineSymbols.otf ~/.fonts/
#. Update font cache for the path you moved the font to (you may need to be
root to update the cache for system-wide paths)::
#. Update font cache for the path the font was moved to (root priveleges may be
needed to update cache for the system-wide paths)::
fc-cache -vf ~/.fonts/
@ -62,37 +73,38 @@ generally works well with any coding font.
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
If you cant see the custom symbols, please close all instances of your
terminal emulator. You may need to restart X for the changes to take
effect.
If custom symbols still cannot be seen then try closing all instances of the
terminal emulator. Restarting X may be needed for the changes to take effect.
If you *still* cant see the custom symbols, double-check that you have
installed the font to a valid X font path, and that you have installed the
fontconfig file to a valid fontconfig path. Alternatively try to install
a :ref:`patched font <installation-patched-fonts>`.
If custom symbols *still* cant be seen, double-check that the font have been
installed to a valid X font path, and that the fontconfig file was installed to
a valid fontconfig path. Alternatively try to install a :ref:`patched font
<installation-patched-fonts>`.
Patched font installation
-------------------------
After downloading font you should do the following:
This is the preferred method, but it is not always available because not all
fonts were patched and not all fonts *can* be patched due to licensing issues.
After downloading font the following should be done:
#. Move the patched font to a valid X font path. Valid font paths can be
listed with ``xset q``::
mv 'MyFont for Powerline.otf' ~/.fonts/
mv 'SomeFont for Powerline.otf' ~/.fonts/
#. Update font cache for the path you moved the font to (you may need to be
root to update the cache for system-wide paths)::
#. Update font cache for the path the font was moved to (root priveleges may be
needed for updating font cache for some paths)::
fc-cache -vf ~/.fonts/
After installing the patched font you need to update Gvim or your terminal
emulator to use the patched font. The correct font usually ends with *for
Powerline*.
After installing patched font terminal emulator, GVim or whatever application
powerline should work with must be configured to use the patched font. The
correct font usually ends with *for Powerline*.
If you cant see the custom symbols, please close all instances of your
terminal emulator. You may need to restart X for the changes to take
effect.
If custom symbols cannot be seen then try closing all instances of the terminal
emulator. X server may need to be restarted for the changes to take effect.
If you *still* cant see the custom symbols, double-check that you have
installed the font to a valid X font path.
If custom symbols *still* cant be seen then double-check that the font have
been installed to a valid X font path.

View File

@ -6,25 +6,35 @@ Python package
==============
1. Install a proper Python version (see `issue #39
<https://github.com/Lokaltog/powerline/issues/39>`_ for a discussion
<https://github.com/powerline/powerline/issues/39>`_ for a discussion
regarding the required Python version on OS X)::
sudo port select python python27-apple
. You may use homebrew for this::
. Homebrew may be used here::
brew install python
.
.. note::
In case you want or have to use ``powerline.sh`` socat-based client you
should also install GNU env named ``genv``. This may be achieved by
running ``brew install coreutils``.
In case :file:`powerline.sh` as a client ``socat`` and ``coreutils`` need
to be installed. ``coreutils`` may be installed using ``brew install
coreutils``.
2. Install Powerline using the following command::
2. Install Powerline using one of the following commans:
pip install --user git+git://github.com/Lokaltog/powerline
.. code-block:: sh
pip install --user powerline-status
will get current release version and
.. code-block:: sh
pip install --user git+git://github.com/powerline/powerline
will get latest development version.
.. warning::
When using ``brew install`` to install Python one must not supply
@ -35,16 +45,16 @@ Python package
``powerline-status`` in PyPI.
.. note::
If you are powerline developer you should be aware that ``pip install
--editable`` does not currently fully work. If you install powerline this
way you will be missing ``powerline`` executable and need to symlink it. It
will be located in ``scripts/powerline``.
Powerline developers should be aware that``pip install --editable`` does
not currently fully work. Installation performed this way are missing
``powerline`` executable that needs to be symlinked. It will be located in
``scripts/powerline``.
Vim installation
================
Any terminal vim version with Python 3.2+ or Python 2.6+ support should work,
but if youre using MacVim you need to install it using the following command::
but MacVim users need to install it using the following command::
brew install macvim --env-std --override-system-vim
@ -54,6 +64,6 @@ Fonts installation
Install downloaded patched font by double-clicking the font file in Finder, then
clicking :guilabel:`Install this font` in the preview window.
After installing the patched font you need to update MacVim or your terminal
emulator to use the patched font. The correct font usually ends with *for
Powerline*.
After installing the patched font MacVim or terminal emulator (whatever
application powerline should work with) need to be configured to use the patched
font. The correct font usually ends with *for Powerline*.

View File

@ -3,7 +3,7 @@ License and credits
*******************
Powerline is licensed under the `MIT license
<https://raw.github.com/Lokaltog/powerline/develop/LICENSE>`_.
<https://raw.github.com/powerline/powerline/develop/LICENSE>`_.
..
This document is parsed by powerline_automan.py module. Do not forget to
@ -24,7 +24,7 @@ Contributors
------------
* `List of contributors
<https://github.com/Lokaltog/powerline/contributors>`_
<https://github.com/powerline/powerline/contributors>`_
* The glyphs in the font patcher are created by Fabrizio Schiavi, creator of
the excellent coding font `Pragmata Pro`_.

View File

@ -91,6 +91,10 @@ class AutoManGroup(object):
def add_argument(self, *args, **kwargs):
self.arguments.append(parse_argument(*args, **kwargs))
def add_argument_group(self, *args, **kwargs):
self.arguments.append(AutoManGroup())
return self.arguments[-1]
class SurroundWith():
def __init__(self, ret, condition, start='[', end=']'):
@ -361,7 +365,7 @@ class AutoMan(Directive):
),
ids=['author-section']
)
issues_url = 'https://github.com/Lokaltog/powerline/issues'
issues_url = 'https://github.com/powerline/powerline/issues'
reporting_bugs_section = nodes.section(
'', nodes.title(text='Reporting bugs'),
nodes.paragraph(

View File

@ -24,9 +24,9 @@ two possible explanations:
* Update brought some bug to powerline.
In the second case you, of course, should report the bug to `powerline bug
tracker <https://github.com/Lokaltog/powerline>`_. In the first you should make
sure you either have only one powerline installation or you update all of them
simultaneously (beware that in the second case you are not supported). To
tracker <https://github.com/powerline/powerline>`_. In the first you should
make sure you either have only one powerline installation or you update all of
them simultaneously (beware that in the second case you are not supported). To
diagnose this problem you may do the following:
#) If this problem is observed within the shell make sure that

View File

@ -38,3 +38,41 @@ The fancy symbols look a bit blurry or “off”!
* Make sure that you have patched all variants of your font (i.e. both the
regular and the bold font files).
I am seeing strange blocks in place of playing/paused/stopped signs
-------------------------------------------------------------------
If you are using ``powerline_unicode7`` :ref:`top-level theme
<config-common-default_top_theme>` then symbols for player segments are taken
from U+23F4U+23FA range which is missing from most fonts. You may fix the issue
by using `Symbola <http://users.teilar.gr/~g1951d/>`_ font (or any other font
which contains these glyphs).
If your terminal emulator is using fontconfig library then you can create
a fontconfig configuration file with the following contents:
.. code-block:: xml
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>Terminus</family>
<prefer><family>Symbola</family></prefer>
</alias>
</fontconfig>
(replace ``Terminus`` with the name of the font you are using). Exact sequence
of actions you need to perform is different across distributions, most likely it
will work if you put the above xml into
:file:`/etc/fonts/conf.d/99-prefer-symbola.conf`. On Gentoo you need to put it
into :file:`/etc/fonts/conf.d/99-prefer-symbola.conf` and run::
eselect fontconfig enable 99-prefer-symbola
.
.. warning::
This answer is only applicable if you use ``powerline_unicode7`` theme or if
you configured powerline to use the same characters yourself.

View File

@ -57,7 +57,7 @@ I receive an ``ImportError`` when trying to use Powerline on OS X!
sudo port select python python27-apple
* See `issue #39 <https://github.com/Lokaltog/powerline/issues/39>`_ for
* See `issue #39 <https://github.com/powerline/powerline/issues/39>`_ for
a discussion and other possible solutions for this issue.
I receive “FSEventStreamStart: register_with_server: ERROR” with status_colors

View File

@ -8,16 +8,15 @@ Application-specific requirements
Vim plugin requirements
^^^^^^^^^^^^^^^^^^^^^^^
The vim plugin requires a vim version with Python support compiled in. You
can check if your vim supports Python by running ``vim --version | grep
The vim plugin requires a vim version with Python support compiled in. Presense
of Python support in Vim can be checked by running ``vim --version | grep
+python``.
If your vim version doesnt have support for Python, youll have to compile
it with the ``--enable-pythoninterp`` flag (``--enable-python3interp`` if
you want Python 3 support instead). Note that this also requires the related
Python headers to be installed on your system. Please consult your
distributions documentation for details on how to compile and install
packages.
If Python support is absent then Vim needs to be compiled with it. To do this
use ``--enable-pythoninterp`` :file:`./configure` flag (Python 3 uses
``--enable-python3interp`` flag instead). Note that this also requires the
related Python headers to be installed. Please consult distributions
documentation for details on how to compile and install packages.
Vim version 7.4 or newer is recommended for performance reasons, but Powerline
is known to work on vim-7.0.112 (some segments may not work though as it was not
@ -28,13 +27,13 @@ actually tested).
Terminal emulator requirements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Powerline uses several special glyphs to get the arrow effect and some
custom symbols for developers. This requires that you either have a symbol
font or a patched font on your system. Your terminal emulator must also
support either patched fonts or fontconfig for Powerline to work properly.
Powerline uses several special glyphs to get the arrow effect and some custom
symbols for developers. This requires either a symbol font or a patched font
installed. Used terminal emulator must also support either patched fonts or
fontconfig for Powerline to work properly.
You can also enable :ref:`24-bit color support <config-common-term_truecolor>`
if your terminal emulator supports it.
:ref:`24-bit color support <config-common-term_truecolor>` can also be enabled
if terminal emulator supports it.
.. table:: Application/terminal emulator feature support matrix
:name: term-feature-support-matrix
@ -52,6 +51,7 @@ if your terminal emulator supports it.
Terminal.app OS X |i_yes| |i_no| |i_no|
libvte-based [#]_ Linux |i_yes| |i_yes| |i_yes| [#]_
xterm Linux |i_yes| |i_no| |i_partial| [#]_
fbterm Linux |i_yes| |i_yes| |i_no|
===================== ======= ===================== ===================== =====================
.. |i_yes| image:: _static/img/icons/tick.png

View File

@ -15,32 +15,35 @@ If installed using pip just add
python powerline_setup()
python del powerline_setup
(replace ``python`` with ``python3`` if appropriate) to your :file:`vimrc`.
(replace ``python`` with ``python3`` if appropriate) to the :file:`vimrc`.
If you just cloned the repository add the following line to your :file:`vimrc`,
where ``{repository_root}`` is the absolute path to your Powerline installation
directory:
If the repository was just cloned the following line needs to be added to the
:file:`vimrc`:
.. code-block:: vim
set rtp+={repository_root}/powerline/bindings/vim
If youre using pathogen and dont want Powerline functionality in any other
applications, simply add Powerline as a bundle and point the path above to the
Powerline bundle directory, e.g.
``~/.vim/bundle/powerline/powerline/bindings/vim``.
where ``{repository_root}`` is the absolute path to the Powerline installation
directory.
With Vundle you may instead use
If pathogen is used and Powerline functionality is not needed outside of Vim
then it is possible to simply add Powerline as a bundle and point the path above
to the Powerline bundle directory, e.g.
:file:`~/.vim/bundle/powerline/powerline/bindings/vim`.
Vundle and NeoBundle users may instead use
.. code-block:: vim
Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Bundle 'powerline/powerline', {'rtp': 'powerline/bindings/vim/'}
(replace ``Bundle`` with ``NeoBundle`` for NeoBundle).
(NeoBundle users need ``NeoBundle`` in place of ``Bundle``, otherwise setup is
the same).
For vim-addon-manager it is even easier since you dont need to write this big
path or install anything by hand: ``powerline`` is installed and run just like
any other plugin using
Vim-addon-manager setup is even easier because it is not needed to write this
big path or install anything by hand: ``powerline`` can be installed and
activated just like any other plugin using
.. code-block:: vim
@ -48,17 +51,16 @@ any other plugin using
.. warning::
*Never* install powerline with pathogen/VAM/Vundle/NeoBundle *and* with pip.
If you want powerline functionality in vim and other applications use
system-wide installation if your system has powerline package, pip-only or
``pip install --editable`` kind of installation performed on the repository
installed by Vim plugin manager.
If powerline functionality is needed in applications other then Vim then
system-wide installation (in case used OS distribution has powerline
package), pip-only or ``pip install --editable`` kind of installation
performed on the repository installed by Vim plugin manager should be used.
If you have installed powerline with pip and with some of Vim package
managers do never report any errors to powerline bug tracker, especially
errors occurring after updates.
No issues are accepted in powerline issue tracker for double pip/non-pip
installations, especially if these issues occur after update.
.. note::
If you use supplied :file:`powerline.vim` file to load powerline there are
If supplied :file:`powerline.vim` file is used to load powerline there are
additional configuration variables available: ``g:powerline_pycmd`` and
``g:powerline_pyeval``. First sets command used to load powerline: expected
values are ``"py"`` and ``"py3"``. Second sets function used in statusline,
@ -66,32 +68,32 @@ any other plugin using
If ``g:powerline_pycmd`` is set to the one of the expected values then
``g:powerline_pyeval`` will be set accordingly. If it is set to some other
value then you must also set ``g:powerline_pyeval``. Powerline will not
check that Vim is compiled with Python support if you set
``g:powerline_pycmd`` to an unexpected value.
value then ``g:powerline_pyeval`` must also be set. Powerline will not check
that Vim is compiled with Python support if ``g:powerline_pycmd`` is set to
an unexpected value.
These values are to be used to specify the only Python that is to be loaded
if you have both versions: Vim may disable loading one python version if
other was already loaded. They should also be used if you have two python
versions able to load simultaneously, but with powerline installed only for
if both versions are present: Vim may disable loading one python version if
other was already loaded. They should also be used if two python versions
are able to load simultaneously, but powerline was installed only for
python-3 version.
Tmux statusline
===============
Add the following lines to your :file:`.tmux.conf`, where ``{repository_root}``
is the absolute path to your Powerline installation directory::
Add the following lines to :file:`.tmux.conf`, where ``{repository_root}`` is
the absolute path to the Powerline installation directory::
source "{repository_root}/powerline/bindings/tmux/powerline.conf"
.. note::
The availability of the ``powerline-config`` command is required for
powerline support. You may specify location of this script via
powerline support. DLlocation of this script may be specified via
``$POWERLINE_CONFIG_COMMAND`` environment variable.
.. note::
It is advised that you run ``powerline-daemon`` before adding the above line
to tmux.conf. To do so add::
It is advised to run ``powerline-daemon`` before adding the above line to
tmux.conf. To do so add::
run-shell "powerline-daemon -q"
@ -100,18 +102,21 @@ is the absolute path to your Powerline installation directory::
IPython prompt
==============
For IPython<0.11 add the following lines to your
:file:`.ipython/ipy_user_conf.py`::
For IPython<0.11 add the following lines to :file:`.ipython/ipy_user_conf.py`:
.. code-block:: Python
# top
from powerline.bindings.ipython.pre_0_11 import setup as powerline_setup
# main() function (assuming you launched ipython without configuration to
# main() function (assuming ipython was launched without configuration to
# create skeleton ipy_user_conf.py file):
powerline_setup()
For IPython>=0.11 add the following line to your :file:`ipython_config.py`
file in the profile you are using::
For IPython>=0.11 add the following line to :file:`ipython_config.py` file in
the used profile:
.. code-block:: Python
c.InteractiveShellApp.extensions = [
'powerline.bindings.ipython.post_0_11'

View File

@ -4,19 +4,19 @@ Shell prompts
.. note::
Powerline daemon is not run automatically by any of my bindings. It is
advised that you add
advised to add
.. code-block:: bash
powerline-daemon -q
before any other powerline-related code in your shell configuration file.
before any other powerline-related code in the shell configuration file.
Bash prompt
===========
Add the following line to your :file:`bashrc`, where ``{repository_root}`` is
the absolute path to your Powerline installation directory:
Add the following line to the :file:`bashrc`, where ``{repository_root}`` is the
absolute path to the Powerline installation directory:
.. code-block:: bash
@ -34,21 +34,21 @@ the absolute path to your Powerline installation directory:
POWERLINE_BASH_SELECT=1
. {repository_root}/powerline/bindings/bash/powerline.sh
in your bash configuration file. Without ``POWERLINE_BASH_*`` variables PS2
in the bash configuration file. Without ``POWERLINE_BASH_*`` variables PS2
and PS3 prompts are computed exactly once at bash startup.
.. warning::
At maximum bash continuation PS2 and select PS3 prompts are computed each
time main PS1 prompt is computed. Do not expect it to work properly if you
e.g. put current time there.
time main PS1 prompt is computed. Thus putting e.g. current time into PS2 or
PS3 prompt will not work as expected.
At minimum they are computed once on startup.
Zsh prompt
==========
Add the following line to your :file:`zshrc`, where ``{repository_root}`` is the
absolute path to your Powerline installation directory:
Add the following line to the :file:`zshrc`, where ``{repository_root}`` is the
absolute path to the Powerline installation directory:
.. code-block:: bash
@ -57,15 +57,34 @@ absolute path to your Powerline installation directory:
Fish prompt
===========
Add the following line to your :file:`config.fish`, where ``{repository_root}``
is the absolute path to your Powerline installation directory:
Add the following line to :file:`config.fish`, where ``{repository_root}`` is
the absolute path to the Powerline installation directory:
.. code-block:: bash
set fish_function_path $fish_function_path "{repository_root}/powerline/bindings/fish"
powerline-setup
.. _tmux-statusline:
Rcsh prompt
===========
Powerline supports Plan9 rc reimplementation *by Byron Rakitzis* packaged by
many \*nix distributions. To use it add
.. code-block:: bash
. {repository_root}/powerline/bindings/rc/powerline.rc
to :file:`rcrc` file (usually :file:`~/.rcrc`) and make sure ``rc`` is started
as a login shell (with ``-l`` argument): otherwise this configuration file is
not read.
.. warning::
Original Plan9 shell and its \*nix port are not supported because they are
missing ``prompt`` special function (it is being called once before each
non-continuation prompt). Since powerline could not support shell without
this or equivalent feature some other not-so-critical features of that port
were used.
Busybox (ash), mksh and dash prompt
=====================================

View File

@ -10,15 +10,15 @@ Awesome widget
.. note:: The Powerline widget will spawn a shell script that runs in the
background and updates the statusline with ``awesome-client``.
Add the following to your :file:`rc.lua`, where ``{repository_root}`` is the
absolute path to your Powerline installation directory:
Add the following to :file:`rc.lua`, where ``{repository_root}`` is the absolute
path to Powerline installation directory:
.. code-block:: lua
package.path = package.path .. ';{repository_root}/powerline/bindings/awesome/?.lua'
require('powerline')
Then add the ``powerline_widget`` to your ``wibox``:
Then add the ``powerline_widget`` to ``wibox``:
.. code-block:: lua
@ -27,7 +27,7 @@ Then add the ``powerline_widget`` to your ``wibox``:
Qtile widget
============
Add the following to your :file:`~/.config/qtile/config.py`:
Add the following to :file:`~/.config/qtile/config.py`:
.. code-block:: python
@ -47,11 +47,12 @@ Add the following to your :file:`~/.config/qtile/config.py`:
I3 bar
======
.. note:: Until the patch is done in i3, you will need a custom ``i3bar`` build
called ``i3bgbar``. The source is available `here
.. note::
Until the patch is done in i3 a custom ``i3bar`` build called ``i3bgbar`` is
needed. The source is available `in S0lll0s/i3bgbar github repository
<https://github.com/S0lll0s/i3bgbar>`_.
Add the following to your :file:`~/.i3/config`::
Add the following to :file:`~/.i3/config`::
bar {
i3bar_command i3bgbar

View File

@ -11,8 +11,9 @@ from powerline.colorscheme import Colorscheme
from powerline.lib.config import ConfigLoader
from powerline.lib.unicode import safe_unicode, FailedUnicode
from powerline.config import DEFAULT_SYSTEM_CONFIG_DIR
from powerline.lib import mergedicts
from powerline.lib.dict import mergedicts
from powerline.lib.encoding import get_preferred_output_encoding
from powerline.lib.path import join
class NotInterceptedError(BaseException):
@ -29,7 +30,7 @@ def _find_config_files(search_paths, config_file, config_loader=None, loader_cal
config_file += '.json'
found = False
for path in search_paths:
config_file_path = os.path.join(path, config_file)
config_file_path = join(path, config_file)
if os.path.isfile(config_file_path):
yield config_file_path
found = True
@ -142,12 +143,12 @@ def get_config_paths():
:return: list of paths
'''
config_home = os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config'))
config_path = os.path.join(config_home, 'powerline')
config_path = join(config_home, 'powerline')
config_paths = [config_path]
config_dirs = os.environ.get('XDG_CONFIG_DIRS', DEFAULT_SYSTEM_CONFIG_DIR)
if config_dirs is not None:
config_paths[:0] = reversed([os.path.join(d, 'powerline') for d in config_dirs.split(':')])
plugin_path = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'config_files')
config_paths[:0] = reversed([join(d, 'powerline') for d in config_dirs.split(':')])
plugin_path = join(os.path.realpath(os.path.dirname(__file__)), 'config_files')
config_paths.insert(0, plugin_path)
return config_paths
@ -258,6 +259,7 @@ def finish_common_config(encoding, common_config):
common_config.setdefault('log_level', 'WARNING')
common_config.setdefault('log_format', '%(asctime)s:%(levelname)s:%(message)s')
common_config.setdefault('term_truecolor', False)
common_config.setdefault('term_escape_style', 'auto')
common_config.setdefault('ambiwidth', 1)
common_config.setdefault('additional_escapes', None)
common_config.setdefault('reload_config', True)
@ -423,6 +425,14 @@ class Powerline(object):
Usually returns encoding of the current locale.
'''
def create_logger(self):
'''Create logger
This function is used to create logger unless it was already specified
at initialization.
'''
return create_logger(self.common_config, self.default_log_stream)
def create_renderer(self, load_main=False, load_colors=False, load_colorscheme=False, load_theme=False):
'''(Re)create renderer object. Can be used after Powerline object was
successfully initialized. If any of the below parameters except
@ -460,7 +470,7 @@ class Powerline(object):
self.import_paths = self.common_config['paths']
if not self.logger:
self.logger = create_logger(self.common_config, self.default_log_stream)
self.logger = self.create_logger()
if not self.pl:
self.pl = PowerlineLogger(self.use_daemon_threads, self.logger, self.ext)
@ -474,6 +484,7 @@ class Powerline(object):
mergedicts(self.renderer_options, dict(
pl=self.pl,
term_truecolor=self.common_config['term_truecolor'],
term_escape_style=self.common_config['term_escape_style'],
ambiwidth=self.common_config['ambiwidth'],
tmux_escape=self.common_config['additional_escapes'] == 'tmux',
screen_escape=self.common_config['additional_escapes'] == 'screen',
@ -753,7 +764,10 @@ class Powerline(object):
self.exception('Failed to render: {0}', str(e))
except Exception as e:
exc = e
return FailedUnicode(safe_unicode(exc))
ret = FailedUnicode(safe_unicode(exc))
if kwargs.get('output_width', False):
ret = ret, len(ret)
return ret
def render_above_lines(self, *args, **kwargs):
'''Like .render(), but for ``self.renderer.render_above_lines()``

View File

@ -41,22 +41,22 @@ _powerline_init_tmux_support() {
_powerline_local_prompt() {
# Arguments: side, renderer_module arg, last_exit_code, jobnum, local theme
$POWERLINE_COMMAND shell $1 \
"$POWERLINE_COMMAND" $POWERLINE_COMMAND_ARGS shell $1 \
$2 \
--last_exit_code=$3 \
--last-exit-code=$3 \
--jobnum=$4 \
--renderer_arg="client_id=$$" \
--renderer_arg="local_theme=$5"
--renderer-arg="client_id=$$" \
--renderer-arg="local_theme=$5"
}
_powerline_prompt() {
# Arguments: side, last_exit_code, jobnum
$POWERLINE_COMMAND shell $1 \
"$POWERLINE_COMMAND" $POWERLINE_COMMAND_ARGS shell $1 \
--width="${COLUMNS:-$(_powerline_columns_fallback)}" \
-r.bash \
--last_exit_code=$2 \
--last-exit-code=$2 \
--jobnum=$3 \
--renderer_arg="client_id=$$"
--renderer-arg="client_id=$$"
}
_powerline_set_prompt() {
@ -75,7 +75,7 @@ _powerline_set_prompt() {
_powerline_setup_prompt() {
VIRTUAL_ENV_DISABLE_PROMPT=1
if test -z "${POWERLINE_COMMAND}" ; then
POWERLINE_COMMAND="$("$POWERLINE_CONFIG" shell command)"
POWERLINE_COMMAND="$("$POWERLINE_CONFIG_COMMAND" shell command)"
fi
test "x$PROMPT_COMMAND" != "x${PROMPT_COMMAND%_powerline_set_prompt*}" ||
PROMPT_COMMAND=$'_powerline_set_prompt\n'"${PROMPT_COMMAND}"
@ -83,17 +83,17 @@ _powerline_setup_prompt() {
PS3="$(_powerline_local_prompt left '' 0 0 select)"
}
if test -z "${POWERLINE_CONFIG}" ; then
if test -z "${POWERLINE_CONFIG_COMMAND}" ; then
if which powerline-config >/dev/null ; then
POWERLINE_CONFIG=powerline-config
POWERLINE_CONFIG_COMMAND=powerline-config
else
POWERLINE_CONFIG="$(dirname "$BASH_SOURCE")/../../../scripts/powerline-config"
POWERLINE_CONFIG_COMMAND="$(dirname "$BASH_SOURCE")/../../../scripts/powerline-config"
fi
fi
if "${POWERLINE_CONFIG}" shell --shell=bash uses prompt ; then
if "${POWERLINE_CONFIG_COMMAND}" shell --shell=bash uses prompt ; then
_powerline_setup_prompt
fi
if "${POWERLINE_CONFIG}" shell --shell=bash uses tmux ; then
if "${POWERLINE_CONFIG_COMMAND}" shell --shell=bash uses tmux ; then
_powerline_init_tmux_support
fi

View File

@ -8,11 +8,12 @@ import sys
from powerline.config import POWERLINE_ROOT, TMUX_CONFIG_DIRECTORY
from powerline.lib.config import ConfigLoader
from powerline import generate_config_finder, load_config, create_logger, PowerlineLogger, finish_common_config
from powerline.tmux import TmuxPowerline
from powerline.shell import ShellPowerline
from powerline.lib.shell import which
from powerline.bindings.tmux import TmuxVersionInfo, run_tmux_command, set_tmux_environment, get_tmux_version
from powerline.lib.encoding import get_preferred_output_encoding
from powerline.renderers.tmux import attr_to_tmux_attr
from powerline.renderers.tmux import attrs_to_tmux_attrs
from powerline.commands.main import finish_args
CONFIG_FILE_NAME = re.compile(r'powerline_tmux_(?P<major>\d+)\.(?P<minor>\d+)(?P<suffix>[a-z]+)?(?:_(?P<mod>plus|minus))?\.conf')
@ -77,10 +78,19 @@ def source_tmux_files(pl, args):
run_tmux_command('refresh-client')
def init_environment(pl, args):
class EmptyArgs(object):
def __init__(self, ext, config_path):
self.ext = [ext]
self.config_path = None
def __getattr__(self, attr):
return None
def init_tmux_environment(pl, args):
'''Initialize tmux environment from tmux configuration
'''
powerline = TmuxPowerline(args.config_path)
powerline = ShellPowerline(finish_args(os.environ, EmptyArgs('tmux', args.config_path)))
# TODO Move configuration files loading out of Powerline object and use it
# directly
powerline.update_renderer()
@ -116,29 +126,34 @@ def init_environment(pl, args):
powerline.renderer.hlstyle(
fg=prev_highlight['bg'],
bg=next_highlight['bg'],
attr=0,
attrs=0,
)[2:-1]
)
for varname, attr, group in (
('_POWERLINE_ACTIVE_WINDOW_FG', 'fg', 'active_window_status'),
('_POWERLINE_WINDOW_STATUS_FG', 'fg', 'window_status'),
('_POWERLINE_ACTIVITY_STATUS_FG', 'fg', 'activity_status'),
('_POWERLINE_ACTIVITY_STATUS_ATTR', 'attr', 'activity_status'),
('_POWERLINE_ACTIVITY_STATUS_ATTR', 'attrs', 'activity_status'),
('_POWERLINE_BELL_STATUS_FG', 'fg', 'bell_status'),
('_POWERLINE_BELL_STATUS_ATTR', 'attr', 'bell_status'),
('_POWERLINE_BELL_STATUS_ATTR', 'attrs', 'bell_status'),
('_POWERLINE_BACKGROUND_FG', 'fg', 'background'),
('_POWERLINE_BACKGROUND_BG', 'bg', 'background'),
('_POWERLINE_SESSION_FG', 'fg', 'session'),
('_POWERLINE_SESSION_BG', 'bg', 'session'),
('_POWERLINE_SESSION_ATTR', 'attr', 'session'),
('_POWERLINE_SESSION_ATTR', 'attrs', 'session'),
('_POWERLINE_SESSION_PREFIX_FG', 'fg', 'session:prefix'),
('_POWERLINE_SESSION_PREFIX_BG', 'bg', 'session:prefix'),
('_POWERLINE_SESSION_PREFIX_ATTR', 'attr', 'session:prefix'),
('_POWERLINE_SESSION_PREFIX_ATTR', 'attrs', 'session:prefix'),
):
if attr == 'attr':
attrs = attr_to_tmux_attr(get_highlighting(group)[attr])
if attr == 'attrs':
attrs = attrs_to_tmux_attrs(get_highlighting(group)[attr])
set_tmux_environment(varname, ']#['.join(attrs))
set_tmux_environment(varname + '_LEGACY', ','.join(attrs))
set_tmux_environment(varname + '_LEGACY', (','.join(
# Tmux-1.6 does not accept no… attributes in
# window-status-…-attr options.
(attr for attr in attrs if not attr.startswith('no')))
# But it does not support empty attributes as well.
or 'none'))
else:
set_tmux_environment(varname, 'colour' + str(get_highlighting(group)[attr][0]))
@ -149,6 +164,11 @@ def init_environment(pl, args):
' ' * powerline.renderer.strwidth(left_dividers['hard'])))
def tmux_setup(pl, args):
init_tmux_environment(pl, args)
source_tmux_files(pl, args)
def get_main_config(args):
find_config_files = generate_config_finder()
config_loader = ConfigLoader(run_once=True)

View File

@ -21,36 +21,35 @@ function powerline-setup
end
end
if test -z "$POWERLINE_CONFIG"
if test -z "$POWERLINE_CONFIG_COMMAND"
if which powerline-config >/dev/null
set -g POWERLINE_CONFIG powerline-config
set -g POWERLINE_CONFIG_COMMAND powerline-config
else
set -g POWERLINE_CONFIG (dirname (status -f))/../../../scripts/powerline-config
set -g POWERLINE_CONFIG_COMMAND (dirname (status -f))/../../../scripts/powerline-config
end
end
if eval $POWERLINE_CONFIG shell --shell=fish uses prompt
if env $POWERLINE_CONFIG_COMMAND shell --shell=fish uses prompt
if test -z "$POWERLINE_COMMAND"
set -g POWERLINE_COMMAND (eval $POWERLINE_CONFIG shell command)
end
function --on-variable fish_bind_mode _powerline_bind_mode
set -g -x _POWERLINE_MODE $fish_bind_mode
set -g POWERLINE_COMMAND (env $POWERLINE_CONFIG_COMMAND shell command)
end
function --on-variable fish_key_bindings _powerline_set_default_mode
if test x$fish_key_bindings != xfish_vi_key_bindings
set -g -x _POWERLINE_DEFAULT_MODE default
set -g _POWERLINE_DEFAULT_MODE default
else
set -g -e _POWERLINE_DEFAULT_MODE
end
end
function --on-variable POWERLINE_COMMAND _powerline_update
set -l addargs "--last_exit_code=\$status"
set -l addargs "$addargs --last_pipe_status=\$status"
set -l addargs "--last-exit-code=\$status"
set -l addargs "$addargs --last-pipe-status=\$status"
set -l addargs "$addargs --jobnum=(jobs -p | wc -l)"
# One random value has an 1/32767 = 0.0031% probability of having
# the same value in two shells
set -l addargs "$addargs --renderer_arg=client_id="(random)
set -l addargs "$addargs --renderer-arg=client_id="(random)
set -l addargs "$addargs --width=\$_POWERLINE_COLUMNS"
set -l addargs "$addargs --renderer-arg=mode=\$fish_bind_mode"
set -l addargs "$addargs --renderer-arg=default_mode=\$_POWERLINE_DEFAULT_MODE"
set -l promptside
set -l rpromptpast
set -l columnsexpr
@ -65,10 +64,10 @@ function powerline-setup
end
eval "
function fish_prompt
$POWERLINE_COMMAND shell $promptside $addargs
env \$POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS shell $promptside $addargs
end
function fish_right_prompt
$POWERLINE_COMMAND shell right $addargs
env \$POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS shell right $addargs
$rpromptpast
end
function --on-signal WINCH _powerline_set_columns
@ -81,7 +80,7 @@ function powerline-setup
_powerline_set_default_mode
_powerline_update
end
if eval $POWERLINE_CONFIG shell --shell=fish uses tmux
if env $POWERLINE_CONFIG_COMMAND shell --shell=fish uses tmux
if test -n "$TMUX"
if tmux refresh -S ^/dev/null
function _powerline_tmux_setenv

View File

@ -72,7 +72,7 @@ class ConfigurableIPythonPowerline(IPythonPowerline):
config = ip.config.Powerline
self.config_overrides = config.get('config_overrides')
self.theme_overrides = config.get('theme_overrides', {})
self.paths = config.get('paths')
self.config_paths = config.get('config_paths')
super(ConfigurableIPythonPowerline, self).init()
def do_setup(self, ip, shutdown_hook):

View File

@ -95,10 +95,10 @@ class PowerlinePrompt2(PowerlinePromptOut):
class ConfigurableIPythonPowerline(IPythonPowerline):
def init(self, config_overrides=None, theme_overrides={}, paths=None):
def init(self, config_overrides=None, theme_overrides={}, config_paths=None):
self.config_overrides = config_overrides
self.theme_overrides = theme_overrides
self.paths = paths
self.config_paths = config_paths
super(ConfigurableIPythonPowerline, self).init()
def ipython_magic(self, ip, parameter_s=''):

View File

@ -0,0 +1,84 @@
fn _powerline_sigwinch {
_POWERLINE_COLUMNS = `{
stty size | cut -d' ' -f2
}
_powerline_tmux_setenv COLUMNS $_POWERLINE_COLUMNS
}
fn _powerline_update_pwd {
_POWERLINE_NEW_PWD = `{pwd}
if (test $^_POWERLINE_NEW_PWD '=' $^_POWERLINE_SAVED_PWD) {
_POWERLINE_SAVED_PWD = $_POWERLINE_NEW_PWD
_powerline_tmux_setenv PWD $_POWERLINE_SAVED_PWD
}
}
fn _powerline_continuation_prompt {
_powerline_prompt --renderer-arg 'local_theme=continuation' $*
}
fn _powerline_prompt {
$POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS shell aboveleft -r.rcsh --last-pipe-status $^_POWERLINE_STATUS --last-exit-code $_POWERLINE_STATUS($#_POWERLINE_STATUS) --jobnum $_POWERLINE_JOBNUM --renderer-arg 'client_id='$pid $*
}
fn _powerline_set_prompt {
_POWERLINE_STATUS = ( $status )
_POWERLINE_JOBNUM = $#apids
prompt = (``() {
_powerline_prompt
} ``() {
_powerline_continuation_prompt
})
_powerline_update_pwd
}
fn _powerline_common_setup {
fn sigwinch {
_powerline_sigwinch
}
_powerline_sigwinch
_POWERLINE_SAVED_PWD = ''
}
fn _powerline_tmux_setenv {
}
if (test -z $POWERLINE_CONFIG_COMMAND) {
if (which powerline-config >/dev/null) {
POWERLINE_CONFIG_COMMAND = powerline-config
} else {
echo powerline-config executable not found, unable to proceed >[2=1]
}
}
if (test x$POWERLINE_CONFIG_COMMAND '!=' x) {
if ($POWERLINE_CONFIG_COMMAND shell --shell rcsh uses prompt) {
if (test x$POWERLINE_COMMAND_ARGS '!=' x) {
# Perform splitting
POWERLINE_COMMAND_ARGS=( `{echo $POWERLINE_COMMAND_ARGS} )
}
fn prompt {
_powerline_set_prompt
}
if (test -z $POWERLINE_SHELL_CONTINUATION$POWERLINE_RCSH_CONTINUATION) {
_POWERLINE_STATUS = 0
_POWERLINE_JOBNUM = 0
_POWERLINE_CONTINUATION = `{
_powerline_continuation_prompt
}
fn _powerline_continuation_prompt {
echo -n $_POWERLINE_CONTINUATION
}
}
_powerline_common_setup
}
if (test x$TMUX '!=' x) {
if ($POWERLINE_CONFIG_COMMAND shell --shell rcsh uses tmux) {
_POWERLINE_TMUX=$TMUX
fn _powerline_tmux_setenv {
if (test x$2 '!=' x) {
TMUX=$_POWERLINE_TMUX tmux setenv -g TMUX_$1^_`{
TMUX=$_POWERLINE_TMUX tmux display -p '#D' | tr -d %
} $2
}
}
_powerline_common_setup
}
}
}
# vim: ft=rcshell

View File

@ -100,7 +100,7 @@ _powerline_set_set_jobs() {
_powerline_set_command() {
if test -z "${POWERLINE_COMMAND}" ; then
POWERLINE_COMMAND="$("$POWERLINE_CONFIG" shell command)"
POWERLINE_COMMAND="$("$POWERLINE_CONFIG_COMMAND" shell command)"
fi
}
@ -136,22 +136,22 @@ _powerline_set_jobs() {
_powerline_local_prompt() {
# Arguments: side, exit_code, local theme
_powerline_set_jobs
$POWERLINE_COMMAND shell $1 \
"$POWERLINE_COMMAND" $POWERLINE_COMMAND_ARGS shell $1 \
$_POWERLINE_RENDERER_ARG \
--renderer_arg="client_id=$$" \
--last_exit_code=$2 \
--renderer-arg="client_id=$$" \
--last-exit-code=$2 \
--jobnum=$_POWERLINE_JOBS \
--renderer_arg="local_theme=$3"
--renderer-arg="local_theme=$3"
}
_powerline_prompt() {
# Arguments: side, exit_code
_powerline_set_jobs
$POWERLINE_COMMAND shell $1 \
"$POWERLINE_COMMAND" $POWERLINE_COMMAND_ARGS shell $1 \
--width="${COLUMNS:-$(_powerline_columns_fallback)}" \
$_POWERLINE_RENDERER_ARG \
--renderer_arg="client_id=$$" \
--last_exit_code=$2 \
--renderer-arg="client_id=$$" \
--last-exit-code=$2 \
--jobnum=$_POWERLINE_JOBS
_powerline_update_psN
}
@ -214,11 +214,11 @@ _powerline_init_tmux_support() {
fi
}
if test -z "${POWERLINE_CONFIG}" ; then
if test -z "${POWERLINE_CONFIG_COMMAND}" ; then
if which powerline-config >/dev/null ; then
POWERLINE_CONFIG=powerline-config
POWERLINE_CONFIG_COMMAND=powerline-config
else
POWERLINE_CONFIG="$(dirname "$_POWERLINE_SOURCED")/../../../scripts/powerline-config"
POWERLINE_CONFIG_COMMAND="$(dirname "$_POWERLINE_SOURCED")/../../../scripts/powerline-config"
fi
fi
@ -227,9 +227,9 @@ _POWERLINE_USED_SHELL=${0#-}
_POWERLINE_USED_SHELL=${_POWERLINE_USED_SHELL#/usr}
_POWERLINE_USED_SHELL=${_POWERLINE_USED_SHELL#/bin/}
if "${POWERLINE_CONFIG}" shell uses tmux ; then
if "${POWERLINE_CONFIG_COMMAND}" shell uses tmux ; then
_powerline_init_tmux_support $_POWERLINE_USED_SHELL
fi
if "${POWERLINE_CONFIG}" shell --shell=bash uses prompt ; then
if "${POWERLINE_CONFIG_COMMAND}" shell --shell=bash uses prompt ; then
_powerline_setup_prompt $_POWERLINE_USED_SHELL
fi

View File

@ -5,42 +5,45 @@
# Guess this relies on `$_` being set as to last argument to previous command
# which must be `.` or `source` in this case
set POWERLINE_SOURCED=($_)
if ! $?POWERLINE_CONFIG then
if ! $?POWERLINE_CONFIG_COMMAND then
if ( { which powerline-config > /dev/null } ) then
set POWERLINE_CONFIG="powerline-config"
set POWERLINE_CONFIG_COMMAND="powerline-config"
else
set POWERLINE_CONFIG="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config"
set POWERLINE_CONFIG_COMMAND="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config"
endif
else
if "$POWERLINE_CONFIG" == "" then
if "$POWERLINE_CONFIG_COMMAND" == "" then
if ( { which powerline-config > /dev/null } ) then
set POWERLINE_CONFIG="powerline-config"
set POWERLINE_CONFIG_COMMAND="powerline-config"
else
set POWERLINE_CONFIG="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config"
set POWERLINE_CONFIG_COMMAND="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config"
endif
endif
endif
if ( { $POWERLINE_CONFIG shell --shell=tcsh uses tmux } ) then
if ( { $POWERLINE_CONFIG_COMMAND shell --shell=tcsh uses tmux } ) then
alias _powerline_tmux_set_pwd 'if ( $?TMUX && { tmux refresh -S >&/dev/null } ) tmux setenv -g TMUX_PWD_`tmux display -p "#D" | tr -d %` $PWD:q ; if ( $?TMUX ) tmux refresh -S >&/dev/null'
alias cwdcmd "`alias cwdcmd` ; _powerline_tmux_set_pwd"
endif
if ( { $POWERLINE_CONFIG shell --shell=tcsh uses prompt } ) then
if ( { $POWERLINE_CONFIG_COMMAND shell --shell=tcsh uses prompt } ) then
if ! $?POWERLINE_COMMAND then
set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`"
set POWERLINE_COMMAND="`$POWERLINE_CONFIG_COMMAND:q shell command`"
else
if "$POWERLINE_COMMAND" == "" then
set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`"
set POWERLINE_COMMAND="`$POWERLINE_CONFIG_COMMAND:q shell command`"
endif
endif
if ! $?POWERLINE_COMMAND_ARGS then
set POWERLINE_COMMAND_ARGS=""
endif
if ( $?POWERLINE_NO_TCSH_ABOVE || $?POWERLINE_NO_SHELL_ABOVE ) then
alias _powerline_above true
else
alias _powerline_above '$POWERLINE_COMMAND shell above --renderer_arg=client_id=$$ --last_exit_code=$POWERLINE_STATUS --width=$POWERLINE_COLUMNS'
alias _powerline_above '$POWERLINE_COMMAND:q $POWERLINE_COMMAND_ARGS shell above --renderer-arg=client_id=$$ --last-exit-code=$POWERLINE_STATUS --width=$POWERLINE_COLUMNS'
endif
alias _powerline_set_prompt 'set prompt="`$POWERLINE_COMMAND shell left -r .tcsh --renderer_arg=client_id=$$ --last_exit_code=$POWERLINE_STATUS --width=$POWERLINE_COLUMNS`"'
alias _powerline_set_rprompt 'set rprompt="`$POWERLINE_COMMAND shell right -r .tcsh --renderer_arg=client_id=$$ --last_exit_code=$POWERLINE_STATUS --width=$POWERLINE_COLUMNS` "'
alias _powerline_set_prompt 'set prompt="`$POWERLINE_COMMAND:q $POWERLINE_COMMAND_ARGS shell left -r .tcsh --renderer-arg=client_id=$$ --last-exit-code=$POWERLINE_STATUS --width=$POWERLINE_COLUMNS`"'
alias _powerline_set_rprompt 'set rprompt="`$POWERLINE_COMMAND:q $POWERLINE_COMMAND_ARGS shell right -r .tcsh --renderer-arg=client_id=$$ --last-exit-code=$POWERLINE_STATUS --width=$POWERLINE_COLUMNS` "'
alias _powerline_set_columns 'set POWERLINE_COLUMNS=`stty size|cut -d" " -f2` ; set POWERLINE_COLUMNS=`expr $POWERLINE_COLUMNS - 2`'
alias precmd 'set POWERLINE_STATUS=$? ; '"`alias precmd`"' ; _powerline_set_columns ; _powerline_above ; _powerline_set_prompt ; _powerline_set_rprompt'

View File

@ -2,7 +2,7 @@ set -g status on
set -g status-utf8 on
set -g status-interval 2
set -g status-left-length 20
set -g status-right '#(eval $POWERLINE_COMMAND tmux right -R pane_id=`tmux display -p "#D"`)'
set -g status-right '#(env "$POWERLINE_COMMAND" $POWERLINE_COMMAND_ARGS tmux right -R pane_id=`tmux display -p "#D"`)'
set -g status-right-length 150
set -g window-status-format "#[$_POWERLINE_WINDOW_COLOR]$_POWERLINE_LEFT_HARD_DIVIDER_SPACES#I #[$_POWERLINE_WINDOW_DIVIDER_COLOR]$_POWERLINE_LEFT_SOFT_DIVIDER#[default]#W $_POWERLINE_LEFT_HARD_DIVIDER_SPACES"
set -g window-status-current-format "#[$_POWERLINE_WINDOW_CURRENT_HARD_DIVIDER_COLOR]$_POWERLINE_LEFT_HARD_DIVIDER#[$_POWERLINE_WINDOW_CURRENT_COLOR]#I $_POWERLINE_LEFT_SOFT_DIVIDER#[$_POWERLINE_WINDOW_NAME_COLOR]#W #[$_POWERLINE_WINDOW_CURRENT_HARD_DIVIDER_NEXT_COLOR]$_POWERLINE_LEFT_HARD_DIVIDER"

View File

@ -1,9 +1,2 @@
if-shell 'test -z "$POWERLINE_CONFIG_COMMAND"' 'set-environment -g POWERLINE_CONFIG_COMMAND powerline-config'
run-shell 'eval $POWERLINE_CONFIG_COMMAND tmux setenv'
# Simplify tmux version checking by using multiple config files. Source these
# config files based on the version in which tmux features were added and/or
# deprecated. By splitting these configuration options into separate files,
run-shell 'eval $POWERLINE_CONFIG_COMMAND tmux source'
if-shell 'test -z "$POWERLINE_CONFIG_COMMAND"' 'set-environment -g POWERLINE_CONFIG_COMMAND powerline-config; run-shell "env \"\$POWERLINE_CONFIG_COMMAND\" tmux setup"' 'run-shell "env \"\$POWERLINE_CONFIG_COMMAND\" tmux setup"'
# vim: ft=tmux

View File

@ -1,5 +1,5 @@
# powerline_tmux_1.8_plus.conf
# tmux Version 1.8 introduces the 'client_prefix' format variable, applicable
# for versions 1.8+
set -qg status-left "#{?client_prefix,#[fg=$_POWERLINE_SESSION_PREFIX_FG]#[bg=$_POWERLINE_SESSION_PREFIX_BG]#[$_POWERLINE_SESSION_PREFIX_ATTR],#[fg=$_POWERLINE_SESSION_FG]#[bg=$_POWERLINE_SESSION_BG]#[$_POWERLINE_SESSION_ATTR]} #S #{?client_prefix,#[fg=$_POWERLINE_SESSION_PREFIX_BG],#[fg=$_POWERLINE_SESSION_BG]}#[bg=$_POWERLINE_BACKGROUND_BG]#[nobold]$_POWERLINE_LEFT_HARD_DIVIDER#(eval \$POWERLINE_COMMAND tmux left)"
set -qg status-left "#{?client_prefix,#[fg=$_POWERLINE_SESSION_PREFIX_FG]#[bg=$_POWERLINE_SESSION_PREFIX_BG]#[$_POWERLINE_SESSION_PREFIX_ATTR],#[fg=$_POWERLINE_SESSION_FG]#[bg=$_POWERLINE_SESSION_BG]#[$_POWERLINE_SESSION_ATTR]} #S #{?client_prefix,#[fg=$_POWERLINE_SESSION_PREFIX_BG],#[fg=$_POWERLINE_SESSION_BG]}#[bg=$_POWERLINE_BACKGROUND_BG]#[nobold]$_POWERLINE_LEFT_HARD_DIVIDER#(env \$POWERLINE_COMMAND \$POWERLINE_COMMAND_ARGS tmux left)"
# vim: ft=tmux

View File

@ -12,10 +12,36 @@ except ImportError:
from powerline.lib.unicode import unicode
try:
vim_encoding = vim.eval('&encoding')
except AttributeError:
vim_encoding = 'utf-8'
if (
hasattr(vim, 'options')
and hasattr(vim, 'vvars')
and vim.vvars['version'] > 703
):
if sys.version_info < (3,):
def get_vim_encoding():
return vim.options['encoding'] or 'ascii'
else:
def get_vim_encoding():
return vim.options['encoding'].decode('ascii') or 'ascii'
elif hasattr(vim, 'eval'):
def get_vim_encoding():
return vim.eval('&encoding') or 'ascii'
else:
def get_vim_encoding():
return 'utf-8'
get_vim_encoding.__doc__ = (
'''Get encoding used for Vim strings
:return:
Value of ``&encoding``. If it is empty (i.e. Vim is compiled
without +multibyte) returns ``'ascii'``. When building documentation
outputs ``'utf-8'`` unconditionally.
'''
)
vim_encoding = get_vim_encoding()
python_to_vim_types = {
@ -24,6 +50,11 @@ python_to_vim_types = {
ord('\''): '\'\'',
}).encode(vim_encoding)) + b'\''
),
list: (
lambda o: b'[' + (
b','.join((python_to_vim(i) for i in o))
) + b']'
),
bytes: (lambda o: b'\'' + o.replace(b'\'', b'\'\'') + b'\''),
int: (str if str is bytes else (lambda o: unicode(o).encode('ascii'))),
}
@ -158,7 +189,7 @@ _vim_exists = vim_get_func('exists', rettype='int')
# It may crash on some old vim versions and I do not remember in which patch
# I fixed this crash.
if hasattr(vim, 'vvars') and vim.vvars['version'] > 703:
if hasattr(vim, 'vvars') and vim.vvars[str('version')] > 703:
_vim_to_python_types = {
getattr(vim, 'Dictionary', None) or type(vim.bindeval('{}')):
lambda value: dict((

View File

@ -8,10 +8,11 @@ from weakref import WeakValueDictionary, ref
import zsh
from powerline.shell import ShellPowerline
from powerline.lib import parsedotval
from powerline.lib.unicode import unicode
from powerline.lib.overrides import parsedotval, parse_override_var
from powerline.lib.unicode import unicode, u
from powerline.lib.encoding import (get_preferred_output_encoding,
get_preferred_environment_encoding)
from powerline.lib.dict import mergeargs
used_powerlines = WeakValueDictionary()
@ -24,7 +25,13 @@ def shutdown():
def get_var_config(var):
try:
return [parsedotval(i) for i in zsh.getvalue(var).items()]
val = zsh.getvalue(var)
if isinstance(val, dict):
return mergeargs([parsedotval((u(k), u(v))) for k, v in val.items()])
elif isinstance(val, (unicode, str, bytes)):
return mergeargs(parse_override_var(u(val)))
else:
return None
except:
return None
@ -35,18 +42,12 @@ class Args(object):
renderer_module = '.zsh'
@property
def config(self):
try:
return get_var_config('POWERLINE_CONFIG')
except IndexError:
return None
def config_override(self):
return get_var_config('POWERLINE_CONFIG_OVERRIDES')
@property
def theme_option(self):
try:
return get_var_config('POWERLINE_THEME_CONFIG')
except IndexError:
return None
def theme_override(self):
return get_var_config('POWERLINE_THEME_OVERRIDES')
@property
def config_path(self):
@ -56,7 +57,11 @@ class Args(object):
return None
else:
if isinstance(ret, (unicode, str, bytes)):
return ret.split(type(ret)(':'))
return [
path
for path in ret.split((b':' if isinstance(ret, bytes) else ':'))
if path
]
else:
return ret
@ -96,7 +101,7 @@ class Environment(object):
return False
environ = Environment()
environ = getattr(zsh, 'environ', Environment())
class ZshPowerline(ShellPowerline):
@ -132,6 +137,14 @@ class Prompt(object):
def __str__(self):
zsh.eval('_POWERLINE_PARSER_STATE="${(%):-%_}"')
zsh.eval('_POWERLINE_SHORTENED_PATH="${(%):-%~}"')
try:
mode = u(zsh.getvalue('_POWERLINE_MODE'))
except IndexError:
mode = None
try:
default_mode = u(zsh.getvalue('_POWERLINE_DEFAULT_MODE'))
except IndexError:
default_mode = None
segment_info = {
'args': self.args,
'environ': environ,
@ -139,6 +152,8 @@ class Prompt(object):
'local_theme': self.theme,
'parser_state': zsh.getvalue('_POWERLINE_PARSER_STATE'),
'shortened_path': zsh.getvalue('_POWERLINE_SHORTENED_PATH'),
'mode': mode,
'default_mode': default_mode,
}
zsh.setvalue('_POWERLINE_PARSER_STATE', None)
zsh.setvalue('_POWERLINE_SHORTENED_PATH', None)
@ -157,6 +172,7 @@ class Prompt(object):
width=zsh.columns(),
side=self.side,
segment_info=segment_info,
mode=mode,
)
if type(r) is not str:
if type(r) is bytes:
@ -189,6 +205,11 @@ def reload():
powerline.reload()
def reload_config():
for powerline in used_powerlines.values():
powerline.create_renderer(load_main=True, load_colors=True, load_colorscheme=True, load_theme=True)
def setup(zsh_globals):
powerline = ZshPowerline()
powerline.setup(zsh_globals)

View File

@ -60,7 +60,7 @@ _powerline_init_modes_support() {
}
function -g _powerline_set_true_keymap_name() {
export _POWERLINE_MODE="${1}"
_POWERLINE_MODE="${1}"
local plm_bk="$(bindkey -lL ${_POWERLINE_MODE})"
if [[ $plm_bk = 'bindkey -A'* ]] ; then
_powerline_set_true_keymap_name ${(Q)${${(z)plm_bk}[3]}}
@ -83,7 +83,7 @@ _powerline_init_modes_support() {
_powerline_set_main_keymap_name
if [[ "$_POWERLINE_MODE" != vi* ]] ; then
export _POWERLINE_DEFAULT_MODE="$_POWERLINE_MODE"
_POWERLINE_DEFAULT_MODE="$_POWERLINE_MODE"
fi
precmd_functions+=( _powerline_set_main_keymap_name )
@ -129,28 +129,35 @@ _powerline_setup_prompt() {
zpython '_powerline_reload()'
zpython 'del _powerline_reload'
}
powerline-reload-config() {
zpython 'from powerline.bindings.zsh import reload_config as _powerline_reload_config'
zpython '_powerline_reload_config()'
zpython 'del _powerline_reload_config'
}
else
if test -z "${POWERLINE_COMMAND}" ; then
POWERLINE_COMMAND="$($POWERLINE_CONFIG shell command)"
POWERLINE_COMMAND="$($POWERLINE_CONFIG_COMMAND shell command)"
fi
local add_args='-r .zsh'
add_args+=' --last_exit_code=$?'
add_args+=' --last_pipe_status="$pipestatus"'
add_args+=' --renderer_arg="client_id=$$"'
add_args+=' --renderer_arg="shortened_path=${(%):-%~}"'
add_args+=' --last-exit-code=$?'
add_args+=' --last-pipe-status="$pipestatus"'
add_args+=' --renderer-arg="client_id=$$"'
add_args+=' --renderer-arg="shortened_path=${(%):-%~}"'
add_args+=' --jobnum=$_POWERLINE_JOBNUM'
local new_args_2=' --renderer_arg="parser_state=${(%%):-%_}"'
new_args_2+=' --renderer_arg="local_theme=continuation"'
local add_args_3=$add_args' --renderer_arg="local_theme=select"'
add_args+=' --renderer-arg="mode=$_POWERLINE_MODE"'
add_args+=' --renderer-arg="default_mode=$_POWERLINE_DEFAULT_MODE"'
local new_args_2=' --renderer-arg="parser_state=${(%%):-%_}"'
new_args_2+=' --renderer-arg="local_theme=continuation"'
local add_args_3=$add_args' --renderer-arg="local_theme=select"'
local add_args_2=$add_args$new_args_2
add_args+=' --width=$(( ${COLUMNS:-$(_powerline_columns_fallback)} - ${ZLE_RPROMPT_INDENT:-1} ))'
local add_args_r2=$add_args$new_args_2
PS1='$($=POWERLINE_COMMAND shell aboveleft '$add_args')'
RPS1='$($=POWERLINE_COMMAND shell right '$add_args')'
PS2='$($=POWERLINE_COMMAND shell left '$add_args_2')'
RPS2='$($=POWERLINE_COMMAND shell right '$add_args_r2')'
PS3='$($=POWERLINE_COMMAND shell left '$add_args_3')'
PS1='$("$POWERLINE_COMMAND" $=POWERLINE_COMMAND_ARGS shell aboveleft '$add_args')'
RPS1='$("$POWERLINE_COMMAND" $=POWERLINE_COMMAND_ARGS shell right '$add_args')'
PS2='$("$POWERLINE_COMMAND" $=POWERLINE_COMMAND_ARGS shell left '$add_args_2')'
RPS2='$("$POWERLINE_COMMAND" $=POWERLINE_COMMAND_ARGS shell right '$add_args_r2')'
PS3='$("$POWERLINE_COMMAND" $=POWERLINE_COMMAND_ARGS shell left '$add_args_3')'
fi
}
@ -174,25 +181,25 @@ _powerline_add_widget() {
eval "function $save_widget() { emulate -L zsh; $widget \$@ }"
eval "${old_widget_command/$widget/$save_widget}"
zle -N $widget $function
export _POWERLINE_SAVE_WIDGET="$save_widget"
_POWERLINE_SAVE_WIDGET="$save_widget"
fi
}
if test -z "${POWERLINE_CONFIG}" ; then
if test -z "${POWERLINE_CONFIG_COMMAND}" ; then
if which powerline-config >/dev/null ; then
export POWERLINE_CONFIG=powerline-config
POWERLINE_CONFIG_COMMAND=powerline-config
else
export POWERLINE_CONFIG="$_POWERLINE_SOURCED:h:h:h:h/scripts/powerline-config"
POWERLINE_CONFIG_COMMAND="$_POWERLINE_SOURCED:h:h:h:h/scripts/powerline-config"
fi
fi
setopt promptpercent
setopt promptsubst
if ${POWERLINE_CONFIG} shell --shell=zsh uses prompt ; then
if "${POWERLINE_CONFIG_COMMAND}" shell --shell=zsh uses prompt ; then
_powerline_setup_prompt
_powerline_init_modes_support
fi
if ${POWERLINE_CONFIG} shell --shell=zsh uses tmux ; then
if "${POWERLINE_CONFIG_COMMAND}" shell --shell=zsh uses tmux ; then
_powerline_init_tmux_support
fi

View File

@ -12,16 +12,16 @@ ATTR_ITALIC = 2
ATTR_UNDERLINE = 4
def get_attr_flag(attributes):
def get_attrs_flag(attrs):
'''Convert an attribute array to a renderer flag.'''
attr_flag = 0
if 'bold' in attributes:
attr_flag |= ATTR_BOLD
if 'italic' in attributes:
attr_flag |= ATTR_ITALIC
if 'underline' in attributes:
attr_flag |= ATTR_UNDERLINE
return attr_flag
attrs_flag = 0
if 'bold' in attrs:
attrs_flag |= ATTR_BOLD
if 'italic' in attrs:
attrs_flag |= ATTR_ITALIC
if 'underline' in attrs:
attrs_flag |= ATTR_UNDERLINE
return attrs_flag
def pick_gradient_value(grad_list, gradient_level):
@ -112,7 +112,7 @@ class Colorscheme(object):
return {
'fg': pick_color(group_props['fg']),
'bg': pick_color(group_props['bg']),
'attr': get_attr_flag(group_props.get('attr', [])),
'attrs': get_attrs_flag(group_props.get('attrs', [])),
}

View File

@ -20,7 +20,8 @@ class StrFunction(object):
TMUX_ACTIONS = {
'source': StrFunction(config.source_tmux_files, 'source'),
'setenv': StrFunction(config.init_environment, 'setenv'),
'setenv': StrFunction(config.init_tmux_environment, 'setenv'),
'setup': StrFunction(config.tmux_setup, 'setup'),
}
@ -43,7 +44,12 @@ class ConfigArgParser(argparse.ArgumentParser):
def get_argparser(ArgumentParser=ConfigArgParser):
parser = ArgumentParser(description='Script used to obtain powerline configuration.')
parser.add_argument('-p', '--config_path', action='append', metavar='PATH', help='Path to configuration directory. If it is present then configuration files will only be seeked in the provided path. May be provided multiple times to search in a list of directories.')
parser.add_argument(
'-p', '--config-path', action='append', metavar='PATH',
help='Path to configuration directory. If it is present '
'then configuration files will only be seeked in the provided path. '
'May be provided multiple times to search in a list of directories.'
)
subparsers = parser.add_subparsers()
tmux_parser = subparsers.add_parser('tmux', help='Tmux-specific commands')
tmux_parser.add_argument(
@ -51,7 +57,10 @@ def get_argparser(ArgumentParser=ConfigArgParser):
choices=tuple(TMUX_ACTIONS.values()),
metavar='ACTION',
type=(lambda v: TMUX_ACTIONS.get(v)),
help='If action is `source\' then version-specific tmux configuration files are sourced, if it is `setenv\' then special (prefixed with `_POWERLINE\') tmux global environment variables are filled with data from powerline configuration.'
help='If action is `source\' then version-specific tmux configuration '
'files are sourced, if it is `setenv\' then special '
'(prefixed with `_POWERLINE\') tmux global environment variables '
'are filled with data from powerline configuration.'
)
shell_parser = subparsers.add_parser('shell', help='Shell-specific commands')
@ -60,14 +69,20 @@ def get_argparser(ArgumentParser=ConfigArgParser):
choices=tuple(SHELL_ACTIONS.values()),
type=(lambda v: SHELL_ACTIONS.get(v)),
metavar='ACTION',
help='If action is `command\' then preferred powerline command is output, if it is `uses\' then powerline-config script will exit with 1 if specified component is disabled and 0 otherwise.',
help='If action is `command\' then preferred powerline command is '
'output, if it is `uses\' then powerline-config script will exit '
'with 1 if specified component is disabled and 0 otherwise.',
)
shell_parser.add_argument(
'component',
nargs='?',
choices=('tmux', 'prompt'),
metavar='COMPONENT',
help='Only applicable for `uses\' subcommand: makes `powerline-config\' exit with 0 if specific component is enabled and with 1 otherwise. `tmux\' component stands for tmux bindings (e.g. those that notify tmux about current directory changes), `prompt\' component stands for shell prompt.'
help='Only applicable for `uses\' subcommand: makes `powerline-config\' '
'exit with 0 if specific component is enabled and with 1 otherwise. '
'`tmux\' component stands for tmux bindings '
'(e.g. those that notify tmux about current directory changes), '
'`prompt\' component stands for shell prompt.'
)
shell_parser.add_argument(
'-s', '--shell',

View File

@ -6,10 +6,19 @@ import argparse
def get_argparser(ArgumentParser=argparse.ArgumentParser):
parser = ArgumentParser(description='Daemon that improves powerline performance.')
parser.add_argument('--quiet', '-q', action='store_true', help='Without other options: do not complain about already running powerline-daemon instance. Will still exit with 1. With `--kill\' and `--replace\': do not show any messages. With `--foreground\': ignored. Does not silence exceptions in any case.')
parser.add_argument(
'--quiet', '-q', action='store_true',
help='Without other options: do not complain about already running '
'powerline-daemon instance. '
'Will still exit with 1. '
'With `--kill\' and `--replace\': do not show any messages. '
'With `--foreground\': ignored. '
'Does not silence exceptions in any case.'
)
parser.add_argument('--socket', '-s', help='Specify socket which will be used for connecting to daemon.')
arggr = parser.add_mutually_exclusive_group().add_argument
arggr('--kill', '-k', action='store_true', help='Kill an already running instance.')
arggr('--foreground', '-f', action='store_true', help='Run in the foreground (dont daemonize).')
arggr('--replace', '-r', action='store_true', help='Replace an already running instance.')
exclusive_group = parser.add_mutually_exclusive_group()
exclusive_group.add_argument('--kill', '-k', action='store_true', help='Kill an already running instance.')
replace_group = exclusive_group.add_argument_group()
replace_group.add_argument('--foreground', '-f', action='store_true', help='Run in the foreground (dont daemonize).')
replace_group.add_argument('--replace', '-r', action='store_true', help='Replace an already running instance.')
return parser

View File

@ -6,6 +6,16 @@ import argparse
def get_argparser(ArgumentParser=argparse.ArgumentParser):
parser = ArgumentParser(description='Powerline configuration checker.')
parser.add_argument('-p', '--config_path', action='append', metavar='PATH', help='Paths where configuration should be checked, in order. You must supply all paths necessary for powerline to work, checking partial (e.g. only user overrides) configuration is not supported.')
parser.add_argument('-d', '--debug', action='store_const', const=True, help='Display additional information. Used for debugging `powerline-lint\' itself, not for debugging configuration.')
parser.add_argument(
'-p', '--config-path', action='append', metavar='PATH',
help='Paths where configuration should be checked, in order. You must '
'supply all paths necessary for powerline to work, '
'checking partial (e.g. only user overrides) configuration '
'is not supported.'
)
parser.add_argument(
'-d', '--debug', action='store_const', const=True,
help='Display additional information. Used for debugging '
'`powerline-lint\' itself, not for debugging configuration.'
)
return parser

View File

@ -5,57 +5,148 @@ from __future__ import (division, absolute_import, print_function)
import argparse
import sys
from powerline.lib import mergedicts, parsedotval
from itertools import chain
from powerline.lib.overrides import parsedotval, parse_override_var
from powerline.lib.dict import mergeargs
from powerline.lib.encoding import get_preferred_arguments_encoding
from powerline.lib.unicode import u
if sys.version_info < (3,):
encoding = get_preferred_arguments_encoding()
def arg_to_unicode(s):
return unicode(s, encoding, 'replace') if not isinstance(s, unicode) else s
return unicode(s, encoding, 'replace') if not isinstance(s, unicode) else s # NOQA
else:
def arg_to_unicode(s):
return s
def mergeargs(argvalue):
if not argvalue:
return None
r = {}
for subval in argvalue:
mergedicts(r, dict([subval]))
return r
def finish_args(environ, args):
'''Do some final transformations
Transforms ``*_override`` arguments into dictionaries, adding overrides from
environment variables. Transforms ``renderer_arg`` argument into dictionary
as well, but only if it is true.
def finish_args(args):
if args.config:
args.config = mergeargs((parsedotval(v) for v in args.config))
if args.theme_option:
args.theme_option = mergeargs((parsedotval(v) for v in args.theme_option))
else:
args.theme_option = {}
:param dict environ:
Environment from which additional overrides should be taken from.
:param args:
Arguments object returned by
:py:meth:`argparse.ArgumentParser.parse_args`. Will be modified
in-place.
:return: Object received as second (``args``) argument.
'''
args.config_override = mergeargs(chain(
parse_override_var(environ.get('POWERLINE_CONFIG_OVERRIDES', '')),
(parsedotval(v) for v in args.config_override or ()),
))
args.theme_override = mergeargs(chain(
parse_override_var(environ.get('POWERLINE_THEME_OVERRIDES', '')),
(parsedotval(v) for v in args.theme_override or ()),
))
if args.renderer_arg:
args.renderer_arg = mergeargs((parsedotval(v) for v in args.renderer_arg))
args.renderer_arg = mergeargs((parsedotval(v) for v in args.renderer_arg), remove=True)
args.config_path = (
[path for path in environ.get('POWERLINE_CONFIG_PATHS', '').split(':') if path]
+ (args.config_path or [])
)
return args
def int_or_sig(s):
if s.startswith('sig'):
return u(s)
else:
return int(s)
def get_argparser(ArgumentParser=argparse.ArgumentParser):
parser = ArgumentParser(description='Powerline prompt and statusline script.')
parser.add_argument('ext', nargs=1, help='Extension: application for which powerline command is launched (usually `shell\' or `tmux\').')
parser.add_argument('side', nargs='?', choices=('left', 'right', 'above', 'aboveleft'), help='Side: `left\' and `right\' represent left and right side respectively, `above\' emits lines that are supposed to be printed just above the prompt and `aboveleft\' is like concatenating `above\' with `left\' with the exception that only one Python instance is used in this case.')
parser.add_argument(
'-r', '--renderer_module', metavar='MODULE', type=str,
help='Renderer module. Usually something like `.bash\' or `.zsh\', is supposed to be set only in shell-specific bindings file.'
'ext', nargs=1,
help='Extension: application for which powerline command is launched '
'(usually `shell\' or `tmux\').'
)
parser.add_argument(
'side', nargs='?', choices=('left', 'right', 'above', 'aboveleft'),
help='Side: `left\' and `right\' represent left and right side '
'respectively, `above\' emits lines that are supposed to be printed '
'just above the prompt and `aboveleft\' is like concatenating '
'`above\' with `left\' with the exception that only one Python '
'instance is used in this case.'
)
parser.add_argument(
'-r', '--renderer-module', metavar='MODULE', type=str,
help='Renderer module. Usually something like `.bash\' or `.zsh\' '
'(with leading dot) which is `powerline.renderers.{ext}{MODULE}\', '
'may also be full module name (must contain at least one dot or '
'end with a dot in case it is top-level module) or '
'`powerline.renderers\' submodule (in case there are no dots).'
)
parser.add_argument(
'-w', '--width', type=int,
help='Maximum prompt with. Triggers truncation of some segments.'
)
parser.add_argument(
'--last-exit-code', metavar='INT', type=int_or_sig,
help='Last exit code.'
)
parser.add_argument(
'--last-pipe-status', metavar='LIST', default='',
type=lambda s: [int_or_sig(status) for status in s.split()],
help='Like above, but is supposed to contain space-separated array '
'of statuses, representing exit statuses of commands in one pipe.'
)
parser.add_argument(
'--jobnum', metavar='INT', type=int,
help='Number of jobs.'
)
parser.add_argument(
'-c', '--config-override', metavar='KEY.KEY=VALUE', type=arg_to_unicode,
action='append',
help='Configuration overrides for `config.json\'. Is translated to a '
'dictionary and merged with the dictionary obtained from actual '
'JSON configuration: KEY.KEY=VALUE is translated to '
'`{"KEY": {"KEY": VALUE}}\' and then merged recursively. '
'VALUE may be any JSON value, values that are not '
'`null\', `true\', `false\', start with digit, `{\', `[\' '
'are treated like strings. If VALUE is omitted '
'then corresponding key is removed.'
)
parser.add_argument(
'-t', '--theme-override', metavar='THEME.KEY.KEY=VALUE', type=arg_to_unicode,
action='append',
help='Like above, but theme-specific. THEME should point to '
'an existing and used theme to have any effect, but it is fine '
'to use any theme here.'
)
parser.add_argument(
'-R', '--renderer-arg',
metavar='KEY=VAL', type=arg_to_unicode, action='append',
help='Like above, but provides argument for renderer. Is supposed '
'to be used only by shell bindings to provide various data like '
'last-exit-code or last-pipe-status (they are not using '
'`--renderer-arg\' for historical resons: `--renderer-arg\' '
'was added later).'
)
parser.add_argument(
'-p', '--config-path', action='append', metavar='PATH',
help='Path to configuration directory. If it is present then '
'configuration files will only be seeked in the provided path. '
'May be provided multiple times to search in a list of directories.'
)
parser.add_argument(
'--socket', metavar='ADDRESS', type=str,
help='Socket address to use in daemon clients. Is always UNIX domain '
'socket on linux and file socket on Mac OS X. Not used here, '
'present only for compatibility with other powerline clients. '
'This argument must always be the first one and be in a form '
'`--socket ADDRESS\': no `=\' or short form allowed '
'(in other powerline clients, not here).'
)
parser.add_argument('-w', '--width', type=int, help='Maximum prompt with. Triggers truncation of some segments.')
parser.add_argument('--last_exit_code', metavar='INT', type=int, help='Last exit code.')
parser.add_argument('--last_pipe_status', metavar='LIST', default='', type=lambda s: [int(status) for status in s.split()], help='Like above, but is supposed to contain space-separated array of statuses, representing exit statuses of commands in one pipe.')
parser.add_argument('--jobnum', metavar='INT', type=int, help='Number of jobs.')
parser.add_argument('-c', '--config', metavar='KEY.KEY=VALUE', type=arg_to_unicode, action='append', help='Configuration overrides for `config.json\'. Is translated to a dictionary and merged with the dictionary obtained from actual JSON configuration: KEY.KEY=VALUE is translated to `{"KEY": {"KEY": VALUE}}\' and then merged recursively. VALUE may be any JSON value, values that are not `null\', `true\', `false\', start with digit, `{\', `[\' are treated like strings. If VALUE is omitted then corresponding key is removed.')
parser.add_argument('-t', '--theme_option', metavar='THEME.KEY.KEY=VALUE', type=arg_to_unicode, action='append', help='Like above, but theme-specific. THEME should point to an existing and used theme to have any effect, but it is fine to use any theme here.')
parser.add_argument('-R', '--renderer_arg', metavar='KEY=VAL', type=arg_to_unicode, action='append', help='Like above, but provides argument for renderer. Is supposed to be used only by shell bindings to provide various data like last_exit_code or last_pipe_status (they are not using `--renderer_arg\' for historical resons: `--renderer_arg\' was added later).')
parser.add_argument('-p', '--config_path', action='append', metavar='PATH', help='Path to configuration directory. If it is present then configuration files will only be seeked in the provided path. May be provided multiple times to search in a list of directories.')
parser.add_argument('--socket', metavar='ADDRESS', type=str, help='Socket address to use in daemon clients. Is always UNIX domain socket on linux and file socket on Mac OS X. Not used here, present only for compatibility with other powerline clients. This argument must always be the first one and be in a form `--socket ADDRESS\': no `=\' or short form allowed (in other powerline clients, not here).')
return parser
@ -66,7 +157,7 @@ def write_output(args, powerline, segment_info, write, encoding):
for line in powerline.render_above_lines(
width=args.width,
segment_info=segment_info,
mode=segment_info['environ'].get('_POWERLINE_MODE'),
mode=segment_info.get('mode', None),
):
write(line.encode(encoding, 'replace'))
write(b'\n')
@ -77,6 +168,6 @@ def write_output(args, powerline, segment_info, write, encoding):
width=args.width,
side=args.side,
segment_info=segment_info,
mode=segment_info['environ'].get('_POWERLINE_MODE'),
mode=segment_info.get('mode', None),
)
write(rendered.encode(encoding, 'replace'))

View File

@ -1,45 +1,45 @@
{
"name": "Default",
"groups": {
"background": { "fg": "white", "bg": "gray0", "attr": [] },
"background:divider": { "fg": "gray5", "bg": "gray0", "attr": [] },
"session": { "fg": "black", "bg": "gray10", "attr": ["bold"] },
"date": { "fg": "gray8", "bg": "gray2", "attr": [] },
"time": { "fg": "gray10", "bg": "gray2", "attr": ["bold"] },
"time:divider": { "fg": "gray5", "bg": "gray2", "attr": [] },
"email_alert": { "fg": "white", "bg": "brightred", "attr": ["bold"] },
"email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attr": ["bold"] },
"hostname": { "fg": "black", "bg": "gray10", "attr": ["bold"] },
"weather": { "fg": "gray8", "bg": "gray0", "attr": [] },
"weather_temp_gradient": { "fg": "blue_red", "bg": "gray0", "attr": [] },
"weather_condition_hot": { "fg": "khaki1", "bg": "gray0", "attr": [] },
"weather_condition_snowy": { "fg": "skyblue1", "bg": "gray0", "attr": [] },
"weather_condition_rainy": { "fg": "skyblue1", "bg": "gray0", "attr": [] },
"uptime": { "fg": "gray8", "bg": "gray0", "attr": [] },
"external_ip": { "fg": "gray8", "bg": "gray0", "attr": [] },
"internal_ip": { "fg": "gray8", "bg": "gray0", "attr": [] },
"network_load": { "fg": "gray8", "bg": "gray0", "attr": [] },
"network_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attr": [] },
"system_load": { "fg": "gray8", "bg": "gray0", "attr": [] },
"system_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attr": [] },
"environment": { "fg": "gray8", "bg": "gray0", "attr": [] },
"cpu_load_percent": { "fg": "gray8", "bg": "gray0", "attr": [] },
"cpu_load_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attr": [] },
"battery": { "fg": "gray8", "bg": "gray0", "attr": [] },
"battery_gradient": { "fg": "white_red", "bg": "gray0", "attr": [] },
"battery_full": { "fg": "red", "bg": "gray0", "attr": [] },
"battery_empty": { "fg": "white", "bg": "gray0", "attr": [] },
"player": { "fg": "gray10", "bg": "black", "attr": [] },
"user": { "fg": "white", "bg": "darkblue", "attr": ["bold"] },
"superuser": { "fg": "white", "bg": "brightred", "attr": ["bold"] },
"branch": { "fg": "gray9", "bg": "gray2", "attr": [] },
"branch_dirty": { "fg": "brightyellow", "bg": "gray2", "attr": [] },
"branch_clean": { "fg": "gray9", "bg": "gray2", "attr": [] },
"branch:divider": { "fg": "gray7", "bg": "gray2", "attr": [] },
"cwd": { "fg": "gray9", "bg": "gray4", "attr": [] },
"cwd:current_folder": { "fg": "gray10", "bg": "gray4", "attr": ["bold"] },
"cwd:divider": { "fg": "gray7", "bg": "gray4", "attr": [] },
"virtualenv": { "fg": "white", "bg": "darkcyan", "attr": [] },
"attached_clients": { "fg": "gray8", "bg": "gray0", "attr": [] }
"background": { "fg": "white", "bg": "gray0", "attrs": [] },
"background:divider": { "fg": "gray5", "bg": "gray0", "attrs": [] },
"session": { "fg": "black", "bg": "gray10", "attrs": ["bold"] },
"date": { "fg": "gray8", "bg": "gray2", "attrs": [] },
"time": { "fg": "gray10", "bg": "gray2", "attrs": ["bold"] },
"time:divider": { "fg": "gray5", "bg": "gray2", "attrs": [] },
"email_alert": { "fg": "white", "bg": "brightred", "attrs": ["bold"] },
"email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attrs": ["bold"] },
"hostname": { "fg": "black", "bg": "gray10", "attrs": ["bold"] },
"weather": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"weather_temp_gradient": { "fg": "blue_red", "bg": "gray0", "attrs": [] },
"weather_condition_hot": { "fg": "khaki1", "bg": "gray0", "attrs": [] },
"weather_condition_snowy": { "fg": "skyblue1", "bg": "gray0", "attrs": [] },
"weather_condition_rainy": { "fg": "skyblue1", "bg": "gray0", "attrs": [] },
"uptime": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"external_ip": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"internal_ip": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"network_load": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"network_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attrs": [] },
"system_load": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"system_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attrs": [] },
"environment": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"cpu_load_percent": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"cpu_load_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attrs": [] },
"battery": { "fg": "gray8", "bg": "gray0", "attrs": [] },
"battery_gradient": { "fg": "white_red", "bg": "gray0", "attrs": [] },
"battery_full": { "fg": "red", "bg": "gray0", "attrs": [] },
"battery_empty": { "fg": "white", "bg": "gray0", "attrs": [] },
"player": { "fg": "gray10", "bg": "black", "attrs": [] },
"user": { "fg": "white", "bg": "darkblue", "attrs": ["bold"] },
"superuser": { "fg": "white", "bg": "brightred", "attrs": ["bold"] },
"branch": { "fg": "gray9", "bg": "gray2", "attrs": [] },
"branch_dirty": { "fg": "brightyellow", "bg": "gray2", "attrs": [] },
"branch_clean": { "fg": "gray9", "bg": "gray2", "attrs": [] },
"branch:divider": { "fg": "gray7", "bg": "gray2", "attrs": [] },
"cwd": { "fg": "gray9", "bg": "gray4", "attrs": [] },
"cwd:current_folder": { "fg": "gray10", "bg": "gray4", "attrs": ["bold"] },
"cwd:divider": { "fg": "gray7", "bg": "gray4", "attrs": [] },
"virtualenv": { "fg": "white", "bg": "darkcyan", "attrs": [] },
"attached_clients": { "fg": "gray8", "bg": "gray0", "attrs": [] }
}
}

View File

@ -1,7 +1,7 @@
{
"name": "Default color scheme for IPython prompt",
"groups": {
"prompt": { "fg": "gray9", "bg": "gray4", "attr": [] },
"prompt_count": { "fg": "white", "bg": "gray4", "attr": [] }
"prompt": { "fg": "gray9", "bg": "gray4", "attrs": [] },
"prompt_count": { "fg": "white", "bg": "gray4", "attrs": [] }
}
}

View File

@ -1,18 +1,18 @@
{
"name": "Default color scheme for shell prompts",
"groups": {
"hostname": { "fg": "brightyellow", "bg": "mediumorange", "attr": [] },
"jobnum": { "fg": "brightyellow", "bg": "mediumorange", "attr": [] },
"exit_fail": { "fg": "white", "bg": "darkestred", "attr": [] },
"exit_success": { "fg": "white", "bg": "darkestgreen", "attr": [] },
"environment": { "fg": "white", "bg": "darkestgreen", "attr": [] },
"mode": { "fg": "darkestgreen", "bg": "brightgreen", "attr": ["bold"] },
"attached_clients": { "fg": "white", "bg": "darkestgreen", "attr": [] }
"hostname": { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] },
"jobnum": { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] },
"exit_fail": { "fg": "white", "bg": "darkestred", "attrs": [] },
"exit_success": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
"environment": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
"mode": { "fg": "darkestgreen", "bg": "brightgreen", "attrs": ["bold"] },
"attached_clients": { "fg": "white", "bg": "darkestgreen", "attrs": [] }
},
"mode_translations": {
"vicmd": {
"groups": {
"mode": {"fg": "darkestcyan", "bg": "white", "attr": ["bold"]}
"mode": {"fg": "darkestcyan", "bg": "white", "attrs": ["bold"]}
}
}
}

View File

@ -1,15 +1,15 @@
{
"name": "Solarized dark for shell",
"groups": {
"jobnum": { "fg": "solarized:base3", "bg": "solarized:base01", "attr": [] },
"exit_fail": { "fg": "solarized:base3", "bg": "solarized:red", "attr": [] },
"exit_success": { "fg": "solarized:base3", "bg": "solarized:green", "attr": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:green", "attr": ["bold"] }
"jobnum": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
"exit_fail": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": [] },
"exit_success": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": ["bold"] }
},
"mode_translations": {
"vicmd": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:blue", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:blue", "attrs": ["bold"] }
}
}
}

View File

@ -1,18 +1,18 @@
{
"name": "Solarized dark",
"groups": {
"background": { "fg": "solarized:base3", "bg": "solarized:base02", "attr": [] },
"user": { "fg": "solarized:base3", "bg": "solarized:blue", "attr": ["bold"] },
"superuser": { "fg": "solarized:base3", "bg": "solarized:red", "attr": ["bold"] },
"virtualenv": { "fg": "solarized:base3", "bg": "solarized:green", "attr": [] },
"branch": { "fg": "solarized:base1", "bg": "solarized:base02", "attr": [] },
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base02", "attr": [] },
"branch_clean": { "fg": "solarized:base1", "bg": "solarized:base02", "attr": [] },
"cwd": { "fg": "solarized:base2", "bg": "solarized:base01", "attr": [] },
"cwd:current_folder": { "fg": "solarized:base3", "bg": "solarized:base01", "attr": ["bold"] },
"cwd:divider": { "fg": "solarized:base1", "bg": "solarized:base01", "attr": [] },
"hostname": { "fg": "solarized:base3", "bg": "solarized:base01", "attr": [] },
"environment": { "fg": "solarized:base3", "bg": "solarized:green", "attr": [] },
"attached_clients": { "fg": "solarized:base3", "bg": "solarized:green", "attr": [] }
"background": { "fg": "solarized:base3", "bg": "solarized:base02", "attrs": [] },
"user": { "fg": "solarized:base3", "bg": "solarized:blue", "attrs": ["bold"] },
"superuser": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": ["bold"] },
"virtualenv": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
"branch": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base02", "attrs": [] },
"branch_clean": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
"cwd": { "fg": "solarized:base2", "bg": "solarized:base01", "attrs": [] },
"cwd:current_folder": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": ["bold"] },
"cwd:divider": { "fg": "solarized:base1", "bg": "solarized:base01", "attrs": [] },
"hostname": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
"environment": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
"attached_clients": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] }
}
}

View File

@ -1,14 +1,14 @@
{
"groups": {
"active_window_status": {"fg": "darkblue", "bg": "gray0", "attr": []},
"window_status": {"fg": "gray70", "bg": "gray0", "attr": []},
"activity_status": {"fg": "yellow", "bg": "gray0", "attr": []},
"bell_status": {"fg": "red", "bg": "gray0", "attr": []},
"window": {"fg": "gray6", "bg": "gray0", "attr": []},
"window:divider": {"fg": "gray4", "bg": "gray0", "attr": []},
"window:current": {"fg": "mediumcyan", "bg": "darkblue", "attr": []},
"window_name": {"fg": "white", "bg": "darkblue", "attr": ["bold"]},
"session": {"fg": "black", "bg": "gray90", "attr": ["bold"]},
"session:prefix": {"fg": "gray90", "bg": "darkblue", "attr": ["bold"]}
"active_window_status": {"fg": "darkblue", "bg": "gray0", "attrs": []},
"window_status": {"fg": "gray70", "bg": "gray0", "attrs": []},
"activity_status": {"fg": "yellow", "bg": "gray0", "attrs": []},
"bell_status": {"fg": "red", "bg": "gray0", "attrs": []},
"window": {"fg": "gray6", "bg": "gray0", "attrs": []},
"window:divider": {"fg": "gray4", "bg": "gray0", "attrs": []},
"window:current": {"fg": "mediumcyan", "bg": "darkblue", "attrs": []},
"window_name": {"fg": "white", "bg": "darkblue", "attrs": ["bold"]},
"session": {"fg": "black", "bg": "gray90", "attrs": ["bold"]},
"session:prefix": {"fg": "gray90", "bg": "darkblue", "attrs": ["bold"]}
}
}

View File

@ -1,38 +1,38 @@
{
"name": "Default color scheme",
"groups": {
"information:unimportant": { "fg": "gray8", "bg": "gray2", "attr": [] },
"information:additional": { "fg": "gray9", "bg": "gray4", "attr": [] },
"background": { "fg": "white", "bg": "gray2", "attr": [] },
"background:divider": { "fg": "gray6", "bg": "gray2", "attr": [] },
"mode": { "fg": "darkestgreen", "bg": "brightgreen", "attr": ["bold"] },
"visual_range": { "fg": "brightestorange", "bg": "darkorange", "attr": ["bold"] },
"modified_indicator": { "fg": "brightyellow", "bg": "gray4", "attr": ["bold"] },
"paste_indicator": { "fg": "white", "bg": "mediumorange", "attr": ["bold"] },
"readonly_indicator": { "fg": "brightestred", "bg": "gray4", "attr": [] },
"branch_dirty": { "fg": "brightyellow", "bg": "gray4", "attr": [] },
"branch:divider": { "fg": "gray7", "bg": "gray4", "attr": [] },
"file_name": { "fg": "white", "bg": "gray4", "attr": ["bold"] },
"window_title": { "fg": "white", "bg": "gray4", "attr": [] },
"file_name_no_file": { "fg": "gray9", "bg": "gray4", "attr": ["bold"] },
"file_vcs_status": { "fg": "brightestred", "bg": "gray4", "attr": [] },
"file_vcs_status_M": { "fg": "brightyellow", "bg": "gray4", "attr": [] },
"file_vcs_status_A": { "fg": "brightgreen", "bg": "gray4", "attr": [] },
"line_percent": { "fg": "gray9", "bg": "gray4", "attr": [] },
"line_percent_gradient": { "fg": "dark_green_gray", "bg": "gray4", "attr": [] },
"position": { "fg": "gray9", "bg": "gray4", "attr": [] },
"position_gradient": { "fg": "green_yellow_red", "bg": "gray4", "attr": [] },
"line_current": { "fg": "gray1", "bg": "gray10", "attr": ["bold"] },
"line_current_symbol": { "fg": "gray1", "bg": "gray10", "attr": [] },
"virtcol_current_gradient": { "fg": "dark_GREEN_Orange_red", "bg": "gray10", "attr": [] },
"col_current": { "fg": "gray6", "bg": "gray10", "attr": [] },
"modified_buffers": { "fg": "brightyellow", "bg": "gray2", "attr": [] },
"attached_clients": { "fg": "gray8", "bg": "gray2", "attr": [] },
"error": { "fg": "brightestred", "bg": "darkred", "attr": ["bold"] },
"warning": { "fg": "brightyellow", "bg": "darkorange", "attr": ["bold"] },
"current_tag": { "fg": "gray9", "bg": "gray2", "attr": [] },
"information:unimportant": { "fg": "gray8", "bg": "gray2", "attrs": [] },
"information:additional": { "fg": "gray9", "bg": "gray4", "attrs": [] },
"background": { "fg": "white", "bg": "gray2", "attrs": [] },
"background:divider": { "fg": "gray6", "bg": "gray2", "attrs": [] },
"mode": { "fg": "darkestgreen", "bg": "brightgreen", "attrs": ["bold"] },
"visual_range": { "fg": "brightestorange", "bg": "darkorange", "attrs": ["bold"] },
"modified_indicator": { "fg": "brightyellow", "bg": "gray4", "attrs": ["bold"] },
"paste_indicator": { "fg": "white", "bg": "mediumorange", "attrs": ["bold"] },
"readonly_indicator": { "fg": "brightestred", "bg": "gray4", "attrs": [] },
"branch_dirty": { "fg": "brightyellow", "bg": "gray4", "attrs": [] },
"branch:divider": { "fg": "gray7", "bg": "gray4", "attrs": [] },
"file_name": { "fg": "white", "bg": "gray4", "attrs": ["bold"] },
"window_title": { "fg": "white", "bg": "gray4", "attrs": [] },
"file_name_no_file": { "fg": "gray9", "bg": "gray4", "attrs": ["bold"] },
"file_vcs_status": { "fg": "brightestred", "bg": "gray4", "attrs": [] },
"file_vcs_status_M": { "fg": "brightyellow", "bg": "gray4", "attrs": [] },
"file_vcs_status_A": { "fg": "brightgreen", "bg": "gray4", "attrs": [] },
"line_percent": { "fg": "gray9", "bg": "gray4", "attrs": [] },
"line_percent_gradient": { "fg": "dark_green_gray", "bg": "gray4", "attrs": [] },
"position": { "fg": "gray9", "bg": "gray4", "attrs": [] },
"position_gradient": { "fg": "green_yellow_red", "bg": "gray4", "attrs": [] },
"line_current": { "fg": "gray1", "bg": "gray10", "attrs": ["bold"] },
"line_current_symbol": { "fg": "gray1", "bg": "gray10", "attrs": [] },
"virtcol_current_gradient": { "fg": "dark_GREEN_Orange_red", "bg": "gray10", "attrs": [] },
"col_current": { "fg": "gray6", "bg": "gray10", "attrs": [] },
"modified_buffers": { "fg": "brightyellow", "bg": "gray2", "attrs": [] },
"attached_clients": { "fg": "gray8", "bg": "gray2", "attrs": [] },
"error": { "fg": "brightestred", "bg": "darkred", "attrs": ["bold"] },
"warning": { "fg": "brightyellow", "bg": "darkorange", "attrs": ["bold"] },
"current_tag": { "fg": "gray9", "bg": "gray2", "attrs": [] },
"tab_nc:modified_indicator": { "fg": "brightyellow", "bg": "gray2", "attr": ["bold"] }
"tab_nc:modified_indicator": { "fg": "brightyellow", "bg": "gray2", "attrs": ["bold"] }
},
"mode_translations": {
"nc": {
@ -71,29 +71,29 @@
"dark_green_gray": "light_green_gray"
},
"groups": {
"mode": { "fg": "darkestcyan", "bg": "white", "attr": ["bold"] },
"background:divider": { "fg": "darkcyan", "bg": "darkestblue", "attr": [] },
"branch:divider": { "fg": "darkcyan", "bg": "darkblue", "attr": [] }
"mode": { "fg": "darkestcyan", "bg": "white", "attrs": ["bold"] },
"background:divider": { "fg": "darkcyan", "bg": "darkestblue", "attrs": [] },
"branch:divider": { "fg": "darkcyan", "bg": "darkblue", "attrs": [] }
}
},
"v": {
"groups": {
"mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] }
"mode": { "fg": "darkorange", "bg": "brightestorange", "attrs": ["bold"] }
}
},
"V": {
"groups": {
"mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] }
"mode": { "fg": "darkorange", "bg": "brightestorange", "attrs": ["bold"] }
}
},
"^V": {
"groups": {
"mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] }
"mode": { "fg": "darkorange", "bg": "brightestorange", "attrs": ["bold"] }
}
},
"R": {
"groups": {
"mode": { "fg": "white", "bg": "brightred", "attr": ["bold"] }
"mode": { "fg": "white", "bg": "brightred", "attrs": ["bold"] }
}
}
}

View File

@ -1,37 +1,37 @@
{
"name": "Solarized dark for vim",
"groups": {
"information:additional": { "fg": "solarized:base2", "bg": "solarized:base01", "attr": [] },
"information:unimportant": { "fg": "solarized:base3", "bg": "solarized:base01", "attr": [] },
"background": { "fg": "solarized:base3", "bg": "solarized:base02", "attr": [] },
"background:divider": { "fg": "solarized:base00", "bg": "solarized:base02", "attr": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:green", "attr": ["bold"] },
"visual_range": { "fg": "solarized:green", "bg": "solarized:base3", "attr": ["bold"] },
"modified_indicator": { "fg": "solarized:yellow", "bg": "solarized:base01", "attr": ["bold"] },
"paste_indicator": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] },
"readonly_indicator": { "fg": "solarized:red", "bg": "solarized:base01", "attr": [] },
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base01", "attr": [] },
"branch:divider": { "fg": "solarized:base1", "bg": "solarized:base01", "attr": [] },
"file_name": { "fg": "solarized:base3", "bg": "solarized:base01", "attr": ["bold"] },
"window_title": { "fg": "solarized:base3", "bg": "solarized:base01", "attr": [] },
"file_name_no_file": { "fg": "solarized:base3", "bg": "solarized:base01", "attr": ["bold"] },
"file_format": { "fg": "solarized:base1", "bg": "solarized:base02", "attr": [] },
"file_vcs_status": { "fg": "solarized:red", "bg": "solarized:base01", "attr": [] },
"file_vcs_status_M": { "fg": "solarized:yellow", "bg": "solarized:base01", "attr": [] },
"file_vcs_status_A": { "fg": "solarized:green", "bg": "solarized:base01", "attr": [] },
"line_percent": { "fg": "solarized:base3", "bg": "solarized:base00", "attr": [] },
"line_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "solarized:base00", "attr": [] },
"position": { "fg": "solarized:base3", "bg": "solarized:base00", "attr": [] },
"position_gradient": { "fg": "green_yellow_orange_red", "bg": "solarized:base00", "attr": [] },
"line_current": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": ["bold"] },
"line_current_symbol": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": [] },
"virtcol_current_gradient": { "fg": "GREEN_Orange_red", "bg": "solarized:base2", "attr": [] },
"col_current": { "fg": "solarized:base0", "bg": "solarized:base2", "attr": [] },
"environment": { "fg": "solarized:base1", "bg": "solarized:base02", "attr": [] },
"attached_clients": { "fg": "solarized:base1", "bg": "solarized:base02", "attr": [] },
"error": { "fg": "solarized:base3", "bg": "solarized:red", "attr": ["bold"] },
"warning": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] },
"current_tag": { "fg": "solarized:base3", "bg": "solarized:base02", "attr": ["bold"] }
"information:additional": { "fg": "solarized:base2", "bg": "solarized:base01", "attrs": [] },
"information:unimportant": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
"background": { "fg": "solarized:base3", "bg": "solarized:base02", "attrs": [] },
"background:divider": { "fg": "solarized:base00", "bg": "solarized:base02", "attrs": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": ["bold"] },
"visual_range": { "fg": "solarized:green", "bg": "solarized:base3", "attrs": ["bold"] },
"modified_indicator": { "fg": "solarized:yellow", "bg": "solarized:base01", "attrs": ["bold"] },
"paste_indicator": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] },
"readonly_indicator": { "fg": "solarized:red", "bg": "solarized:base01", "attrs": [] },
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base01", "attrs": [] },
"branch:divider": { "fg": "solarized:base1", "bg": "solarized:base01", "attrs": [] },
"file_name": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": ["bold"] },
"window_title": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
"file_name_no_file": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": ["bold"] },
"file_format": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
"file_vcs_status": { "fg": "solarized:red", "bg": "solarized:base01", "attrs": [] },
"file_vcs_status_M": { "fg": "solarized:yellow", "bg": "solarized:base01", "attrs": [] },
"file_vcs_status_A": { "fg": "solarized:green", "bg": "solarized:base01", "attrs": [] },
"line_percent": { "fg": "solarized:base3", "bg": "solarized:base00", "attrs": [] },
"line_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "solarized:base00", "attrs": [] },
"position": { "fg": "solarized:base3", "bg": "solarized:base00", "attrs": [] },
"position_gradient": { "fg": "green_yellow_orange_red", "bg": "solarized:base00", "attrs": [] },
"line_current": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": ["bold"] },
"line_current_symbol": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": [] },
"virtcol_current_gradient": { "fg": "GREEN_Orange_red", "bg": "solarized:base2", "attrs": [] },
"col_current": { "fg": "solarized:base0", "bg": "solarized:base2", "attrs": [] },
"environment": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
"attached_clients": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
"error": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": ["bold"] },
"warning": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] },
"current_tag": { "fg": "solarized:base3", "bg": "solarized:base02", "attrs": ["bold"] }
},
"mode_translations": {
"nc": {
@ -46,50 +46,50 @@
},
"i": {
"groups": {
"background": { "fg": "solarized:base3", "bg": "solarized:base01", "attr": [] },
"background:divider": { "fg": "solarized:base2", "bg": "solarized:base01", "attr": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:blue", "attr": ["bold"] },
"modified_indicator": { "fg": "solarized:yellow", "bg": "solarized:base2", "attr": ["bold"] },
"paste_indicator": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] },
"readonly_indicator": { "fg": "solarized:red", "bg": "solarized:base2", "attr": [] },
"branch": { "fg": "solarized:base01", "bg": "solarized:base2", "attr": [] },
"branch:divider": { "fg": "solarized:base00", "bg": "solarized:base2", "attr": [] },
"file_directory": { "fg": "solarized:base01", "bg": "solarized:base2", "attr": [] },
"file_name": { "fg": "solarized:base02", "bg": "solarized:base2", "attr": ["bold"] },
"file_size": { "fg": "solarized:base02", "bg": "solarized:base2", "attr": [] },
"file_name_no_file": { "fg": "solarized:base02", "bg": "solarized:base2", "attr": ["bold"] },
"file_name_empty": { "fg": "solarized:base02", "bg": "solarized:base2", "attr": [] },
"file_format": { "fg": "solarized:base2", "bg": "solarized:base01", "attr": [] },
"file_vcs_status": { "fg": "solarized:red", "bg": "solarized:base2", "attr": [] },
"file_vcs_status_M": { "fg": "solarized:yellow", "bg": "solarized:base2", "attr": [] },
"file_vcs_status_A": { "fg": "solarized:green", "bg": "solarized:base2", "attr": [] },
"line_percent": { "fg": "solarized:base3", "bg": "solarized:base1", "attr": [] },
"line_percent_gradient": { "fg": "solarized:base3", "bg": "solarized:base1", "attr": [] },
"position": { "fg": "solarized:base3", "bg": "solarized:base1", "attr": [] },
"position_gradient": { "fg": "solarized:base3", "bg": "solarized:base1", "attr": [] },
"line_current": { "fg": "solarized:base03", "bg": "solarized:base3", "attr": ["bold"] },
"line_current_symbol": { "fg": "solarized:base03", "bg": "solarized:base3", "attr": [] },
"col_current": { "fg": "solarized:base0", "bg": "solarized:base3", "attr": [] }
"background": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
"background:divider": { "fg": "solarized:base2", "bg": "solarized:base01", "attrs": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:blue", "attrs": ["bold"] },
"modified_indicator": { "fg": "solarized:yellow", "bg": "solarized:base2", "attrs": ["bold"] },
"paste_indicator": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] },
"readonly_indicator": { "fg": "solarized:red", "bg": "solarized:base2", "attrs": [] },
"branch": { "fg": "solarized:base01", "bg": "solarized:base2", "attrs": [] },
"branch:divider": { "fg": "solarized:base00", "bg": "solarized:base2", "attrs": [] },
"file_directory": { "fg": "solarized:base01", "bg": "solarized:base2", "attrs": [] },
"file_name": { "fg": "solarized:base02", "bg": "solarized:base2", "attrs": ["bold"] },
"file_size": { "fg": "solarized:base02", "bg": "solarized:base2", "attrs": [] },
"file_name_no_file": { "fg": "solarized:base02", "bg": "solarized:base2", "attrs": ["bold"] },
"file_name_empty": { "fg": "solarized:base02", "bg": "solarized:base2", "attrs": [] },
"file_format": { "fg": "solarized:base2", "bg": "solarized:base01", "attrs": [] },
"file_vcs_status": { "fg": "solarized:red", "bg": "solarized:base2", "attrs": [] },
"file_vcs_status_M": { "fg": "solarized:yellow", "bg": "solarized:base2", "attrs": [] },
"file_vcs_status_A": { "fg": "solarized:green", "bg": "solarized:base2", "attrs": [] },
"line_percent": { "fg": "solarized:base3", "bg": "solarized:base1", "attrs": [] },
"line_percent_gradient": { "fg": "solarized:base3", "bg": "solarized:base1", "attrs": [] },
"position": { "fg": "solarized:base3", "bg": "solarized:base1", "attrs": [] },
"position_gradient": { "fg": "solarized:base3", "bg": "solarized:base1", "attrs": [] },
"line_current": { "fg": "solarized:base03", "bg": "solarized:base3", "attrs": ["bold"] },
"line_current_symbol": { "fg": "solarized:base03", "bg": "solarized:base3", "attrs": [] },
"col_current": { "fg": "solarized:base0", "bg": "solarized:base3", "attrs": [] }
}
},
"v": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] }
}
},
"V": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] }
}
},
"^V": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] }
}
},
"R": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:red", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": ["bold"] }
}
}
}

View File

@ -1,36 +1,36 @@
{
"name": "Solarized light for vim",
"groups": {
"information:additional": { "fg": "solarized:base02", "bg": "solarized:base2", "attr": [] },
"information:unimportant": { "fg": "solarized:base1", "bg": "solarized:base01", "attr": [] },
"background": { "fg": "solarized:base03", "bg": "solarized:base01", "attr": [] },
"background:divider": { "fg": "solarized:base0", "bg": "solarized:base01", "attr": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:green", "attr": ["bold"] },
"visual_range": { "fg": "solarized:green", "bg": "solarized:base3", "attr": ["bold"] },
"modified_indicator": { "fg": "solarized:yellow", "bg": "solarized:base2", "attr": ["bold"] },
"paste_indicator": { "fg": "solarized:red", "bg": "solarized:base2", "attr": ["bold"] },
"readonly_indicator": { "fg": "solarized:red", "bg": "solarized:base2", "attr": [] },
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base2", "attr": [] },
"branch:divider": { "fg": "solarized:base1", "bg": "solarized:base2", "attr": [] },
"file_name": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": ["bold"] },
"window_title": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": [] },
"file_size": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": [] },
"file_name_no_file": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": ["bold"] },
"file_name_empty": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": [] },
"file_vcs_status": { "fg": "solarized:red", "bg": "solarized:base2", "attr": [] },
"file_vcs_status_M": { "fg": "solarized:yellow", "bg": "solarized:base2", "attr": [] },
"file_vcs_status_A": { "fg": "solarized:green", "bg": "solarized:base2", "attr": [] },
"line_percent": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": [] },
"line_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "solarized:base2", "attr": [] },
"position": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": [] },
"position_gradient": { "fg": "green_yellow_orange_red", "bg": "solarized:base2", "attr": [] },
"line_current": { "fg": "solarized:base3", "bg": "solarized:base02", "attr": ["bold"] },
"line_current_symbol": { "fg": "solarized:base3", "bg": "solarized:base02", "attr": [] },
"virtcol_current_gradient": { "fg": "yellow_orange_red", "bg": "solarized:base02", "attr": [] },
"col_current": { "fg": "solarized:base00", "bg": "solarized:base02", "attr": [] },
"error": { "fg": "solarized:base03", "bg": "solarized:red", "attr": ["bold"] },
"warning": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": ["bold"] },
"current_tag": { "fg": "solarized:base03", "bg": "solarized:base01", "attr": ["bold"] }
"information:additional": { "fg": "solarized:base02", "bg": "solarized:base2", "attrs": [] },
"information:unimportant": { "fg": "solarized:base1", "bg": "solarized:base01", "attrs": [] },
"background": { "fg": "solarized:base03", "bg": "solarized:base01", "attrs": [] },
"background:divider": { "fg": "solarized:base0", "bg": "solarized:base01", "attrs": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": ["bold"] },
"visual_range": { "fg": "solarized:green", "bg": "solarized:base3", "attrs": ["bold"] },
"modified_indicator": { "fg": "solarized:yellow", "bg": "solarized:base2", "attrs": ["bold"] },
"paste_indicator": { "fg": "solarized:red", "bg": "solarized:base2", "attrs": ["bold"] },
"readonly_indicator": { "fg": "solarized:red", "bg": "solarized:base2", "attrs": [] },
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base2", "attrs": [] },
"branch:divider": { "fg": "solarized:base1", "bg": "solarized:base2", "attrs": [] },
"file_name": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": ["bold"] },
"window_title": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": [] },
"file_size": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": [] },
"file_name_no_file": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": ["bold"] },
"file_name_empty": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": [] },
"file_vcs_status": { "fg": "solarized:red", "bg": "solarized:base2", "attrs": [] },
"file_vcs_status_M": { "fg": "solarized:yellow", "bg": "solarized:base2", "attrs": [] },
"file_vcs_status_A": { "fg": "solarized:green", "bg": "solarized:base2", "attrs": [] },
"line_percent": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": [] },
"line_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "solarized:base2", "attrs": [] },
"position": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": [] },
"position_gradient": { "fg": "green_yellow_orange_red", "bg": "solarized:base2", "attrs": [] },
"line_current": { "fg": "solarized:base3", "bg": "solarized:base02", "attrs": ["bold"] },
"line_current_symbol": { "fg": "solarized:base3", "bg": "solarized:base02", "attrs": [] },
"virtcol_current_gradient": { "fg": "yellow_orange_red", "bg": "solarized:base02", "attrs": [] },
"col_current": { "fg": "solarized:base00", "bg": "solarized:base02", "attrs": [] },
"error": { "fg": "solarized:base03", "bg": "solarized:red", "attrs": ["bold"] },
"warning": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": ["bold"] },
"current_tag": { "fg": "solarized:base03", "bg": "solarized:base01", "attrs": ["bold"] }
},
"mode_translations": {
"nc": {
@ -45,51 +45,51 @@
},
"i": {
"groups": {
"background": { "fg": "solarized:base03", "bg": "solarized:base2", "attr": [] },
"background:divider": { "fg": "solarized:base02", "bg": "solarized:base2", "attr": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:blue", "attr": ["bold"] },
"modified_indicator": { "fg": "solarized:yellow", "bg": "solarized:base02", "attr": ["bold"] },
"paste_indicator": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] },
"readonly_indicator": { "fg": "solarized:red", "bg": "solarized:base02", "attr": [] },
"branch": { "fg": "solarized:base2", "bg": "solarized:base02", "attr": [] },
"branch:divider": { "fg": "solarized:base0", "bg": "solarized:base02", "attr": [] },
"file_directory": { "fg": "solarized:base2", "bg": "solarized:base02", "attr": [] },
"file_name": { "fg": "solarized:base01", "bg": "solarized:base02", "attr": ["bold"] },
"file_size": { "fg": "solarized:base01", "bg": "solarized:base02", "attr": [] },
"file_name_no_file": { "fg": "solarized:base01", "bg": "solarized:base02", "attr": ["bold"] },
"file_name_empty": { "fg": "solarized:base01", "bg": "solarized:base02", "attr": [] },
"file_format": { "fg": "solarized:base02", "bg": "solarized:base2", "attr": [] },
"file_vcs_status": { "fg": "solarized:red", "bg": "solarized:base02", "attr": [] },
"file_vcs_status_M": { "fg": "solarized:yellow", "bg": "solarized:base02", "attr": [] },
"file_vcs_status_A": { "fg": "solarized:green", "bg": "solarized:base02", "attr": [] },
"line_percent": { "fg": "solarized:base03", "bg": "solarized:base1", "attr": [] },
"line_percent_gradient": { "fg": "solarized:base03", "bg": "solarized:base1", "attr": [] },
"position": { "fg": "solarized:base03", "bg": "solarized:base1", "attr": [] },
"position_gradient": { "fg": "solarized:base03", "bg": "solarized:base1", "attr": [] },
"line_current": { "fg": "solarized:base3", "bg": "solarized:base03", "attr": ["bold"] },
"line_current_symbol": { "fg": "solarized:base3", "bg": "solarized:base03", "attr": [] },
"virtcol_current_gradient": { "fg": "yellow_orange_red", "bg": "solarized:base03", "attr": [] },
"col_current": { "fg": "solarized:base00", "bg": "solarized:base03", "attr": [] }
"background": { "fg": "solarized:base03", "bg": "solarized:base2", "attrs": [] },
"background:divider": { "fg": "solarized:base02", "bg": "solarized:base2", "attrs": [] },
"mode": { "fg": "solarized:base3", "bg": "solarized:blue", "attrs": ["bold"] },
"modified_indicator": { "fg": "solarized:yellow", "bg": "solarized:base02", "attrs": ["bold"] },
"paste_indicator": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] },
"readonly_indicator": { "fg": "solarized:red", "bg": "solarized:base02", "attrs": [] },
"branch": { "fg": "solarized:base2", "bg": "solarized:base02", "attrs": [] },
"branch:divider": { "fg": "solarized:base0", "bg": "solarized:base02", "attrs": [] },
"file_directory": { "fg": "solarized:base2", "bg": "solarized:base02", "attrs": [] },
"file_name": { "fg": "solarized:base01", "bg": "solarized:base02", "attrs": ["bold"] },
"file_size": { "fg": "solarized:base01", "bg": "solarized:base02", "attrs": [] },
"file_name_no_file": { "fg": "solarized:base01", "bg": "solarized:base02", "attrs": ["bold"] },
"file_name_empty": { "fg": "solarized:base01", "bg": "solarized:base02", "attrs": [] },
"file_format": { "fg": "solarized:base02", "bg": "solarized:base2", "attrs": [] },
"file_vcs_status": { "fg": "solarized:red", "bg": "solarized:base02", "attrs": [] },
"file_vcs_status_M": { "fg": "solarized:yellow", "bg": "solarized:base02", "attrs": [] },
"file_vcs_status_A": { "fg": "solarized:green", "bg": "solarized:base02", "attrs": [] },
"line_percent": { "fg": "solarized:base03", "bg": "solarized:base1", "attrs": [] },
"line_percent_gradient": { "fg": "solarized:base03", "bg": "solarized:base1", "attrs": [] },
"position": { "fg": "solarized:base03", "bg": "solarized:base1", "attrs": [] },
"position_gradient": { "fg": "solarized:base03", "bg": "solarized:base1", "attrs": [] },
"line_current": { "fg": "solarized:base3", "bg": "solarized:base03", "attrs": ["bold"] },
"line_current_symbol": { "fg": "solarized:base3", "bg": "solarized:base03", "attrs": [] },
"virtcol_current_gradient": { "fg": "yellow_orange_red", "bg": "solarized:base03", "attrs": [] },
"col_current": { "fg": "solarized:base00", "bg": "solarized:base03", "attrs": [] }
}
},
"v": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] }
}
},
"V": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] }
}
},
"^V": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:orange", "attrs": ["bold"] }
}
},
"R": {
"groups": {
"mode": { "fg": "solarized:base3", "bg": "solarized:red", "attr": ["bold"] }
"mode": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": ["bold"] }
}
}
}

View File

@ -35,7 +35,6 @@
"quickfix": "quickfix",
"powerline.matchers.vim.plugin.nerdtree.nerdtree": "plugin_nerdtree",
"powerline.matchers.vim.plugin.ctrlp.ctrlp": "plugin_ctrlp",
"powerline.matchers.vim.plugin.commandt.commandt": "plugin_commandt",
"powerline.matchers.vim.plugin.gundo.gundo": "plugin_gundo",
"powerline.matchers.vim.plugin.gundo.gundo_preview": "plugin_gundo-preview"

View File

@ -48,16 +48,6 @@
"powerline.segments.common.net.hostname": {
"before": "H "
},
"powerline.segments.common.players.now_playing": {
"args": {
"state_symbols": {
"fallback": "",
"play": ">",
"pause": "~",
"stop": "X"
}
}
},
"powerline.segments.common.bat.battery": {
"args": {
"full_heart": "O",
@ -110,15 +100,15 @@
"S": "S-LINE",
"^S": "S-BLCK",
"i": "INSERT",
"R": "REPLACE",
"Rv": "V-RPLCE",
"R": "RPLACE",
"Rv": "V-RPLC",
"c": "COMMND",
"cv": "VIM EX",
"ce": "EX",
"cv": "VIM-EX",
"ce": "NRM-EX",
"r": "PROMPT",
"rm": "MORE",
"r?": "CONFIRM",
"!": "SHELL"
"rm": "-MORE-",
"r?": "CNFIRM",
"!": "!SHELL"
}
}
},

View File

@ -9,7 +9,7 @@
"type": "string",
"contents": "In [",
"draw_soft_divider": false,
"highlight_group": ["prompt"]
"highlight_groups": ["prompt"]
},
{
"function": "powerline.segments.ipython.prompt_count",
@ -18,7 +18,7 @@
{
"type": "string",
"contents": "]",
"highlight_group": ["prompt"]
"highlight_groups": ["prompt"]
}
]
}

View File

@ -5,7 +5,7 @@
"type": "string",
"contents": "",
"width": "auto",
"highlight_group": ["prompt"]
"highlight_groups": ["prompt"]
}
]
}

View File

@ -8,7 +8,7 @@
"draw_soft_divider": false,
"width": "auto",
"align": "r",
"highlight_group": ["prompt"]
"highlight_groups": ["prompt"]
},
{
"function": "prompt_count",
@ -17,7 +17,7 @@
{
"type": "string",
"contents": "]",
"highlight_group": ["prompt"]
"highlight_groups": ["prompt"]
}
]
}

View File

@ -7,7 +7,7 @@
"contents": "",
"draw_soft_divider": false,
"width": "auto",
"highlight_group": ["prompt"]
"highlight_groups": ["prompt"]
},
{
"function": "prompt_count",
@ -16,7 +16,7 @@
{
"type": "string",
"contents": ">",
"highlight_group": ["prompt"]
"highlight_groups": ["prompt"]
}
]
}

View File

@ -47,16 +47,6 @@
"powerline.segments.common.net.hostname": {
"before": " "
},
"powerline.segments.common.players.now_playing": {
"args": {
"state_symbols": {
"fallback": "♫",
"play": "▶",
"pause": "▮▮",
"stop": "■"
}
}
},
"powerline.segments.common.bat.battery": {
"args": {
"full_heart": "♥",
@ -108,15 +98,15 @@
"S": "S·LINE",
"^S": "S·BLCK",
"i": "INSERT",
"R": "REPLACE",
"Rv": "V·RPLCE",
"R": "RPLACE",
"Rv": "V·RPLC",
"c": "COMMND",
"cv": "VIM EX",
"ce": "EX",
"cv": "VIM·EX",
"ce": "NRM·EX",
"r": "PROMPT",
"rm": "MORE",
"r?": "CONFIRM",
"!": "SHELL"
"rm": "-MORE-",
"r?": "CNFIRM",
"!": "!SHELL"
}
}
},

View File

@ -0,0 +1,146 @@
{
"dividers": {
"left": {
"hard": " ",
"soft": " "
},
"right": {
"hard": " ",
"soft": " "
}
},
"spaces": 1,
"segment_data": {
"branch": {
"before": "🔀 "
},
"cwd": {
"args": {
"ellipsis": "⋯"
}
},
"line_current_symbol": {
"contents": " "
},
"player": {
"args": {
"state_symbols": {
"fallback": "♫",
"play": "⏵",
"pause": "⏸",
"stop": "⏹"
}
}
},
"time": {
"before": "🕐 "
},
"powerline.segments.common.net.network_load": {
"args": {
"recv_format": "⬇ {value:>8}",
"sent_format": "⬆ {value:>8}"
}
},
"powerline.segments.common.net.hostname": {
"before": "🏠 "
},
"powerline.segments.common.bat.battery": {
"args": {
"full_heart": "💙",
"empty_heart": "💛"
}
},
"powerline.segments.common.sys.uptime": {
"before": "⇑ "
},
"powerline.segments.common.mail.email_imap_alert": {
"before": "✉ "
},
"powerline.segments.common.env.virtualenv": {
"before": "🐍 "
},
"powerline.segments.common.wthr.weather": {
"args": {
"icons": {
"tornado": "🌪",
"hurricane": "🌀",
"showers": "☔",
"scattered_showers": "☔",
"thunderstorms": "🌩",
"isolated_thunderstorms": "🌩",
"scattered_thunderstorms": "🌩",
"dust": "🌫",
"fog": "🌫",
"cold": "❄",
"partly_cloudy_day": "🌤",
"mostly_cloudy_day": "🌥",
"sun": "🌣",
"hot": "♨",
"day": "☀",
"blustery": "⚑",
"rainy": "☂",
"cloudy": "☁",
"snowy": "☃",
"stormy": "☈",
"foggy": "🌁",
"sunny": "🌣",
"night": "☾",
"windy": "☴",
"not_available": "<22>",
"unknown": "⚠"
}
}
},
"powerline.segments.common.time.fuzzy_time": {
"args": {
"unicode_text": true
}
},
"powerline.segments.vim.mode": {
"args": {
"override": {
"n": "NORMAL",
"no": "N·OPER",
"v": "VISUAL",
"V": "V·LINE",
"^V": "V·BLCK",
"s": "SELECT",
"S": "S·LINE",
"^S": "S·BLCK",
"i": "INSERT",
"R": "RPLACE",
"Rv": "V·RPLC",
"c": "COMMND",
"cv": "VIM·EX",
"ce": "NRM·EX",
"r": "PROMPT",
"rm": "-MORE-",
"r?": "CNFIRM",
"!": "!SHELL"
}
}
},
"powerline.segments.vim.visual_range": {
"args": {
"CTRL_V_text": "{rows} × {vcols}",
"v_text_oneline": "C:{vcols}",
"v_text_multiline": "L:{rows}",
"V_text": "L:{rows}"
}
},
"powerline.segments.vim.readonly_indicator": {
"args": {
"text": "🔏"
}
},
"powerline.segments.vim.modified_indicator": {
"args": {
"text": "🖫⃥"
}
}
}
}

View File

@ -6,7 +6,7 @@
"contents": "Select variant",
"width": "auto",
"align": "r",
"highlight_group": ["continuation:current"]
"highlight_groups": ["continuation:current"]
}
]
}

View File

@ -47,16 +47,6 @@
"powerline.segments.common.net.hostname": {
"before": "⌂ "
},
"powerline.segments.common.players.now_playing": {
"args": {
"state_symbols": {
"fallback": "♫",
"play": "▶",
"pause": "▮▮",
"stop": "■"
}
}
},
"powerline.segments.common.bat.battery": {
"args": {
"full_heart": "♥",
@ -108,15 +98,15 @@
"S": "S·LINE",
"^S": "S·BLCK",
"i": "INSERT",
"R": "REPLACE",
"Rv": "V·RPLCE",
"R": "RPLACE",
"Rv": "V·RPLC",
"c": "COMMND",
"cv": "VIM EX",
"ce": "EX",
"cv": "VIM·EX",
"ce": "NRM·EX",
"r": "PROMPT",
"rm": "MORE",
"r?": "CONFIRM",
"!": "SHELL"
"rm": "-MORE-",
"r?": "CNFIRM",
"!": "!SHELL"
}
}
},

View File

@ -47,16 +47,6 @@
"powerline.segments.common.net.hostname": {
"before": "⌂ "
},
"powerline.segments.common.players.now_playing": {
"args": {
"state_symbols": {
"fallback": "♫",
"play": "▶",
"pause": "▮▮",
"stop": "■"
}
}
},
"powerline.segments.common.bat.battery": {
"args": {
"full_heart": "♥",
@ -108,15 +98,15 @@
"S": "S·LINE",
"^S": "S·BLCK",
"i": "INSERT",
"R": "REPLACE",
"Rv": "V·RPLCE",
"R": "RPLACE",
"Rv": "V·RPLC",
"c": "COMMND",
"cv": "VIM EX",
"ce": "EX",
"cv": "VIM·EX",
"ce": "NRM·EX",
"r": "PROMPT",
"rm": "MORE",
"r?": "CONFIRM",
"!": "SHELL"
"rm": "-MORE-",
"r?": "CNFIRM",
"!": "!SHELL"
}
}
},

View File

@ -48,16 +48,6 @@
"powerline.segments.common.net.hostname": {
"before": "⌂"
},
"powerline.segments.common.players.now_playing": {
"args": {
"state_symbols": {
"fallback": "♫",
"play": "▶",
"pause": "▮▮",
"stop": "■"
}
}
},
"powerline.segments.common.bat.battery": {
"args": {
"full_heart": "♥",

View File

@ -4,11 +4,11 @@
{
"type": "string",
"contents": "Command Line",
"highlight_group": ["file_name"]
"highlight_groups": ["file_name"]
},
{
"type": "string",
"highlight_group": ["background"],
"highlight_groups": ["background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"

View File

@ -71,7 +71,7 @@
},
{
"type": "string",
"highlight_group": ["background"],
"highlight_groups": ["background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"
@ -107,7 +107,7 @@
{
"type": "string",
"name": "line_current_symbol",
"highlight_group": ["line_current_symbol", "line_current"]
"highlight_groups": ["line_current_symbol", "line_current"]
},
{
"function": "line_current",

View File

@ -7,7 +7,7 @@
},
{
"type": "string",
"highlight_group": ["background"],
"highlight_groups": ["background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"
@ -23,7 +23,7 @@
{
"type": "string",
"name": "line_current_symbol",
"highlight_group": ["line_current_symbol", "line_current"]
"highlight_groups": ["line_current_symbol", "line_current"]
},
{
"function": "line_current",

View File

@ -4,7 +4,7 @@
{
"type": "string",
"contents": "Command-T",
"highlight_group": ["commandt:label"]
"highlight_groups": ["commandt:label"]
},
{
"function": "powerline.segments.vim.plugin.commandt.finder"
@ -14,7 +14,7 @@
},
{
"type": "string",
"highlight_group": ["commandt:background"],
"highlight_groups": ["commandt:background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"

View File

@ -1,28 +0,0 @@
{
"default_module": "powerline.segments.vim.plugin.ctrlp",
"segments": {
"left": [
{
"function": "ctrlp",
"args": {
"side": "left"
}
},
{
"type": "string",
"highlight_group": ["ctrlp.background", "background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"
}
],
"right": [
{
"function": "ctrlp",
"args": {
"side": "right"
}
}
]
}
}

View File

@ -3,12 +3,12 @@
"left": [
{
"type": "string",
"highlight_group": ["gundo.name", "file_name"],
"highlight_groups": ["gundo:name", "file_name"],
"contents": "Undo diff"
},
{
"type": "string",
"highlight_group": ["gundo.background", "background"],
"highlight_groups": ["gundo:background", "background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"

View File

@ -3,12 +3,12 @@
"left": [
{
"type": "string",
"highlight_group": ["gundo.name", "file_name"],
"highlight_groups": ["gundo:name", "file_name"],
"contents": "Undo tree"
},
{
"type": "string",
"highlight_group": ["gundo.background", "background"],
"highlight_groups": ["gundo:background", "background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"

View File

@ -7,7 +7,7 @@
},
{
"type": "string",
"highlight_group": ["background"],
"highlight_groups": ["background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"

View File

@ -9,7 +9,7 @@
{
"type": "string",
"name": "buffer_name",
"highlight_group": ["file_name"]
"highlight_groups": ["file_name"]
},
{
"function": "window_title",
@ -17,7 +17,7 @@
},
{
"type": "string",
"highlight_group": ["background"],
"highlight_groups": ["background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"
@ -27,7 +27,7 @@
{
"type": "string",
"name": "line_current_symbol",
"highlight_group": ["line_current_symbol", "line_current"]
"highlight_groups": ["line_current_symbol", "line_current"]
},
{
"function": "line_current",

View File

@ -58,7 +58,7 @@
},
{
"type": "string",
"highlight_group": ["background"],
"highlight_groups": ["background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"
@ -69,14 +69,14 @@
"type": "string",
"contents": "Bufs",
"name": "single_tab",
"highlight_group": ["single_tab"],
"highlight_groups": ["single_tab"],
"include_function": "single_tab"
},
{
"type": "string",
"contents": "Tabs",
"name": "many_tabs",
"highlight_group": ["many_tabs"],
"highlight_groups": ["many_tabs"],
"exclude_function": "single_tab"
}
]

View File

@ -2,7 +2,7 @@
from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline import Powerline
from powerline.lib import mergedicts
from powerline.lib.dict import mergedicts
from powerline.lib.unicode import string
@ -32,8 +32,8 @@ class IPythonPowerline(Powerline):
)
def get_config_paths(self):
if self.paths:
return self.paths
if self.config_paths:
return self.config_paths
else:
return super(IPythonPowerline, self).get_config_paths()

View File

@ -1,14 +1,9 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import json
from functools import wraps
REMOVE_THIS_KEY = object()
def wraps_saveargs(wrapped):
def dec(wrapper):
r = wraps(wrapped)(wrapper)
@ -17,47 +12,6 @@ def wraps_saveargs(wrapped):
return dec
def mergedicts(d1, d2):
'''Recursively merge two dictionaries
First dictionary is modified in-place.
'''
for k in d2:
if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], dict):
mergedicts(d1[k], d2[k])
elif d2[k] is REMOVE_THIS_KEY:
d1.pop(k, None)
else:
d1[k] = d2[k]
def mergedefaults(d1, d2):
'''Recursively merge two dictionaries, keeping existing values
First dictionary is modified in-place.
'''
for k in d2:
if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], dict):
mergedefaults(d1[k], d2[k])
else:
d1.setdefault(k, d2[k])
def mergedicts_copy(d1, d2):
'''Recursively merge two dictionaries.
Dictionaries are not modified. Copying happens only if necessary. Assumes
that first dictionary supports .copy() method.
'''
ret = d1.copy()
for k in d2:
if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], dict):
ret[k] = mergedicts_copy(d1[k], d2[k])
else:
ret[k] = d2[k]
return ret
def add_divider_highlight_group(highlight_group):
def dec(func):
@wraps_saveargs(func)
@ -72,39 +26,3 @@ def add_divider_highlight_group(highlight_group):
return None
return f
return dec
def keyvaluesplit(s):
if '=' not in s:
raise TypeError('Option must look like option=json_value')
if s[0] == '_':
raise ValueError('Option names must not start with `_\'')
idx = s.index('=')
o = s[:idx]
rest = s[idx + 1:]
if not rest:
val = REMOVE_THIS_KEY
elif rest[0] in '"{[0193456789' or rest in ('null', 'true', 'false'):
val = json.loads(s[idx + 1:])
else:
val = rest
return (o, val)
def parsedotval(s):
if type(s) is tuple:
o, val = s
else:
o, val = keyvaluesplit(s)
keys = o.split('.')
if len(keys) > 1:
r = (keys[0], {})
rcur = r[1]
for key in keys[1:-1]:
rcur[key] = {}
rcur = rcur[key]
rcur[keys[-1]] = val
return r
else:
return (o, val)

80
powerline/lib/dict.py Normal file
View File

@ -0,0 +1,80 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
REMOVE_THIS_KEY = object()
def mergeargs(argvalue, remove=False):
if not argvalue:
return None
r = {}
for subval in argvalue:
mergedicts(r, dict([subval]), remove=remove)
return r
def _clear_special_values(d):
'''Remove REMOVE_THIS_KEY values from dictionary
'''
l = [d]
while l:
i = l.pop()
pops = []
for k, v in i.items():
if v is REMOVE_THIS_KEY:
pops.append(k)
elif isinstance(v, dict):
l.append(v)
for k in pops:
i.pop(k)
def mergedicts(d1, d2, remove=True):
'''Recursively merge two dictionaries
First dictionary is modified in-place.
'''
_setmerged(d1, d2)
for k in d2:
if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], dict):
mergedicts(d1[k], d2[k], remove)
elif remove and d2[k] is REMOVE_THIS_KEY:
d1.pop(k, None)
else:
if remove and isinstance(d2[k], dict):
_clear_special_values(d2[k])
d1[k] = d2[k]
def mergedefaults(d1, d2):
'''Recursively merge two dictionaries, keeping existing values
First dictionary is modified in-place.
'''
for k in d2:
if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], dict):
mergedefaults(d1[k], d2[k])
else:
d1.setdefault(k, d2[k])
def _setmerged(d1, d2):
if hasattr(d1, 'setmerged'):
d1.setmerged(d2)
def mergedicts_copy(d1, d2):
'''Recursively merge two dictionaries.
Dictionaries are not modified. Copying happens only if necessary. Assumes
that first dictionary supports .copy() method.
'''
ret = d1.copy()
_setmerged(ret, d2)
for k in d2:
if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], dict):
ret[k] = mergedicts_copy(d1[k], d2[k])
else:
ret[k] = d2[k]
return ret

View File

@ -0,0 +1,80 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import json
from powerline.lib.dict import REMOVE_THIS_KEY
def parse_value(s):
'''Convert string to Python object
Rules:
* Empty string means that corresponding key should be removed from the
dictionary.
* Strings that start with a minus, digit or with some character that starts
JSON collection or string object are parsed as JSON.
* JSON special values ``null``, ``true``, ``false`` (case matters) are
parsed as JSON.
* All other values are considered to be raw strings.
:param str s: Parsed string.
:return: Python object.
'''
if not s:
return REMOVE_THIS_KEY
elif s[0] in '"{[0193456789-' or s in ('null', 'true', 'false'):
return json.loads(s)
else:
return s
def keyvaluesplit(s):
'''Split K1.K2=VAL into K1.K2 and parsed VAL
'''
if '=' not in s:
raise TypeError('Option must look like option=json_value')
if s[0] == '_':
raise ValueError('Option names must not start with `_\'')
idx = s.index('=')
o = s[:idx]
val = parse_value(s[idx + 1:])
return (o, val)
def parsedotval(s):
'''Parse K1.K2=VAL into {"K1":{"K2":VAL}}
``VAL`` is processed according to rules defined in :py:func:`parse_value`.
'''
if type(s) is tuple:
o, val = s
val = parse_value(val)
else:
o, val = keyvaluesplit(s)
keys = o.split('.')
if len(keys) > 1:
r = (keys[0], {})
rcur = r[1]
for key in keys[1:-1]:
rcur[key] = {}
rcur = rcur[key]
rcur[keys[-1]] = val
return r
else:
return (o, val)
def parse_override_var(s):
'''Parse a semicolon-separated list of strings into a sequence of values
Emits the same items in sequence as :py:func:`parsedotval` does.
'''
return (
parsedotval(item)
for item in s.split(';')
if item
)

View File

@ -18,15 +18,19 @@ class UvNotFound(NotImplementedError):
pyuv = None
pyuv_version_info = None
def import_pyuv():
global pyuv
global pyuv_version_info
if not pyuv:
try:
pyuv = __import__('pyuv')
except ImportError:
raise UvNotFound
else:
pyuv_version_info = tuple((int(c) for c in pyuv.__version__.split('.')))
class UvThread(Thread):
@ -34,14 +38,18 @@ class UvThread(Thread):
def __init__(self, loop):
self.uv_loop = loop
self.async_handle = pyuv.Async(loop, self._async_cb)
super(UvThread, self).__init__()
def _async_cb(self, handle):
self.uv_loop.stop()
self.async_handle.close()
def run(self):
while True:
self.uv_loop.run()
def join(self):
self.uv_loop.stop()
self.async_handle.send()
return super(UvThread, self).join()
@ -72,18 +80,30 @@ class UvWatcher(object):
self.lock = RLock()
self.loop = start_uv_thread()
self.fenc = get_preferred_file_name_encoding()
if pyuv_version_info >= (1, 0):
self._start_watch = self._start_watch_1_x
else:
self._start_watch = self._start_watch_0_x
def watch(self, path):
path = normpath(path, self.fenc)
with self.lock:
if path not in self.watches:
try:
def _start_watch_1_x(self, path):
handle = pyuv.fs.FSEvent(self.loop)
handle.start(path, 0, partial(self._record_event, path))
self.watches[path] = handle
def _start_watch_0_x(self, path):
self.watches[path] = pyuv.fs.FSEvent(
self.loop,
path,
partial(self._record_event, path),
pyuv.fs.UV_CHANGE | pyuv.fs.UV_RENAME
)
def watch(self, path):
path = normpath(path, self.fenc)
with self.lock:
if path not in self.watches:
try:
self._start_watch(path)
except pyuv.error.FSEventError as e:
code = e.args[0]
if code == pyuv.errno.UV_ENOENT:

View File

@ -5,13 +5,15 @@ import os
import logging
from collections import defaultdict
from itertools import chain
from functools import partial
from powerline import generate_config_finder, get_config_paths, load_config
from powerline.segments.vim import vim_modes
from powerline.lib import mergedicts_copy
from powerline.lib.dict import mergedicts_copy
from powerline.lib.config import ConfigLoader
from powerline.lib.unicode import unicode
from powerline.lib.path import join
from powerline.lint.markedjson import load
from powerline.lint.markedjson.error import echoerr, EchoErr, MarkedError
from powerline.lint.checks import (check_matcher_func, check_ext, check_config, check_top_theme,
@ -19,7 +21,8 @@ from powerline.lint.checks import (check_matcher_func, check_ext, check_config,
check_segment_module, check_exinclude_function, type_keys,
check_segment_function, check_args, get_one_segment_function,
check_highlight_groups, check_highlight_group, check_full_segment_data,
get_all_possible_functions, check_segment_data_key, register_common_name)
get_all_possible_functions, check_segment_data_key, register_common_name,
highlight_group_spec)
from powerline.lint.spec import Spec
from powerline.lint.context import Context
@ -57,6 +60,7 @@ main_spec = (Spec(
common=Spec(
default_top_theme=top_theme_spec().optional(),
term_truecolor=Spec().type(bool).optional(),
term_escape_style=Spec().type(unicode).oneof(set(('auto', 'xterm', 'fbterm'))).optional(),
# Python is capable of loading from zip archives. Thus checking path
# only for existence of the path, not for it being a directory
paths=Spec().list(
@ -141,7 +145,7 @@ group_name_spec = Spec().ident().copy
group_spec = Spec().either(Spec(
fg=color_spec(),
bg=color_spec(),
attr=Spec().list(Spec().type(unicode).oneof(set(('bold', 'italic', 'underline')))),
attrs=Spec().list(Spec().type(unicode).oneof(set(('bold', 'italic', 'underline')))),
), group_name_spec().func(check_group)).copy
groups_spec = Spec().unknown_spec(
group_name_spec(),
@ -193,7 +197,6 @@ args_spec = Spec(
pl=Spec().error('pl object must be set by powerline').optional(),
segment_info=Spec().error('Segment info dictionary must be set by powerline').optional(),
).unknown_spec(Spec(), Spec()).optional().copy
highlight_group_spec = Spec().type(unicode).copy
segment_module_spec = Spec().type(unicode).func(check_segment_module).optional().copy
sub_segments_spec = Spec()
exinclude_spec = Spec().re(function_name_re).func(check_exinclude_function).copy
@ -217,7 +220,7 @@ segment_spec = Spec(
align=Spec().oneof(set('lr')).optional(),
args=args_spec().func(lambda *args, **kwargs: check_args(get_one_segment_function, *args, **kwargs)),
contents=Spec().printable().optional(),
highlight_group=Spec().list(
highlight_groups=Spec().list(
highlight_group_spec().re(
'^(?:(?!:divider$).)+$',
(lambda value: 'it is recommended that only divider highlight group names end with ":divider"')
@ -293,6 +296,74 @@ def register_common_names():
register_common_name('player', 'powerline.segments.common.players', '_player')
def load_json_file(path):
with open_file(path) as F:
try:
config, hadproblem = load(F)
except MarkedError as e:
return True, None, str(e)
else:
return hadproblem, config, None
def updated_with_config(d):
hadproblem, config, error = load_json_file(d['path'])
d.update(
hadproblem=hadproblem,
config=config,
error=error,
)
return d
def find_all_ext_config_files(search_paths, subdir):
for config_root in search_paths:
top_config_subpath = join(config_root, subdir)
if not os.path.isdir(top_config_subpath):
if os.path.exists(top_config_subpath):
yield {
'error': 'Path {0} is not a directory'.format(top_config_subpath),
'path': top_config_subpath,
}
continue
for ext_name in os.listdir(top_config_subpath):
ext_path = os.path.join(top_config_subpath, ext_name)
if not os.path.isdir(ext_path):
if ext_name.endswith('.json') and os.path.isfile(ext_path):
yield updated_with_config({
'error': False,
'path': ext_path,
'name': ext_name[:-5],
'ext': None,
'type': 'top_' + subdir,
})
else:
yield {
'error': 'Path {0} is not a directory or configuration file'.format(ext_path),
'path': ext_path,
}
continue
for config_file_name in os.listdir(ext_path):
config_file_path = os.path.join(ext_path, config_file_name)
if config_file_name.endswith('.json') and os.path.isfile(config_file_path):
yield updated_with_config({
'error': False,
'path': config_file_path,
'name': config_file_name[:-5],
'ext': ext_name,
'type': subdir,
})
else:
yield {
'error': 'Path {0} is not a configuration file'.format(config_file_path),
'path': config_file_path,
}
def dict2(d):
return defaultdict(dict, ((k, dict(v)) for k, v in d.items()))
def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
'''Check configuration sanity
@ -312,6 +383,8 @@ def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
``False`` if user configuration seems to be completely sane and ``True``
if some problems were found.
'''
hadproblem = False
register_common_names()
search_paths = paths or get_config_paths()
find_config_files = generate_config_finder(lambda: search_paths)
@ -336,65 +409,60 @@ def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
config_loader = ConfigLoader(run_once=True, load=load_json_config)
paths = {
'themes': defaultdict(lambda: []),
'colorschemes': defaultdict(lambda: []),
'top_colorschemes': [],
'top_themes': [],
}
lists = {
'colorschemes': set(),
'themes': set(),
'exts': set(),
}
for path in reversed(search_paths):
for typ in ('themes', 'colorschemes'):
d = os.path.join(path, typ)
if os.path.isdir(d):
for subp in os.listdir(d):
extpath = os.path.join(d, subp)
if os.path.isdir(extpath):
lists['exts'].add(subp)
paths[typ][subp].append(extpath)
elif extpath.endswith('.json'):
name = subp[:-5]
if name != '__main__':
lists[typ].add(name)
paths['top_' + typ].append(extpath)
else:
found_dir = {
'themes': False,
'colorschemes': False,
}
config_paths = defaultdict(lambda: defaultdict(dict))
loaded_configs = defaultdict(lambda: defaultdict(dict))
for d in chain(
find_all_ext_config_files(search_paths, 'colorschemes'),
find_all_ext_config_files(search_paths, 'themes'),
):
if d['error']:
hadproblem = True
ee(problem='Path {0} is supposed to be a directory, but it is not'.format(d))
hadproblem = False
configs = defaultdict(lambda: defaultdict(lambda: {}))
for typ in ('themes', 'colorschemes'):
for ext in paths[typ]:
for d in paths[typ][ext]:
for subp in os.listdir(d):
if subp.endswith('.json'):
name = subp[:-5]
if name != '__main__':
lists[typ].add(name)
if name.startswith('__') or name.endswith('__'):
ee(problem=d['error'])
continue
if d['hadproblem']:
hadproblem = True
if d['ext']:
found_dir[d['type']] = True
lists['exts'].add(d['ext'])
if d['name'] == '__main__':
pass
elif d['name'].startswith('__') or d['name'].endswith('__'):
hadproblem = True
ee(problem='File name is not supposed to start or end with “__”: {0}'.format(
os.path.join(d, subp)
))
configs[typ][ext][name] = os.path.join(d, subp)
for path in paths['top_' + typ]:
name = os.path.basename(path)[:-5]
configs['top_' + typ][name] = path
d['path']))
else:
lists[d['type']].add(d['name'])
config_paths[d['type']][d['ext']][d['name']] = d['path']
loaded_configs[d['type']][d['ext']][d['name']] = d['config']
else:
config_paths[d['type']][d['name']] = d['path']
loaded_configs[d['type']][d['name']] = d['config']
diff = set(configs['colorschemes']) - set(configs['themes'])
for typ in ('themes', 'colorschemes'):
if not found_dir[typ]:
hadproblem = True
ee(problem='Subdirectory {0} was not found in paths {1}'.format(typ, ', '.join(search_paths)))
diff = set(config_paths['colorschemes']) - set(config_paths['themes'])
if diff:
hadproblem = True
for ext in diff:
typ = 'colorschemes' if ext in configs['themes'] else 'themes'
if not configs['top_' + typ] or typ == 'themes':
typ = 'colorschemes' if ext in config_paths['themes'] else 'themes'
if not config_paths['top_' + typ] or typ == 'themes':
ee(problem='{0} extension {1} not present in {2}'.format(
ext,
'configuration' if (ext in paths['themes'] and ext in paths['colorschemes']) else 'directory',
'configuration' if (
ext in loaded_configs['themes'] and ext in loaded_configs['colorschemes']
) else 'directory',
typ,
))
@ -411,7 +479,7 @@ def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
else:
if used_main_spec.match(
main_config,
data={'configs': configs, 'lists': lists},
data={'configs': config_paths, 'lists': lists},
context=Context(main_config),
echoerr=ee
)[1]:
@ -436,42 +504,19 @@ def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
if lhadproblem[0]:
hadproblem = True
top_colorscheme_configs = {}
top_colorscheme_configs = dict(loaded_configs['top_colorschemes'])
data = {
'ext': None,
'top_colorscheme_configs': top_colorscheme_configs,
'ext_colorscheme_configs': {},
'colors_config': colors_config
}
for colorscheme, cfile in configs['top_colorschemes'].items():
with open_file(cfile) as config_file_fp:
try:
config, lhadproblem = load(config_file_fp)
except MarkedError as e:
ee(problem=str(e))
hadproblem = True
continue
if lhadproblem:
hadproblem = True
top_colorscheme_configs[colorscheme] = config
for colorscheme, config in loaded_configs['top_colorschemes'].items():
data['colorscheme'] = colorscheme
if top_colorscheme_spec.match(config, context=Context(config), data=data, echoerr=ee)[1]:
hadproblem = True
ext_colorscheme_configs = defaultdict(lambda: {})
for ext in configs['colorschemes']:
for colorscheme, cfile in configs['colorschemes'][ext].items():
with open_file(cfile) as config_file_fp:
try:
config, lhadproblem = load(config_file_fp)
except MarkedError as e:
ee(problem=str(e))
hadproblem = True
continue
if lhadproblem:
hadproblem = True
ext_colorscheme_configs[ext][colorscheme] = config
ext_colorscheme_configs = dict2(loaded_configs['colorschemes'])
for ext, econfigs in ext_colorscheme_configs.items():
data = {
'ext': ext,
@ -511,33 +556,8 @@ def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
config = mconfig
colorscheme_configs[colorscheme] = config
theme_configs = defaultdict(lambda: {})
for ext in configs['themes']:
for theme, sfile in configs['themes'][ext].items():
with open_file(sfile) as config_file_fp:
try:
config, lhadproblem = load(config_file_fp)
except MarkedError as e:
ee(problem=str(e))
hadproblem = True
continue
if lhadproblem:
hadproblem = True
theme_configs[ext][theme] = config
top_theme_configs = {}
for top_theme, top_theme_file in configs['top_themes'].items():
with open_file(top_theme_file) as config_file_fp:
try:
config, lhadproblem = load(config_file_fp)
except MarkedError as e:
ee(problem=str(e))
hadproblem = True
continue
if lhadproblem:
hadproblem = True
top_theme_configs[top_theme] = config
theme_configs = dict2(loaded_configs['themes'])
top_theme_configs = dict(loaded_configs['top_themes'])
for ext, configs in theme_configs.items():
data = {
'ext': ext,
@ -561,12 +581,12 @@ def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
for top_theme, config in top_theme_configs.items():
data = {
'ext': ext,
'ext': None,
'colorscheme_configs': colorscheme_configs,
'import_paths': import_paths,
'main_config': main_config,
'theme_configs': theme_configs,
'ext_theme_configs': configs,
'ext_theme_configs': None,
'colors_config': colors_config
}
data['theme_type'] = 'top'

View File

@ -33,7 +33,7 @@ generic_keys = set((
))
type_keys = {
'function': set(('function', 'args', 'draw_inner_divider')),
'string': set(('contents', 'type', 'highlight_group', 'divider_highlight_group')),
'string': set(('contents', 'type', 'highlight_groups', 'divider_highlight_group')),
'segment_list': set(('function', 'segments', 'args', 'type')),
}
required_keys = {
@ -41,7 +41,7 @@ required_keys = {
'string': set(()),
'segment_list': set(('function', 'segments',)),
}
highlight_keys = set(('highlight_group', 'name'))
highlight_keys = set(('highlight_groups', 'name'))
def get_function_strings(function_name, context, ext):
@ -281,7 +281,7 @@ def check_key_compatibility(segment, data, context, echoerr):
context_mark=context[-1][1].mark,
problem=(
'found missing keys required to determine highlight group. '
'Either highlight_group or name key must be present'
'Either highlight_groups or name key must be present'
)
)
hadproblem = True
@ -344,6 +344,28 @@ def check_full_segment_data(segment, data, context, echoerr):
return check_key_compatibility(segment_copy, data, context, echoerr)
highlight_group_spec = Spec().ident().copy
_highlight_group_spec = highlight_group_spec().context_message(
'Error while checking function documentation while checking theme (key {key})')
def check_hl_group_name(hl_group, context_mark, context, echoerr):
'''Check highlight group name: it should match naming conventions
:param str hl_group:
Checked group.
:param Mark context_mark:
Context mark. May be ``None``.
:param Context context:
Current context.
:param func echoerr:
Function used for error reporting.
:return: ``False`` if check succeeded and ``True`` if it failed.
'''
return _highlight_group_spec.match(hl_group, context_mark=context_mark, context=context, echoerr=echoerr)[1]
def check_segment_function(function_name, data, context, echoerr):
havemarks(function_name)
ext = data['ext']
@ -385,13 +407,16 @@ def check_segment_function(function_name, data, context, echoerr):
if r:
echoerr(
context='Error while checking theme (key {key})'.format(key=context.key),
context_mark=function_name.mark,
problem=(
'found highlight group {0} not defined in the following colorschemes: {1}\n'
'(Group name was obtained from function documentation.)'
).format(divider_hl_group, list_sep.join(r)),
problem_mark=function_name.mark
problem_mark=divider_hl_group.mark,
)
hadproblem = True
if check_hl_group_name(divider_hl_group, function_name.mark, context, echoerr):
hadproblem = True
if hl_groups:
greg = re.compile(r'``([^`]+)``( \(gradient\))?')
@ -409,6 +434,8 @@ def check_segment_function(function_name, data, context, echoerr):
match.group(1),
Mark(*mark_args, pointer=sub_pointer + match.start(1))
)
if check_hl_group_name(hl_group, function_name.mark, context, echoerr):
hadproblem = True
gradient = bool(match.group(2))
required_pack.append((hl_group, gradient))
finally:

View File

@ -21,18 +21,6 @@ class WithPath(object):
def import_function(function_type, name, data, context, echoerr, module):
havemarks(name, module)
if module == 'powerline.segments.common':
echoerr(context='Warning while checking segments (key {key})'.format(key=context.key),
context_mark=name.mark,
problem='module {0} is deprecated'.format(module),
problem_mark=module.mark)
if module == 'powerline.segments.common.players' and name == 'now_playing':
echoerr(context='Warning while checking segments (key {key})'.format(key=context.key),
context_mark=name.mark,
problem='function {0}.{1} is deprecated: use {0}.{{player_name}} instead'.format(module, name),
problem_mark=module.mark)
with WithPath(data['import_paths']):
try:
func = getattr(__import__(str(module), fromlist=[str(name)]), str(name))

View File

@ -42,15 +42,17 @@ def strtrans(s):
class Mark:
def __init__(self, name, line, column, buffer, pointer):
def __init__(self, name, line, column, buffer, pointer, old_mark=None, merged_marks=None):
self.name = name
self.line = line
self.column = column
self.buffer = buffer
self.pointer = pointer
self.old_mark = old_mark
self.merged_marks = merged_marks or []
def copy(self):
return Mark(self.name, self.line, self.column, self.buffer, self.pointer)
return Mark(self.name, self.line, self.column, self.buffer, self.pointer, self.old_mark, self.merged_marks[:])
def get_snippet(self, indent=4, max_length=75):
if self.buffer is None:
@ -85,17 +87,57 @@ class Mark:
ret.pointer += diff
return ret
def __str__(self):
snippet = self.get_snippet()
where = (' in "%s", line %d, column %d' % (
self.name, self.line + 1, self.column + 1))
if snippet is not None:
def set_old_mark(self, old_mark):
if self is old_mark:
return
checked_marks = set([id(self)])
older_mark = old_mark
while True:
if id(older_mark) in checked_marks:
raise ValueError('Trying to set recursive marks')
checked_marks.add(id(older_mark))
older_mark = older_mark.old_mark
if not older_mark:
break
self.old_mark = old_mark
def set_merged_mark(self, merged_mark):
self.merged_marks.append(merged_mark)
def to_string(self, indent=0, head_text='in ', add_snippet=True):
mark = self
where = ''
processed_marks = set()
while mark:
indentstr = ' ' * indent
where += ('%s %s"%s", line %d, column %d' % (
indentstr, head_text, mark.name, mark.line + 1, mark.column + 1))
if add_snippet:
snippet = mark.get_snippet(indent=(indent + 4))
if snippet:
where += ':\n' + snippet
if mark.merged_marks:
where += '\n' + indentstr + ' with additionally merged\n'
where += mark.merged_marks[0].to_string(indent + 4, head_text='', add_snippet=False)
for mmark in mark.merged_marks[1:]:
where += '\n' + indentstr + ' and\n'
where += mmark.to_string(indent + 4, head_text='', add_snippet=False)
if add_snippet:
processed_marks.add(id(mark))
if mark.old_mark:
where += '\n' + indentstr + ' which replaced value\n'
indent += 4
mark = mark.old_mark
if id(mark) in processed_marks:
raise ValueError('Trying to dump recursive mark')
if type(where) is str:
return where
else:
return where.encode('utf-8')
def __str__(self):
return self.to_string()
def echoerr(*args, **kwargs):
stream = kwargs.pop('stream', sys.stderr)

View File

@ -65,7 +65,28 @@ class MarkedDict(dict):
r.keydict = dict(((key, key) for key in r))
return r
def setmerged(self, d):
try:
self.mark.set_merged_mark(d.mark)
except AttributeError:
pass
def __setitem__(self, key, value):
try:
old_value = self[key]
except KeyError:
pass
else:
try:
key.mark.set_old_mark(self.keydict[key].mark)
except AttributeError:
pass
except KeyError:
pass
try:
value.mark.set_old_mark(old_value.mark)
except AttributeError:
pass
dict.__setitem__(self, key, value)
self.keydict[key] = key

View File

@ -1,33 +0,0 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
from powerline.bindings.vim import buffer_name
try:
import vim
except ImportError:
pass
else:
vim.command('''
function! Powerline_plugin_ctrlp_main(...)
let b:powerline_ctrlp_type = 'main'
let b:powerline_ctrlp_args = a:000
endfunction''')
vim.command('''
function! Powerline_plugin_ctrlp_prog(...)
let b:powerline_ctrlp_type = 'prog'
let b:powerline_ctrlp_args = a:000
endfunction''')
vim.command('''
let g:ctrlp_status_func = {'main': 'Powerline_plugin_ctrlp_main', 'prog': 'Powerline_plugin_ctrlp_prog'}
''')
def ctrlp(matcher_info):
name = buffer_name(matcher_info)
return name and os.path.basename(name) == b'ControlP'

View File

@ -291,7 +291,7 @@ class Renderer(object):
line=line,
output_raw=output_raw,
output_width=output_width,
segment_info=segment_info,
segment_info=self.get_segment_info(segment_info, mode),
theme=theme,
)
@ -310,7 +310,7 @@ class Renderer(object):
def do_render(self, mode, width, side, line, output_raw, output_width, segment_info, theme):
'''Like Renderer.render(), but accept theme in place of matcher_info
'''
segments = list(theme.get_segments(side, line, self.get_segment_info(segment_info, mode), mode))
segments = list(theme.get_segments(side, line, segment_info, mode))
current_width = 0
@ -492,7 +492,7 @@ class Renderer(object):
'''
return string.translate(self.character_translations)
def hlstyle(fg=None, bg=None, attr=None):
def hlstyle(fg=None, bg=None, attrs=None):
'''Output highlight style string.
Assuming highlighted string looks like ``{style}{contents}`` this method
@ -501,10 +501,10 @@ class Renderer(object):
'''
raise NotImplementedError
def hl(self, contents, fg=None, bg=None, attr=None):
def hl(self, contents, fg=None, bg=None, attrs=None):
'''Output highlighted chunk.
This implementation just outputs ``.hlstyle()`` joined with
``contents``.
'''
return self.hlstyle(fg, bg, attr) + (contents or '')
return self.hlstyle(fg, bg, attrs) + (contents or '')

View File

@ -17,7 +17,7 @@ class I3barRenderer(Renderer):
# We dont need to explicitly reset attributes, so skip those calls
return ''
def hl(self, contents, fg=None, bg=None, attr=None):
def hl(self, contents, fg=None, bg=None, attrs=None):
segment = {
'full_text': contents,
'separator': False,

View File

@ -33,9 +33,16 @@ class IPythonRenderer(ShellRenderer):
if 'theme' in match:
match['theme'].shutdown()
def render(self, *args, **kwargs):
def render(self, **kwargs):
# XXX super(ShellRenderer), *not* super(IPythonRenderer)
return super(ShellRenderer, self).render(*args, **kwargs)
return super(ShellRenderer, self).render(**kwargs)
def do_render(self, segment_info, **kwargs):
segment_info.update(client_id='ipython')
return super(IPythonRenderer, self).do_render(
segment_info=segment_info,
**kwargs
)
class IPythonPromptRenderer(IPythonRenderer):

View File

@ -15,7 +15,7 @@ class PangoMarkupRenderer(Renderer):
# We dont need to explicitly reset attributes, so skip those calls
return ''
def hl(self, contents, fg=None, bg=None, attr=None):
def hl(self, contents, fg=None, bg=None, attrs=None):
'''Highlight a segment.'''
awesome_attr = []
if fg is not None:
@ -24,12 +24,12 @@ class PangoMarkupRenderer(Renderer):
if bg is not None:
if bg is not False and bg[1] is not False:
awesome_attr += ['background="#{0:06x}"'.format(bg[1])]
if attr is not None and attr is not False:
if attr & ATTR_BOLD:
if attrs is not None and attrs is not False:
if attrs & ATTR_BOLD:
awesome_attr += ['font_weight="bold"']
if attr & ATTR_ITALIC:
if attrs & ATTR_ITALIC:
awesome_attr += ['font_style="italic"']
if attr & ATTR_UNDERLINE:
if attrs & ATTR_UNDERLINE:
awesome_attr += ['underline="single"']
return '<span ' + ' '.join(awesome_attr) + '>' + contents + '</span>'

View File

@ -18,6 +18,7 @@ class ShellRenderer(Renderer):
escape_hl_start = ''
escape_hl_end = ''
term_truecolor = False
term_escape_style = 'auto'
tmux_escape = False
screen_escape = False
@ -36,10 +37,18 @@ class ShellRenderer(Renderer):
)
def do_render(self, output_width, segment_info, side, theme, width=None, **kwargs):
if self.term_escape_style == 'auto':
if segment_info['environ'].get('TERM') == 'fbterm':
self.used_term_escape_style = 'fbterm'
else:
self.used_term_escape_style = 'xterm'
else:
self.used_term_escape_style = self.term_escape_style
if isinstance(segment_info, dict):
client_id = segment_info.get('client_id')
else:
client_id = None
if client_id is not None:
local_key = (client_id, side, None if theme is self.theme else id(theme))
key = (client_id, side, None)
did_width = False
@ -50,8 +59,7 @@ class ShellRenderer(Renderer):
pass
else:
did_width = True
if not did_width:
if width is not None:
if not did_width and width is not None:
if theme.cursor_space_multiplier is not None:
width = int(width * theme.cursor_space_multiplier)
elif theme.cursor_columns:
@ -70,6 +78,7 @@ class ShellRenderer(Renderer):
side=side,
**kwargs
)
if client_id is not None:
self.old_widths[local_key] = res[-1]
ret = res if output_width else res[:-1]
if len(ret) == 1:
@ -77,7 +86,7 @@ class ShellRenderer(Renderer):
else:
return ret
def hlstyle(self, fg=None, bg=None, attr=None):
def hlstyle(self, fg=None, bg=None, attrs=None):
'''Highlight a segment.
If an argument is None, the argument is ignored. If an argument is
@ -85,11 +94,13 @@ class ShellRenderer(Renderer):
is a valid color or attribute, its added to the ANSI escape code.
'''
ansi = [0]
is_fbterm = self.used_term_escape_style == 'fbterm'
term_truecolor = not is_fbterm and self.term_truecolor
if fg is not None:
if fg is False or fg[0] is False:
ansi += [39]
else:
if self.term_truecolor:
if term_truecolor:
ansi += [38, 2] + list(int_to_rgb(fg[1]))
else:
ansi += [38, 5, fg[0]]
@ -97,22 +108,36 @@ class ShellRenderer(Renderer):
if bg is False or bg[0] is False:
ansi += [49]
else:
if self.term_truecolor:
if term_truecolor:
ansi += [48, 2] + list(int_to_rgb(bg[1]))
else:
ansi += [48, 5, bg[0]]
if attr is not None:
if attr is False:
if attrs is not None:
if attrs is False:
ansi += [22]
else:
if attr & ATTR_BOLD:
if attrs & ATTR_BOLD:
ansi += [1]
elif attr & ATTR_ITALIC:
elif attrs & ATTR_ITALIC:
# Note: is likely not to work or even be inverse in place of
# italic. Omit using this in colorschemes.
ansi += [3]
elif attr & ATTR_UNDERLINE:
elif attrs & ATTR_UNDERLINE:
ansi += [4]
if is_fbterm:
r = []
while ansi:
cur_ansi = ansi.pop(0)
if cur_ansi == 38:
ansi.pop(0)
r.append('\033[1;{0}}}'.format(ansi.pop(0)))
elif cur_ansi == 48:
ansi.pop(0)
r.append('\033[2;{0}}}'.format(ansi.pop(0)))
else:
r.append('\033[{0}m'.format(cur_ansi))
r = ''.join(r)
else:
r = '\033[{0}m'.format(';'.join(str(attr) for attr in ansi))
if self.tmux_escape:
r = '\033Ptmux;' + r.replace('\033', '\033\033') + '\033\\'

View File

@ -0,0 +1,12 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline.renderers.shell import ShellRenderer
class RcshRenderer(ShellRenderer):
'''Powerline rcsh prompt renderer'''
escape_hl_start = '\x01'
escape_hl_end = '\x02'
renderer = RcshRenderer

View File

@ -5,20 +5,20 @@ from powerline.renderer import Renderer
from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE
def attr_to_tmux_attr(attr):
if attr is False:
def attrs_to_tmux_attrs(attrs):
if attrs is False:
return ['nobold', 'noitalics', 'nounderscore']
else:
ret = []
if attr & ATTR_BOLD:
if attrs & ATTR_BOLD:
ret += ['bold']
else:
ret += ['nobold']
if attr & ATTR_ITALIC:
if attrs & ATTR_ITALIC:
ret += ['italics']
else:
ret += ['noitalics']
if attr & ATTR_UNDERLINE:
if attrs & ATTR_UNDERLINE:
ret += ['underscore']
else:
ret += ['nounderscore']
@ -31,25 +31,25 @@ class TmuxRenderer(Renderer):
character_translations = Renderer.character_translations.copy()
character_translations[ord('#')] = '##[]'
def hlstyle(self, fg=None, bg=None, attr=None):
def hlstyle(self, fg=None, bg=None, attrs=None):
'''Highlight a segment.'''
# We dont need to explicitly reset attributes, so skip those calls
if not attr and not bg and not fg:
if not attrs and not bg and not fg:
return ''
tmux_attr = []
tmux_attrs = []
if fg is not None:
if fg is False or fg[0] is False:
tmux_attr += ['fg=default']
tmux_attrs += ['fg=default']
else:
tmux_attr += ['fg=colour' + str(fg[0])]
tmux_attrs += ['fg=colour' + str(fg[0])]
if bg is not None:
if bg is False or bg[0] is False:
tmux_attr += ['bg=default']
tmux_attrs += ['bg=default']
else:
tmux_attr += ['bg=colour' + str(bg[0])]
if attr is not None:
tmux_attr += attr_to_tmux_attr(attr)
return '#[' + ','.join(tmux_attr) + ']'
tmux_attrs += ['bg=colour' + str(bg[0])]
if attrs is not None:
tmux_attrs += attrs_to_tmux_attrs(attrs)
return '#[' + ','.join(tmux_attrs) + ']'
def get_segment_info(self, segment_info, mode):
r = self.segment_info.copy()

View File

@ -5,7 +5,7 @@ import sys
import vim
from powerline.bindings.vim import vim_get_func, vim_getoption, environ, current_tabpage
from powerline.bindings.vim import vim_get_func, vim_getoption, environ, current_tabpage, get_vim_encoding
from powerline.renderer import Renderer
from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE
from powerline.theme import Theme
@ -42,7 +42,7 @@ class VimRenderer(Renderer):
self.hl_groups = {}
self.prev_highlight = None
self.strwidth_error_name = register_strwidth_error(self.strwidth)
self.encoding = vim.eval('&encoding')
self.encoding = get_vim_encoding()
def shutdown(self):
self.theme.shutdown()
@ -123,7 +123,7 @@ class VimRenderer(Renderer):
def reset_highlight(self):
self.hl_groups.clear()
def hlstyle(self, fg=None, bg=None, attr=None):
def hlstyle(self, fg=None, bg=None, attrs=None):
'''Highlight a segment.
If an argument is None, the argument is ignored. If an argument is
@ -132,23 +132,23 @@ class VimRenderer(Renderer):
'''
# In order not to hit E541 two consequent identical highlighting
# specifiers may be squashed into one.
attr = attr or 0 # Normalize `attr`
if (fg, bg, attr) == self.prev_highlight:
attrs = attrs or 0 # Normalize `attrs`
if (fg, bg, attrs) == self.prev_highlight:
return ''
self.prev_highlight = (fg, bg, attr)
self.prev_highlight = (fg, bg, attrs)
# We dont need to explicitly reset attributes in vim, so skip those
# calls
if not attr and not bg and not fg:
if not attrs and not bg and not fg:
return ''
if not (fg, bg, attr) in self.hl_groups:
if not (fg, bg, attrs) in self.hl_groups:
hl_group = {
'ctermfg': 'NONE',
'guifg': None,
'ctermbg': 'NONE',
'guibg': None,
'attr': ['NONE'],
'attrs': ['NONE'],
'name': '',
}
if fg is not None and fg is not False:
@ -157,32 +157,32 @@ class VimRenderer(Renderer):
if bg is not None and bg is not False:
hl_group['ctermbg'] = bg[0]
hl_group['guibg'] = bg[1]
if attr:
hl_group['attr'] = []
if attr & ATTR_BOLD:
hl_group['attr'].append('bold')
if attr & ATTR_ITALIC:
hl_group['attr'].append('italic')
if attr & ATTR_UNDERLINE:
hl_group['attr'].append('underline')
if attrs:
hl_group['attrs'] = []
if attrs & ATTR_BOLD:
hl_group['attrs'].append('bold')
if attrs & ATTR_ITALIC:
hl_group['attrs'].append('italic')
if attrs & ATTR_UNDERLINE:
hl_group['attrs'].append('underline')
hl_group['name'] = (
'Pl_'
+ str(hl_group['ctermfg']) + '_'
+ str(hl_group['guifg']) + '_'
+ str(hl_group['ctermbg']) + '_'
+ str(hl_group['guibg']) + '_'
+ ''.join(hl_group['attr'])
+ ''.join(hl_group['attrs'])
)
self.hl_groups[(fg, bg, attr)] = hl_group
vim.command('hi {group} ctermfg={ctermfg} guifg={guifg} guibg={guibg} ctermbg={ctermbg} cterm={attr} gui={attr}'.format(
self.hl_groups[(fg, bg, attrs)] = hl_group
vim.command('hi {group} ctermfg={ctermfg} guifg={guifg} guibg={guibg} ctermbg={ctermbg} cterm={attrs} gui={attrs}'.format(
group=hl_group['name'],
ctermfg=hl_group['ctermfg'],
guifg='#{0:06x}'.format(hl_group['guifg']) if hl_group['guifg'] is not None else 'NONE',
ctermbg=hl_group['ctermbg'],
guibg='#{0:06x}'.format(hl_group['guibg']) if hl_group['guibg'] is not None else 'NONE',
attr=','.join(hl_group['attr']),
attrs=','.join(hl_group['attrs']),
))
return '%#' + self.hl_groups[(fg, bg, attr)]['name'] + '#'
return '%#' + self.hl_groups[(fg, bg, attrs)]['name'] + '#'
renderer = VimRenderer

View File

@ -142,7 +142,7 @@ def set_segment_highlighting(pl, colorscheme, segment, mode):
hl_groups = lambda hlgs: [highlight_group_prefix + ':' + hlg for hlg in hlgs] + hlgs
try:
segment['highlight'] = colorscheme.get_highlighting(
hl_groups(segment['highlight_group']),
hl_groups(segment['highlight_groups']),
mode,
segment.get('gradient_level')
)
@ -220,6 +220,30 @@ def process_segment(pl, side, segment_info, parsed_segments, segment, mode, colo
always_true = lambda pl, segment_info, mode: True
get_fallback_segment = {
'name': 'fallback',
'type': 'string',
'highlight_groups': ['background'],
'divider_highlight_group': None,
'before': None,
'after': None,
'contents': '',
'priority': None,
'draw_soft_divider': True,
'draw_hard_divider': True,
'draw_inner_divider': True,
'display_condition': always_true,
'width': None,
'align': None,
'expand': None,
'truncate': None,
'startup': None,
'shutdown': None,
'_rendered_raw': '',
'_rendered_hl': '',
'_len': None,
'_contents_len': None,
}.copy
def gen_segment_getter(pl, ext, common_config, theme_configs, default_module, get_module_attr, top_theme):
data = {
@ -311,9 +335,9 @@ def gen_segment_getter(pl, ext, common_config, theme_configs, default_module, ge
pass
if segment_type == 'function':
highlight_group = [function_name]
highlight_groups = [function_name]
else:
highlight_group = segment.get('highlight_group') or name
highlight_groups = segment.get('highlight_groups') or [name]
if segment_type in ('function', 'segment_list'):
args = dict((
@ -336,7 +360,7 @@ def gen_segment_getter(pl, ext, common_config, theme_configs, default_module, ge
return {
'name': name or function_name,
'type': segment_type,
'highlight_group': None,
'highlight_groups': None,
'divider_highlight_group': None,
'before': None,
'after': None,
@ -391,7 +415,7 @@ def gen_segment_getter(pl, ext, common_config, theme_configs, default_module, ge
return {
'name': name or function_name,
'type': segment_type,
'highlight_group': highlight_group,
'highlight_groups': highlight_groups,
'divider_highlight_group': None,
'before': get_key(False, segment, module, function_name, name, 'before', ''),
'after': get_key(False, segment, module, function_name, name, 'after', ''),

View File

@ -1,26 +0,0 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
# DEPRECATED MODULE. Do not add any segments below. Do not remove existing
# segments as well until next major release.
from powerline.segments.common.vcs import branch # NOQA
from powerline.segments.common.sys import cpu_load_percent # NOQA
from powerline.segments.common.sys import uptime # NOQA
from powerline.segments.common.sys import system_load # NOQA
from powerline.segments.common.net import hostname # NOQA
from powerline.segments.common.net import external_ip # NOQA
from powerline.segments.common.net import internal_ip # NOQA
from powerline.segments.common.net import network_load # NOQA
from powerline.segments.common.env import cwd # NOQA
from powerline.segments.common.env import user # NOQA
from powerline.segments.common.env import environment # NOQA
from powerline.segments.common.env import virtualenv # NOQA
from powerline.segments.common.bat import battery # NOQA
from powerline.segments.common.wthr import weather # NOQA
from powerline.segments.common.time import date # NOQA
from powerline.segments.common.time import fuzzy_time # NOQA
from powerline.segments.common.mail import email_imap_alert # NOQA
from powerline.segments.common.players import now_playing # NOQA

View File

@ -27,7 +27,7 @@ def _get_battery(pl):
try:
up = bus.get_object(interface, '/org/freedesktop/UPower')
except dbus.exceptions.DBusException as e:
if getattr(e, '_dbus_error_name', '').endswidth('ServiceUnknown'):
if getattr(e, '_dbus_error_name', '').endswith('ServiceUnknown'):
pl.debug('Not using DBUS+UPower as UPower is not available via dbus')
else:
pl.exception('Failed to get UPower service with dbus: {0}', str(e))
@ -95,7 +95,7 @@ def _get_battery(pl):
else:
pl.debug('Not using pmset: executable not found')
if sys.platform.startswith('win'):
if sys.platform.startswith('win') or sys.platform == 'cygwin':
# From http://stackoverflow.com/a/21083571/273566, reworked
try:
from win32com.client import GetObject
@ -116,9 +116,15 @@ def _get_battery(pl):
return _get_capacity
pl.debug('Not using win32com.client as no batteries were found')
from ctypes import Structure, c_byte, c_ulong, windll, byref
from ctypes import Structure, c_byte, c_ulong, byref
if sys.platform == 'cygwin':
pl.debug('Using cdll to communicate with kernel32 (Cygwin)')
from ctypes import cdll
library_loader = cdll
else:
pl.debug('Using windll to communicate with kernel32 (Windows)')
from ctypes import windll
library_loader = windll
class PowerClass(Structure):
_fields_ = [
('ACLineStatus', c_byte),
@ -131,7 +137,7 @@ def _get_battery(pl):
def _get_capacity(pl):
powerclass = PowerClass()
result = windll.kernel32.GetSystemPowerStatus(byref(powerclass))
result = library_loader.kernel32.GetSystemPowerStatus(byref(powerclass))
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa372693(v=vs.85).aspx
if result:
return None
@ -200,21 +206,21 @@ def battery(pl, format='{capacity:3.0%}', steps=5, gamify=False, full_heart='O',
ret.append({
'contents': full_heart * numer,
'draw_inner_divider': False,
'highlight_group': ['battery_full', 'battery_gradient', 'battery'],
'highlight_groups': ['battery_full', 'battery_gradient', 'battery'],
# Using zero as “nothing to worry about”: it is least alert color.
'gradient_level': 0,
})
ret.append({
'contents': empty_heart * (denom - numer),
'draw_inner_divider': False,
'highlight_group': ['battery_empty', 'battery_gradient', 'battery'],
'highlight_groups': ['battery_empty', 'battery_gradient', 'battery'],
# Using a hundred as it is most alert color.
'gradient_level': 100,
})
else:
ret.append({
'contents': format.format(capacity=(capacity / 100.0)),
'highlight_group': ['battery_gradient', 'battery'],
'highlight_groups': ['battery_gradient', 'battery'],
# Gradients are “least alert most alert” by default, capacity has
# the opposite semantics.
'gradient_level': 100 - capacity,

View File

@ -84,7 +84,7 @@ class CwdSegment(Segment):
'divider_highlight_group': 'cwd:divider',
'draw_inner_divider': draw_inner_divider,
})
ret[-1]['highlight_group'] = ['cwd:current_folder', 'cwd']
ret[-1]['highlight_groups'] = ['cwd:current_folder', 'cwd']
if use_path_separator:
ret[-1]['contents'] = ret[-1]['contents'][:-1]
if len(ret) > 1 and ret[0]['contents'][0] == os.sep:
@ -134,8 +134,13 @@ except ImportError:
except ImportError:
from getpass import getuser as _get_user
else:
try:
from os import geteuid as getuid
except ImportError:
from os import getuid
def _get_user():
return pwd.getpwuid(os.geteuid()).pw_name
return pwd.getpwuid(getuid()).pw_name
username = False
@ -164,5 +169,5 @@ def user(pl, hide_user=None):
euid = _geteuid()
return [{
'contents': username,
'highlight_group': ['user'] if euid != 0 else ['superuser', 'user'],
'highlight_groups': ['user'] if euid != 0 else ['superuser', 'user'],
}]

Some files were not shown because too many files have changed in this diff Show More