Merge pull request #1246 from ZyX-I/consistency-changes

Create some incompatible consistency changes
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2015-01-06 16:43:23 +03:00
commit 4c717695f1
68 changed files with 709 additions and 678 deletions

View File

@ -53,7 +53,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-option=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.
@ -61,7 +61,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).
``-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
@ -73,7 +73,7 @@ Zsh/zpython overrides
Here overrides are controlled by similarly to the powerline script, but values
are taken from zsh variables.
``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":
@ -83,9 +83,10 @@ are taken from zsh variables.
``POWERLINE_THEME_CONFIG``
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
@ -121,9 +122,9 @@ 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
powerline into different directory.
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::

View File

@ -250,7 +250,7 @@ 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
@ -412,8 +412,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
@ -445,9 +445,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

@ -139,7 +139,7 @@ value:
[{
'contents': original_return,
'highlight_group': [segment_name],
'highlight_groups': [segment_name],
}]
.. _dev-segments-return:
@ -163,11 +163,11 @@ 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.
@ -206,8 +206,8 @@ Detailed description of used dictionary keys:
``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 +243,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``

View File

@ -43,10 +43,10 @@ _powerline_local_prompt() {
# Arguments: side, renderer_module arg, last_exit_code, jobnum, local theme
$POWERLINE_COMMAND 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() {
@ -54,9 +54,9 @@ _powerline_prompt() {
$POWERLINE_COMMAND 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

@ -12,7 +12,7 @@ from powerline.tmux import TmuxPowerline
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
CONFIG_FILE_NAME = re.compile(r'powerline_tmux_(?P<major>\d+)\.(?P<minor>\d+)(?P<suffix>[a-z]+)?(?:_(?P<mod>plus|minus))?\.conf')
@ -116,26 +116,26 @@ 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':
if attr == 'attrs':
attrs = attr_to_tmux_attr(get_highlighting(group)[attr])
set_tmux_environment(varname, ']#['.join(attrs))
set_tmux_environment(varname + '_LEGACY', ','.join(attrs))

View File

@ -21,17 +21,17 @@ 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)
set -g POWERLINE_COMMAND (env $POWERLINE_CONFIG_COMMAND shell command)
end
function --on-variable fish_bind_mode _powerline_bind_mode
set -g -x _POWERLINE_MODE $fish_bind_mode
@ -44,12 +44,12 @@ function powerline-setup
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 promptside
set -l rpromptpast
@ -81,7 +81,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

@ -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
}
@ -138,10 +138,10 @@ _powerline_local_prompt() {
_powerline_set_jobs
$POWERLINE_COMMAND 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() {
@ -150,8 +150,8 @@ _powerline_prompt() {
$POWERLINE_COMMAND 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,42 @@
# 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_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 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 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_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

@ -37,7 +37,7 @@ class Args(object):
@property
def config(self):
return get_var_config('POWERLINE_CONFIG')
return get_var_config('POWERLINE_CONFIG_OVERRIDES')
@property
def theme_option(self):

View File

@ -136,18 +136,18 @@ _powerline_setup_prompt() {
}
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"'
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
@ -183,21 +183,21 @@ _powerline_add_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
export POWERLINE_CONFIG_COMMAND=powerline-config
else
export POWERLINE_CONFIG="$_POWERLINE_SOURCED:h:h:h:h/scripts/powerline-config"
export 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

@ -43,7 +43,7 @@ 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(

View File

@ -36,17 +36,17 @@ def get_argparser(ArgumentParser=argparse.ArgumentParser):
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,
'-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.'
)
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('--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('-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

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

@ -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

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

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

@ -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

@ -19,7 +19,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
@ -142,7 +143,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(),
@ -194,7 +195,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
@ -218,7 +218,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"')

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

@ -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

@ -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

@ -85,7 +85,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
@ -111,17 +111,17 @@ class ShellRenderer(Renderer):
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 = []

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

@ -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')
)
@ -223,7 +223,7 @@ always_true = lambda pl, segment_info, mode: True
get_fallback_segment = {
'name': 'fallback',
'type': 'string',
'highlight_group': 'background',
'highlight_groups': ['background'],
'divider_highlight_group': None,
'before': None,
'after': None,
@ -335,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((
@ -360,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,
@ -415,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

@ -200,21 +200,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:
@ -169,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'],
}]

View File

@ -42,12 +42,12 @@ class EmailIMAPSegment(KwThreadedSegment):
elif type(unread_count) != int or not max_msgs:
return [{
'contents': str(unread_count),
'highlight_group': ['email_alert'],
'highlight_groups': ['email_alert'],
}]
else:
return [{
'contents': str(unread_count),
'highlight_group': ['email_alert_gradient', 'email_alert'],
'highlight_groups': ['email_alert_gradient', 'email_alert'],
'gradient_level': min(unread_count * 100.0 / max_msgs, 100),
}]

View File

@ -68,7 +68,7 @@ Divider highlight group used: ``background:divider``.
try:
import netifaces
except ImportError:
def internal_ip(pl, interface='detect', ipv=4):
def internal_ip(pl, interface='auto', ipv=4):
return None
else:
_interface_starts = {
@ -100,8 +100,8 @@ else:
else:
return 0
def internal_ip(pl, interface='detect', ipv=4):
if interface == 'detect':
def internal_ip(pl, interface='auto', ipv=4):
if interface == 'auto':
try:
interface = next(iter(sorted(netifaces.interfaces(), key=_interface_key, reverse=True)))
except StopIteration:
@ -120,7 +120,7 @@ internal_ip = with_docstring(internal_ip,
Requires ``netifaces`` module to work properly.
:param str interface:
Interface on which IP will be checked. Use ``detect`` to automatically
Interface on which IP will be checked. Use ``auto`` to automatically
detect interface. In this case interfaces with lower numbers will be
preferred over interfaces with similar names. Order of preference based on
names:
@ -174,11 +174,11 @@ class NetworkLoadSegment(KwThreadedSegment):
replace_num_pat = re.compile(r'[a-zA-Z]+')
@staticmethod
def key(interface='detect', **kwargs):
def key(interface='auto', **kwargs):
return interface
def compute_state(self, interface):
if interface == 'detect':
if interface == 'auto':
proc_exists = getattr(self, 'proc_exists', None)
if proc_exists is None:
proc_exists = self.proc_exists = os.path.exists('/proc/net/route')
@ -192,7 +192,7 @@ class NetworkLoadSegment(KwThreadedSegment):
if not destination.replace(b'0', b''):
interface = iface.decode('utf-8')
break
if interface == 'detect':
if interface == 'auto':
# Choose interface with most total activity, excluding some
# well known interface names
interface, total = 'eth0', -1
@ -248,7 +248,7 @@ class NetworkLoadSegment(KwThreadedSegment):
r.append({
'contents': format.format(value=humanize_bytes(value, suffix, si_prefix)),
'divider_highlight_group': 'background:divider',
'highlight_group': hl_groups,
'highlight_groups': hl_groups,
})
if is_gradient:
max = kwargs[max_key]
@ -268,21 +268,24 @@ falls back to reading
:file:`/sys/class/net/{interface}/statistics/{rx,tx}_bytes`.
:param str interface:
network interface to measure (use the special value "detect" to have powerline try to auto-detect the network interface)
Network interface to measure (use the special value "auto" to have powerline
try to auto-detect the network interface).
:param str suffix:
string appended to each load string
String appended to each load string.
:param bool si_prefix:
use SI prefix, e.g. MB instead of MiB
Use SI prefix, e.g. MB instead of MiB.
:param str recv_format:
format string, receives ``value`` as argument
Format string that determines how download speed should look like. Receives
``value`` as argument.
:param str sent_format:
format string, receives ``value`` as argument
Format string that determines how upload speed should look like. Receives
``value`` as argument.
:param float recv_max:
maximum number of received bytes per second. Is only used to compute
gradient level
Maximum number of received bytes per second. Is only used to compute
gradient level.
:param float sent_max:
maximum number of sent bytes per second. Is only used to compute gradient
level
Maximum number of sent bytes per second. Is only used to compute gradient
level.
Divider highlight group used: ``background:divider``.

View File

@ -50,7 +50,7 @@ class PlayerSegment(Segment):
stats['state_symbol'] = state_symbols.get(stats['state'])
return [{
'contents': format.format(**stats),
'highlight_group': ['now_playing', 'player_' + (stats['state'] or 'fallback'), 'player'],
'highlight_groups': ['now_playing', 'player_' + (stats['state'] or 'fallback'), 'player'],
}]
def get_player_status(self, pl):

View File

@ -57,7 +57,7 @@ def system_load(pl, format='{avg:.1f}', threshold_good=1, threshold_bad=2, track
gradient_level = 100
ret.append({
'contents': format.format(avg=avg),
'highlight_group': ['system_load_gradient', 'system_load'],
'highlight_groups': ['system_load_gradient', 'system_load'],
'divider_highlight_group': 'background:divider',
'gradient_level': gradient_level,
})
@ -88,7 +88,7 @@ try:
return [{
'contents': format.format(cpu_percent),
'gradient_level': cpu_percent,
'highlight_group': ['cpu_load_percent_gradient', 'cpu_load_percent'],
'highlight_groups': ['cpu_load_percent_gradient', 'cpu_load_percent'],
}]
except ImportError:
class CPULoadPercentSegment(ThreadedSegment):

View File

@ -18,7 +18,7 @@ def date(pl, format='%Y-%m-%d', istime=False):
'''
return [{
'contents': datetime.now().strftime(format),
'highlight_group': (['time'] if istime else []) + ['date'],
'highlight_groups': (['time'] if istime else []) + ['date'],
'divider_highlight_group': 'time:divider' if istime else None,
}]

View File

@ -35,7 +35,7 @@ class BranchSegment(Segment):
scol.insert(0, 'branch_dirty' if status else 'branch_clean')
return [{
'contents': branch,
'highlight_group': scol,
'highlight_groups': scol,
'divider_highlight_group': self.divider_highlight_group,
}]

View File

@ -188,12 +188,12 @@ class WeatherSegment(KwThreadedSegment):
return [
{
'contents': icon + ' ',
'highlight_group': groups,
'highlight_groups': groups,
'divider_highlight_group': 'background:divider',
},
{
'contents': temp_format.format(temp=converted_temp),
'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'],
'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'],
'divider_highlight_group': 'background:divider',
'gradient_level': gradient_level,
},

View File

@ -23,5 +23,5 @@ def workspaces(pl):
'''
return [{
'contents': w['name'],
'highlight_group': calcgrp(w)
'highlight_groups': calcgrp(w)
} for w in i3.get_workspaces()]

View File

@ -30,7 +30,7 @@ def last_status(pl, segment_info):
'''
if not segment_info['args'].last_exit_code:
return None
return [{'contents': str(segment_info['args'].last_exit_code), 'highlight_group': ['exit_fail']}]
return [{'contents': str(segment_info['args'].last_exit_code), 'highlight_groups': ['exit_fail']}]
@requires_segment_info
@ -44,7 +44,7 @@ def last_pipe_status(pl, segment_info):
return [
{
'contents': str(status),
'highlight_group': ['exit_fail' if status else 'exit_success'],
'highlight_groups': ['exit_fail' if status else 'exit_success'],
'draw_inner_divider': True
}
for status in last_pipe_status
@ -102,7 +102,7 @@ def continuation(pl, segment_info, omit_cmdsubst=True, right_align=False, rename
return [{
'contents': '',
'width': 'auto',
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
}]
ret = []
@ -111,7 +111,7 @@ def continuation(pl, segment_info, omit_cmdsubst=True, right_align=False, rename
if state:
ret.append({
'contents': state,
'highlight_group': ['continuation'],
'highlight_groups': ['continuation'],
'draw_inner_divider': True,
})
@ -125,9 +125,9 @@ def continuation(pl, segment_info, omit_cmdsubst=True, right_align=False, rename
if right_align:
ret[0].update(width='auto', align='r')
ret[-1]['highlight_group'] = ['continuation:current', 'continuation']
ret[-1]['highlight_groups'] = ['continuation:current', 'continuation']
else:
ret[-1].update(width='auto', align='l', highlight_group=['continuation:current', 'continuation'])
ret[-1].update(width='auto', align='l', highlight_groups=['continuation:current', 'continuation'])
return ret
@ -157,7 +157,7 @@ Returns a segment list to create a breadcrumb-like effect.
:param bool use_path_separator:
Use path separator in place of soft divider.
:param bool use_shortened_path:
Use path from shortened_path ``--renderer_arg`` argument. If this argument
Use path from shortened_path ``--renderer-arg`` argument. If this argument
is present ``shorten_home`` argument is ignored.
:param bool shorten_home:
Shorten home directory to ``~``.

View File

@ -177,7 +177,7 @@ def tab_modified_indicator(pl, segment_info, text='+'):
if int(vim_getbufoption(buf_segment_info, 'modified')):
return [{
'contents': text,
'highlight_group': ['tab_modified_indicator', 'modified_indicator'],
'highlight_groups': ['tab_modified_indicator', 'modified_indicator'],
}]
return None
@ -289,7 +289,7 @@ def file_name(pl, segment_info, display_no_file=False, no_file_text='[No file]')
if display_no_file:
return [{
'contents': no_file_text,
'highlight_group': ['file_name_no_file', 'file_name'],
'highlight_groups': ['file_name_no_file', 'file_name'],
}]
else:
return None
@ -380,7 +380,7 @@ def line_percent(pl, segment_info, gradient=False):
return str(int(round(percentage)))
return [{
'contents': str(int(round(percentage))),
'highlight_group': ['line_percent_gradient', 'line_percent'],
'highlight_groups': ['line_percent_gradient', 'line_percent'],
'gradient_level': percentage,
}]
@ -418,7 +418,7 @@ def position(pl, position_strings={'top': 'Top', 'bottom': 'Bot', 'all': 'All'},
return content
return [{
'contents': content,
'highlight_group': ['position_gradient', 'position'],
'highlight_groups': ['position_gradient', 'position'],
'gradient_level': percentage,
}]
@ -452,11 +452,11 @@ def virtcol_current(pl, gradient=True):
Highlight groups used: ``virtcol_current_gradient`` (gradient), ``virtcol_current`` or ``col_current``.
'''
col = vim_funcs['virtcol']('.')
r = [{'contents': str(col), 'highlight_group': ['virtcol_current', 'col_current']}]
r = [{'contents': str(col), 'highlight_groups': ['virtcol_current', 'col_current']}]
if gradient:
textwidth = int(getbufvar('%', '&textwidth'))
r[-1]['gradient_level'] = min(col * 100 / textwidth, 100) if textwidth else 0
r[-1]['highlight_group'].insert(0, 'virtcol_current_gradient')
r[-1]['highlight_groups'].insert(0, 'virtcol_current_gradient')
return r
@ -530,7 +530,7 @@ def file_vcs_status(pl, segment_info, create_watcher):
for status in status:
ret.append({
'contents': status,
'highlight_group': ['file_vcs_status_' + status, 'file_vcs_status'],
'highlight_groups': ['file_vcs_status_' + status, 'file_vcs_status'],
})
return ret
@ -579,7 +579,7 @@ def trailing_whitespace(pl, segment_info):
if has_trailing_ws:
ret = [{
'contents': str(i + 1),
'highlight_group': ['trailing_whitespace', 'warning'],
'highlight_groups': ['trailing_whitespace', 'warning'],
}]
else:
ret = None
@ -735,8 +735,8 @@ def csv_col_current(pl, segment_info, display_name='auto', name_format=' ({colum
return None
return [{
'contents': column_number,
'highlight_group': ['csv:column_number', 'csv'],
'highlight_groups': ['csv:column_number', 'csv'],
}] + ([{
'contents': name_format.format(column_name=column_name),
'highlight_group': ['csv:column_name', 'csv'],
'highlight_groups': ['csv:column_name', 'csv'],
}] if column_name else [])

View File

@ -54,7 +54,7 @@ def finder(pl):
initialize()
vim.command('ruby $powerline.commandt_set_active_finder')
return [{
'highlight_group': ['commandt:finder'],
'highlight_groups': ['commandt:finder'],
'contents': vim.eval('g:powerline_commandt_reply').replace('CommandT::', '').replace('Finder::', '')
}]
@ -88,6 +88,6 @@ def path(pl):
return None
vim.command('ruby $powerline.commandt_set_path')
return [{
'highlight_group': ['commandt:path'],
'highlight_groups': ['commandt:path'],
'contents': vim.eval('g:powerline_commandt_reply')
}]

View File

@ -14,12 +14,12 @@ from powerline.segments.vim import window_cached
def nerdtree(pl):
'''Return directory that is shown by the current buffer.
Highlight groups used: ``nerdtree.path`` or ``file_name``.
Highlight groups used: ``nerdtree:path`` or ``file_name``.
'''
if not bufvar_exists(None, 'NERDTreeRoot'):
return None
path_str = vim.eval('getbufvar("%", "NERDTreeRoot").path.str()')
return [{
'contents': path_str,
'highlight_group': ['nerdtree.path', 'file_name'],
'highlight_groups': ['nerdtree:path', 'file_name'],
}]

View File

@ -20,7 +20,7 @@ def syntastic(pl, err_format='ERR:  {first_line} ({num}) ', warn_format='WARN
:param str warn_format:
Format string for warnings.
Highlight groups used: ``syntastic.warning`` or ``warning``, ``syntastic.error`` or ``error``.
Highlight groups used: ``syntastic:warning`` or ``warning``, ``syntastic:error`` or ``error``.
'''
if not vim_global_exists('SyntasticLoclist'):
return None
@ -33,11 +33,11 @@ def syntastic(pl, err_format='ERR:  {first_line} ({num}) ', warn_format='WARN
if errors:
segments.append({
'contents': err_format.format(first_line=errors[0]['lnum'], num=len(errors)),
'highlight_group': ['syntastic.error', 'error'],
'highlight_groups': ['syntastic:error', 'error'],
})
if warnings:
segments.append({
'contents': warn_format.format(first_line=warnings[0]['lnum'], num=len(warnings)),
'highlight_group': ['syntastic.warning', 'warning'],
'highlight_groups': ['syntastic:warning', 'warning'],
})
return segments

View File

@ -72,7 +72,7 @@ class Theme(object):
self.segments = []
self.EMPTY_SEGMENT = {
'contents': None,
'highlight': {'fg': False, 'bg': False, 'attr': 0}
'highlight': {'fg': False, 'bg': False, 'attrs': 0}
}
self.pl = pl
theme_configs = [theme_config]

View File

@ -114,16 +114,16 @@ class Logger(object):
class SimpleRenderer(Renderer):
def hlstyle(self, fg=None, bg=None, attr=None):
return '<{fg} {bg} {attr}>'.format(fg=fg and fg[0], bg=bg and bg[0], attr=attr)
def hlstyle(self, fg=None, bg=None, attrs=None):
return '<{fg} {bg} {attrs}>'.format(fg=fg and fg[0], bg=bg and bg[0], attrs=attrs)
class EvenSimplerRenderer(Renderer):
def hlstyle(self, fg=None, bg=None, attr=None):
return '{{{fg}{bg}{attr}}}'.format(
def hlstyle(self, fg=None, bg=None, attrs=None):
return '{{{fg}{bg}{attrs}}}'.format(
fg=fg and fg[0] or '-',
bg=bg and bg[0] or '-',
attr=attr if attr else '',
attrs=attrs if attrs else '',
)

View File

@ -37,18 +37,18 @@ class TestParser(TestCase):
(['shell', '-t'], 'expected one argument'),
(['shell', '-p'], 'expected one argument'),
(['shell', '-R'], 'expected one argument'),
(['shell', '--renderer_module'], 'expected one argument'),
(['shell', '--renderer-module'], 'expected one argument'),
(['shell', '--width'], 'expected one argument'),
(['shell', '--last_exit_code'], 'expected one argument'),
(['shell', '--last_pipe_status'], 'expected one argument'),
(['shell', '--last-exit-code'], 'expected one argument'),
(['shell', '--last-pipe-status'], 'expected one argument'),
(['shell', '--config'], 'expected one argument'),
(['shell', '--theme_option'], 'expected one argument'),
(['shell', '--config_path'], 'expected one argument'),
(['shell', '--renderer_arg'], 'expected one argument'),
(['shell', '--theme-option'], 'expected one argument'),
(['shell', '--config-path'], 'expected one argument'),
(['shell', '--renderer-arg'], 'expected one argument'),
(['shell', '--jobnum'], 'expected one argument'),
(['-r', '.zsh'], 'too few arguments|the following arguments are required: ext'),
(['shell', '--last_exit_code', 'i'], 'invalid int value'),
(['shell', '--last_pipe_status', '1 i'], 'invalid <lambda> value'),
(['shell', '--last-exit-code', 'i'], 'invalid int value'),
(['shell', '--last-pipe-status', '1 i'], 'invalid <lambda> value'),
]:
self.assertRaises(SystemExit, parser.parse_args, raising_args)
self.assertFalse(out.getvalue())
@ -67,8 +67,8 @@ class TestParser(TestCase):
'shell',
'left',
'-r', '.zsh',
'--last_exit_code', '10',
'--last_pipe_status', '10 20 30',
'--last-exit-code', '10',
'--last-pipe-status', '10 20 30',
'--jobnum=10',
'-w', '100',
'-c', 'common.term_truecolor=true',

View File

@ -44,7 +44,7 @@ colors_config = lambda: {
colorscheme_config = lambda: {
'groups': {
'g': {'fg': 'c1', 'bg': 'c2', 'attr': []},
'g': {'fg': 'c1', 'bg': 'c2', 'attrs': []},
}
}
@ -61,7 +61,7 @@ theme_config = lambda: {
'type': 'string',
'name': 's',
'contents': 't',
'highlight_group': ['g'],
'highlight_groups': ['g'],
},
],
'right': [],
@ -246,7 +246,7 @@ class TestMerging(TestCase):
with WithConfigTree(mdc(main_tree(), {
'2/colorschemes/default': {
'groups': {
'g': {'fg': 'c2', 'bg': 'c1', 'attr': []},
'g': {'fg': 'c2', 'bg': 'c1', 'attrs': []},
}
},
})) as p:

View File

@ -34,14 +34,14 @@ config = {
},
'colorschemes/test/default': {
'groups': {
"str1": {"fg": "col1", "bg": "col2", "attr": ["bold"]},
"str2": {"fg": "col3", "bg": "col4", "attr": ["underline"]},
'str1': {'fg': 'col1', 'bg': 'col2', 'attrs': ['bold']},
'str2': {'fg': 'col3', 'bg': 'col4', 'attrs': ['underline']},
},
},
'colorschemes/test/2': {
'groups': {
"str1": {"fg": "col2", "bg": "col3", "attr": ["bold"]},
"str2": {"fg": "col1", "bg": "col4", "attr": ["underline"]},
'str1': {'fg': 'col2', 'bg': 'col3', 'attrs': ['bold']},
'str2': {'fg': 'col1', 'bg': 'col4', 'attrs': ['underline']},
},
},
'themes/test/default': {
@ -50,12 +50,12 @@ config = {
{
"type": "string",
"contents": "s",
"highlight_group": ["str1"],
"highlight_groups": ["str1"],
},
{
"type": "string",
"contents": "g",
"highlight_group": ["str2"],
"highlight_groups": ["str2"],
},
],
"right": [
@ -94,12 +94,12 @@ config = {
{
"type": "string",
"contents": "t",
"highlight_group": ["str1"],
"highlight_groups": ["str1"],
},
{
"type": "string",
"contents": "b",
"highlight_group": ["str2"],
"highlight_groups": ["str2"],
},
],
"right": [
@ -227,8 +227,8 @@ class TestConfigReload(TestCase):
config['colorschemes/nonexistentraise'] = {}
config['colorschemes/test/nonexistentraise'] = {
'groups': {
"str1": {"fg": "col1", "bg": "col3", "attr": ["bold"]},
"str2": {"fg": "col2", "bg": "col4", "attr": ["underline"]},
'str1': {'fg': 'col1', 'bg': 'col3', 'attrs': ['bold']},
'str2': {'fg': 'col2', 'bg': 'col4', 'attrs': ['underline']},
},
}
while not p._will_create_renderer():

View File

@ -18,7 +18,7 @@ def highlighted_string(s, group, **kwargs):
ret = {
'type': 'string',
'contents': s,
'highlight_group': [group],
'highlight_groups': [group],
}
ret.update(kwargs)
return ret
@ -67,20 +67,20 @@ config = {
'groups': {
'm1': 'g1',
'm2': 'g3',
'm3': {'fg': 'col11', 'bg': 'col12', 'attr': []},
'm3': {'fg': 'col11', 'bg': 'col12', 'attrs': []},
}
},
'colorschemes/default': {
'groups': {
'g1': {'fg': 'col5', 'bg': 'col6', 'attr': []},
'g2': {'fg': 'col7', 'bg': 'col8', 'attr': []},
'g3': {'fg': 'col9', 'bg': 'col10', 'attr': []},
'g1': {'fg': 'col5', 'bg': 'col6', 'attrs': []},
'g2': {'fg': 'col7', 'bg': 'col8', 'attrs': []},
'g3': {'fg': 'col9', 'bg': 'col10', 'attrs': []},
}
},
'colorschemes/test/default': {
'groups': {
'str1': {'fg': 'col1', 'bg': 'col2', 'attr': ['bold']},
'str2': {'fg': 'col3', 'bg': 'col4', 'attr': ['underline']},
'str1': {'fg': 'col1', 'bg': 'col2', 'attrs': ['bold']},
'str2': {'fg': 'col3', 'bg': 'col4', 'attrs': ['underline']},
'd1': 'g2',
'd2': 'm2',
'd3': 'm3',
@ -88,7 +88,7 @@ config = {
},
'colorschemes/vim/default': {
'groups': {
'environment': {'fg': 'col3', 'bg': 'col4', 'attr': ['underline']},
'environment': {'fg': 'col3', 'bg': 'col4', 'attrs': ['underline']},
},
},
'themes/test/default': {
@ -782,7 +782,7 @@ class TestVim(TestCase):
{
'type': 'string',
'name': 'foo',
'highlight_group': ['g1']
'highlight_groups': ['g1']
}
]
}

View File

@ -32,7 +32,7 @@ class TestShell(TestCase):
pl = Pl()
segment_info = {'args': Args(last_exit_code=10)}
self.assertEqual(shell.last_status(pl=pl, segment_info=segment_info), [
{'contents': '10', 'highlight_group': ['exit_fail']}
{'contents': '10', 'highlight_groups': ['exit_fail']}
])
segment_info['args'].last_exit_code = 0
self.assertEqual(shell.last_status(pl=pl, segment_info=segment_info), None)
@ -47,9 +47,9 @@ class TestShell(TestCase):
self.assertEqual(shell.last_pipe_status(pl=pl, segment_info=segment_info), None)
segment_info['args'].last_pipe_status = [0, 2, 0]
self.assertEqual(shell.last_pipe_status(pl=pl, segment_info=segment_info), [
{'contents': '0', 'highlight_group': ['exit_success'], 'draw_inner_divider': True},
{'contents': '2', 'highlight_group': ['exit_fail'], 'draw_inner_divider': True},
{'contents': '0', 'highlight_group': ['exit_success'], 'draw_inner_divider': True}
{'contents': '0', 'highlight_groups': ['exit_success'], 'draw_inner_divider': True},
{'contents': '2', 'highlight_groups': ['exit_fail'], 'draw_inner_divider': True},
{'contents': '0', 'highlight_groups': ['exit_success'], 'draw_inner_divider': True}
])
def test_jobnum(self):
@ -68,14 +68,14 @@ class TestShell(TestCase):
self.assertEqual(shell.continuation(pl=pl, segment_info={}), [{
'contents': '',
'width': 'auto',
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
}])
segment_info = {'parser_state': 'if cmdsubst'}
self.assertEqual(shell.continuation(pl=pl, segment_info=segment_info), [
{
'contents': 'if',
'draw_inner_divider': True,
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
'width': 'auto',
'align': 'l',
},
@ -84,7 +84,7 @@ class TestShell(TestCase):
{
'contents': 'if',
'draw_inner_divider': True,
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
'width': 'auto',
'align': 'r',
},
@ -93,12 +93,12 @@ class TestShell(TestCase):
{
'contents': 'if',
'draw_inner_divider': True,
'highlight_group': ['continuation'],
'highlight_groups': ['continuation'],
},
{
'contents': 'cmdsubst',
'draw_inner_divider': True,
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
'width': 'auto',
'align': 'l',
},
@ -107,21 +107,21 @@ class TestShell(TestCase):
{
'contents': 'if',
'draw_inner_divider': True,
'highlight_group': ['continuation'],
'highlight_groups': ['continuation'],
'width': 'auto',
'align': 'r',
},
{
'contents': 'cmdsubst',
'draw_inner_divider': True,
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
},
])
self.assertEqual(shell.continuation(pl=pl, segment_info=segment_info, omit_cmdsubst=True, right_align=True), [
{
'contents': 'if',
'draw_inner_divider': True,
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
'width': 'auto',
'align': 'r',
},
@ -130,7 +130,7 @@ class TestShell(TestCase):
{
'contents': 'IF',
'draw_inner_divider': True,
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
'width': 'auto',
'align': 'r',
},
@ -138,7 +138,7 @@ class TestShell(TestCase):
self.assertEqual(shell.continuation(pl=pl, segment_info=segment_info, omit_cmdsubst=True, right_align=True, renames={'if': None}), [
{
'contents': '',
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
'width': 'auto',
'align': 'r',
},
@ -148,17 +148,17 @@ class TestShell(TestCase):
{
'contents': 'then',
'draw_inner_divider': True,
'highlight_group': ['continuation'],
'highlight_groups': ['continuation'],
},
{
'contents': 'then',
'draw_inner_divider': True,
'highlight_group': ['continuation'],
'highlight_groups': ['continuation'],
},
{
'contents': 'then',
'draw_inner_divider': True,
'highlight_group': ['continuation:current', 'continuation'],
'highlight_groups': ['continuation:current', 'continuation'],
'width': 'auto',
'align': 'l',
},
@ -185,89 +185,89 @@ class TestShell(TestCase):
{'contents': 'def', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'ghi', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
segment_info['home'] = '/abc/def/ghi'
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info), [
{'contents': '~', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
segment_info.update(shortened_path='~foo/ghi')
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info), [
{'contents': '~foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'ghi', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'ghi', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, use_shortened_path=False), [
{'contents': '~', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
segment_info.pop('shortened_path')
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=3), [
{'contents': '~', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=3, shorten_home=False), [
{'contents': '...', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'ghi', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1), [
{'contents': '...', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, ellipsis='---'), [
{'contents': '---', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, ellipsis=None), [
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, use_path_separator=True), [
{'contents': '.../', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, use_path_separator=True, ellipsis='---'), [
{'contents': '---/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, use_path_separator=True, ellipsis=None), [
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=2, dir_shorten_len=2), [
{'contents': '~', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'fo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=2, dir_shorten_len=2, use_path_separator=True), [
{'contents': '~/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'fo/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
cwd[0] = '/etc'
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, use_path_separator=False), [
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'etc', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'etc', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, use_path_separator=True), [
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'etc', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'etc', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
cwd[0] = '/'
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, use_path_separator=False), [
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, use_path_separator=True), [
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
ose = OSError()
ose.errno = 2
cwd[0] = ose
self.assertEqual(shell.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=2, dir_shorten_len=2), [
{'contents': '[not found]', 'divider_highlight_group': 'cwd:divider', 'highlight_group': ['cwd:current_folder', 'cwd'], 'draw_inner_divider': True}
{'contents': '[not found]', 'divider_highlight_group': 'cwd:divider', 'highlight_groups': ['cwd:current_folder', 'cwd'], 'draw_inner_divider': True}
])
cwd[0] = OSError()
self.assertRaises(OSError, shell.cwd, pl=pl, segment_info=segment_info, dir_limit_depth=2, dir_shorten_len=2)
@ -352,15 +352,15 @@ class TestNet(TestCommon):
AF_INET6=netifaces.AF_INET6,
):
self.assertEqual(common.internal_ip(pl=pl), '192.168.100.200')
self.assertEqual(common.internal_ip(pl=pl, interface='detect'), '192.168.100.200')
self.assertEqual(common.internal_ip(pl=pl, interface='auto'), '192.168.100.200')
self.assertEqual(common.internal_ip(pl=pl, interface='lo'), '127.0.0.1')
self.assertEqual(common.internal_ip(pl=pl, interface='teredo'), None)
self.assertEqual(common.internal_ip(pl=pl, ipv=4), '192.168.100.200')
self.assertEqual(common.internal_ip(pl=pl, interface='detect', ipv=4), '192.168.100.200')
self.assertEqual(common.internal_ip(pl=pl, interface='auto', ipv=4), '192.168.100.200')
self.assertEqual(common.internal_ip(pl=pl, interface='lo', ipv=4), '127.0.0.1')
self.assertEqual(common.internal_ip(pl=pl, interface='teredo', ipv=4), None)
self.assertEqual(common.internal_ip(pl=pl, ipv=6), 'feff::5446:5eff:fe5a:7777%enp2s0')
self.assertEqual(common.internal_ip(pl=pl, interface='detect', ipv=6), 'feff::5446:5eff:fe5a:7777%enp2s0')
self.assertEqual(common.internal_ip(pl=pl, interface='auto', ipv=6), 'feff::5446:5eff:fe5a:7777%enp2s0')
self.assertEqual(common.internal_ip(pl=pl, interface='lo', ipv=6), '::1')
self.assertEqual(common.internal_ip(pl=pl, interface='teredo', ipv=6), 'feff::5446:5eff:fe5a:7777')
interfaces[1:2] = ()
@ -404,24 +404,24 @@ class TestNet(TestCommon):
while not common.network_load.interfaces.get('eth0', {}).get('prev', (None, None))[1]:
sleep(0.1)
self.assertEqual(common.network_load(pl=pl, interface='eth0'), [
{'divider_highlight_group': 'background:divider', 'contents': 'DL 1 KiB/s', 'highlight_group': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 'UL 2 KiB/s', 'highlight_group': ['network_load_sent', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 'DL 1 KiB/s', 'highlight_groups': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 'UL 2 KiB/s', 'highlight_groups': ['network_load_sent', 'network_load']},
])
self.assertEqual(common.network_load(pl=pl, interface='eth0', recv_format='r {value}', sent_format='s {value}'), [
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 KiB/s', 'highlight_group': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 KiB/s', 'highlight_group': ['network_load_sent', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 KiB/s', 'highlight_groups': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 KiB/s', 'highlight_groups': ['network_load_sent', 'network_load']},
])
self.assertEqual(common.network_load(pl=pl, recv_format='r {value}', sent_format='s {value}', suffix='bps', interface='eth0'), [
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 Kibps', 'highlight_group': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 Kibps', 'highlight_group': ['network_load_sent', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 Kibps', 'highlight_groups': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 Kibps', 'highlight_groups': ['network_load_sent', 'network_load']},
])
self.assertEqual(common.network_load(pl=pl, recv_format='r {value}', sent_format='s {value}', si_prefix=True, interface='eth0'), [
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 kB/s', 'highlight_group': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 kB/s', 'highlight_group': ['network_load_sent', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 kB/s', 'highlight_groups': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 kB/s', 'highlight_groups': ['network_load_sent', 'network_load']},
])
self.assertEqual(common.network_load(pl=pl, recv_format='r {value}', sent_format='s {value}', recv_max=0, interface='eth0'), [
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 KiB/s', 'highlight_group': ['network_load_recv_gradient', 'network_load_gradient', 'network_load_recv', 'network_load'], 'gradient_level': 100},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 KiB/s', 'highlight_group': ['network_load_sent', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 KiB/s', 'highlight_groups': ['network_load_recv_gradient', 'network_load_gradient', 'network_load_recv', 'network_load'], 'gradient_level': 100},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 KiB/s', 'highlight_groups': ['network_load_sent', 'network_load']},
])
class ApproxEqual(object):
@ -429,8 +429,8 @@ class TestNet(TestCommon):
return abs(i - 50.0) < 1
self.assertEqual(common.network_load(pl=pl, recv_format='r {value}', sent_format='s {value}', sent_max=4800, interface='eth0'), [
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 KiB/s', 'highlight_group': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 KiB/s', 'highlight_group': ['network_load_sent_gradient', 'network_load_gradient', 'network_load_sent', 'network_load'], 'gradient_level': ApproxEqual()},
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 KiB/s', 'highlight_groups': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 KiB/s', 'highlight_groups': ['network_load_sent_gradient', 'network_load_gradient', 'network_load_sent', 'network_load'], 'gradient_level': ApproxEqual()},
])
finally:
common.network_load.shutdown()
@ -463,15 +463,15 @@ class TestEnv(TestCommon):
with replace_attr(self.module, 'psutil', new_psutil):
with replace_attr(self.module, '_geteuid', lambda: 5):
self.assertEqual(common.user(pl=pl), [
{'contents': 'def', 'highlight_group': ['user']}
{'contents': 'def', 'highlight_groups': ['user']}
])
self.assertEqual(common.user(pl=pl, hide_user='abc'), [
{'contents': 'def', 'highlight_group': ['user']}
{'contents': 'def', 'highlight_groups': ['user']}
])
self.assertEqual(common.user(pl=pl, hide_user='def'), None)
with replace_attr(self.module, '_geteuid', lambda: 0):
self.assertEqual(common.user(pl=pl), [
{'contents': 'def', 'highlight_group': ['superuser', 'user']}
{'contents': 'def', 'highlight_groups': ['superuser', 'user']}
])
def test_cwd(self):
@ -495,78 +495,78 @@ class TestEnv(TestCommon):
{'contents': 'def', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'ghi', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
segment_info['home'] = '/abc/def/ghi'
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info), [
{'contents': '~', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=3), [
{'contents': '~', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=3, shorten_home=False), [
{'contents': '...', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'ghi', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'foo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1), [
{'contents': '...', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, ellipsis='---'), [
{'contents': '---', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, ellipsis=None), [
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, use_path_separator=True), [
{'contents': '.../', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, use_path_separator=True, ellipsis='---'), [
{'contents': '---/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=1, use_path_separator=True, ellipsis=None), [
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=2, dir_shorten_len=2), [
{'contents': '~', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'fo', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=2, dir_shorten_len=2, use_path_separator=True), [
{'contents': '~/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'fo/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']}
{'contents': 'bar', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']}
])
cwd[0] = '/etc'
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, use_path_separator=False), [
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True},
{'contents': 'etc', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'etc', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, use_path_separator=True), [
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False},
{'contents': 'etc', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': 'etc', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
cwd[0] = '/'
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, use_path_separator=False), [
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': True, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, use_path_separator=True), [
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_group': ['cwd:current_folder', 'cwd']},
{'contents': '/', 'divider_highlight_group': 'cwd:divider', 'draw_inner_divider': False, 'highlight_groups': ['cwd:current_folder', 'cwd']},
])
ose = OSError()
ose.errno = 2
cwd[0] = ose
self.assertEqual(common.cwd(pl=pl, segment_info=segment_info, dir_limit_depth=2, dir_shorten_len=2), [
{'contents': '[not found]', 'divider_highlight_group': 'cwd:divider', 'highlight_group': ['cwd:current_folder', 'cwd'], 'draw_inner_divider': True}
{'contents': '[not found]', 'divider_highlight_group': 'cwd:divider', 'highlight_groups': ['cwd:current_folder', 'cwd'], 'draw_inner_divider': True}
])
cwd[0] = OSError()
self.assertRaises(OSError, common.cwd, pl=pl, segment_info=segment_info, dir_limit_depth=2, dir_shorten_len=2)
@ -601,29 +601,29 @@ class TestVcs(TestCommon):
with replace_attr(self.module, 'guess', get_dummy_guess(status=lambda: None, directory='/tmp/tests')):
with replace_attr(self.module, 'tree_status', lambda repo, pl: None):
self.assertEqual(branch(segment_info=segment_info, status_colors=False), [{
'highlight_group': ['branch'],
'highlight_groups': ['branch'],
'contents': 'tests',
'divider_highlight_group': None
}])
self.assertEqual(branch(segment_info=segment_info, status_colors=True), [{
'contents': 'tests',
'highlight_group': ['branch_clean', 'branch'],
'highlight_groups': ['branch_clean', 'branch'],
'divider_highlight_group': None
}])
with replace_attr(self.module, 'guess', get_dummy_guess(status=lambda: 'D ', directory='/tmp/tests')):
with replace_attr(self.module, 'tree_status', lambda repo, pl: 'D '):
self.assertEqual(branch(segment_info=segment_info, status_colors=False), [{
'highlight_group': ['branch'],
'highlight_groups': ['branch'],
'contents': 'tests',
'divider_highlight_group': None
}])
self.assertEqual(branch(segment_info=segment_info, status_colors=True), [{
'contents': 'tests',
'highlight_group': ['branch_dirty', 'branch'],
'highlight_groups': ['branch_dirty', 'branch'],
'divider_highlight_group': None
}])
self.assertEqual(branch(segment_info=segment_info, status_colors=False), [{
'highlight_group': ['branch'],
'highlight_groups': ['branch'],
'contents': 'tests',
'divider_highlight_group': None
}])
@ -632,22 +632,22 @@ class TestVcs(TestCommon):
with replace_attr(self.module, 'guess', get_dummy_guess(status=lambda: 'U')):
with replace_attr(self.module, 'tree_status', lambda repo, pl: 'U'):
self.assertEqual(branch(segment_info=segment_info, status_colors=False, ignore_statuses=['U']), [{
'highlight_group': ['branch'],
'highlight_groups': ['branch'],
'contents': 'tests',
'divider_highlight_group': None
}])
self.assertEqual(branch(segment_info=segment_info, status_colors=True, ignore_statuses=['DU']), [{
'highlight_group': ['branch_dirty', 'branch'],
'highlight_groups': ['branch_dirty', 'branch'],
'contents': 'tests',
'divider_highlight_group': None
}])
self.assertEqual(branch(segment_info=segment_info, status_colors=True), [{
'highlight_group': ['branch_dirty', 'branch'],
'highlight_groups': ['branch_dirty', 'branch'],
'contents': 'tests',
'divider_highlight_group': None
}])
self.assertEqual(branch(segment_info=segment_info, status_colors=True, ignore_statuses=['U']), [{
'highlight_group': ['branch_clean', 'branch'],
'highlight_groups': ['branch_clean', 'branch'],
'contents': 'tests',
'divider_highlight_group': None
}])
@ -659,8 +659,8 @@ class TestTime(TestCommon):
def test_date(self):
pl = Pl()
with replace_attr(self.module, 'datetime', Args(now=lambda: Args(strftime=lambda fmt: fmt))):
self.assertEqual(common.date(pl=pl), [{'contents': '%Y-%m-%d', 'highlight_group': ['date'], 'divider_highlight_group': None}])
self.assertEqual(common.date(pl=pl, format='%H:%M', istime=True), [{'contents': '%H:%M', 'highlight_group': ['time', 'date'], 'divider_highlight_group': 'time:divider'}])
self.assertEqual(common.date(pl=pl), [{'contents': '%Y-%m-%d', 'highlight_groups': ['date'], 'divider_highlight_group': None}])
self.assertEqual(common.date(pl=pl, format='%H:%M', istime=True), [{'contents': '%H:%M', 'highlight_groups': ['time', 'date'], 'divider_highlight_group': 'time:divider'}])
def test_fuzzy_time(self):
time = Args(hour=0, minute=45)
@ -710,14 +710,14 @@ class TestSys(TestCommon):
with replace_module_module(self.module, 'os', getloadavg=lambda: (7.5, 3.5, 1.5)):
with replace_attr(self.module, '_cpu_count', lambda: 2):
self.assertEqual(common.system_load(pl=pl), [
{'contents': '7.5 ', 'highlight_group': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 100},
{'contents': '3.5 ', 'highlight_group': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 75.0},
{'contents': '1.5', 'highlight_group': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 0}
{'contents': '7.5 ', 'highlight_groups': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 100},
{'contents': '3.5 ', 'highlight_groups': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 75.0},
{'contents': '1.5', 'highlight_groups': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 0}
])
self.assertEqual(common.system_load(pl=pl, format='{avg:.0f}', threshold_good=0, threshold_bad=1), [
{'contents': '8 ', 'highlight_group': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 100},
{'contents': '4 ', 'highlight_group': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 100},
{'contents': '2', 'highlight_group': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 75.0}
{'contents': '8 ', 'highlight_groups': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 100},
{'contents': '4 ', 'highlight_groups': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 100},
{'contents': '2', 'highlight_groups': ['system_load_gradient', 'system_load'], 'divider_highlight_group': 'background:divider', 'gradient_level': 75.0}
])
def test_cpu_load_percent(self):
@ -730,12 +730,12 @@ class TestSys(TestCommon):
self.assertEqual(common.cpu_load_percent(pl=pl), [{
'contents': '52%',
'gradient_level': 52.3,
'highlight_group': ['cpu_load_percent_gradient', 'cpu_load_percent'],
'highlight_groups': ['cpu_load_percent_gradient', 'cpu_load_percent'],
}])
self.assertEqual(common.cpu_load_percent(pl=pl, format='{0:.1f}%'), [{
'contents': '52.3%',
'gradient_level': 52.3,
'highlight_group': ['cpu_load_percent_gradient', 'cpu_load_percent'],
'highlight_groups': ['cpu_load_percent_gradient', 'cpu_load_percent'],
}])
@ -746,46 +746,46 @@ class TestWthr(TestCommon):
pl = Pl()
with replace_attr(self.module, 'urllib_read', urllib_read):
self.assertEqual(common.weather(pl=pl), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 30.0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 30.0}
])
self.assertEqual(common.weather(pl=pl, temp_coldest=0, temp_hottest=100), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 0}
])
self.assertEqual(common.weather(pl=pl, temp_coldest=-100, temp_hottest=-50), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 100}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 100}
])
self.assertEqual(common.weather(pl=pl, icons={'cloudy': 'o'}), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'o '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 30.0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'o '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 30.0}
])
self.assertEqual(common.weather(pl=pl, icons={'partly_cloudy_day': 'x'}), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'x '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 30.0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'x '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 30.0}
])
self.assertEqual(common.weather(pl=pl, unit='F'), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '16°F', 'gradient_level': 30.0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '16°F', 'gradient_level': 30.0}
])
self.assertEqual(common.weather(pl=pl, unit='K'), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '264K', 'gradient_level': 30.0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '264K', 'gradient_level': 30.0}
])
self.assertEqual(common.weather(pl=pl, temp_format='{temp:.1e}C'), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9.0e+00C', 'gradient_level': 30.0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9.0e+00C', 'gradient_level': 30.0}
])
with replace_attr(self.module, 'urllib_read', urllib_read):
common.weather.startup(pl=pl, location_query='Meppen,06,DE')
self.assertEqual(common.weather(pl=pl), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 30.0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '-9°C', 'gradient_level': 30.0}
])
self.assertEqual(common.weather(pl=pl, location_query='Moscow,RU'), [
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_group': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '19°C', 'gradient_level': 70.0}
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_condition_partly_cloudy_day', 'weather_condition_cloudy', 'weather_conditions', 'weather'], 'contents': 'CLOUDS '},
{'divider_highlight_group': 'background:divider', 'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'], 'contents': '19°C', 'gradient_level': 70.0}
])
common.weather.shutdown()
@ -818,30 +818,30 @@ class TestBat(TestCommon):
with replace_attr(self.module, '_get_capacity', _get_capacity):
self.assertEqual(common.battery(pl=pl), [{
'contents': '86%',
'highlight_group': ['battery_gradient', 'battery'],
'highlight_groups': ['battery_gradient', 'battery'],
'gradient_level': 14,
}])
self.assertEqual(common.battery(pl=pl, format='{capacity:.2f}'), [{
'contents': '0.86',
'highlight_group': ['battery_gradient', 'battery'],
'highlight_groups': ['battery_gradient', 'battery'],
'gradient_level': 14,
}])
self.assertEqual(common.battery(pl=pl, steps=7), [{
'contents': '86%',
'highlight_group': ['battery_gradient', 'battery'],
'highlight_groups': ['battery_gradient', 'battery'],
'gradient_level': 14,
}])
self.assertEqual(common.battery(pl=pl, gamify=True), [
{
'contents': 'OOOO',
'draw_inner_divider': False,
'highlight_group': ['battery_full', 'battery_gradient', 'battery'],
'highlight_groups': ['battery_full', 'battery_gradient', 'battery'],
'gradient_level': 0
},
{
'contents': 'O',
'draw_inner_divider': False,
'highlight_group': ['battery_empty', 'battery_gradient', 'battery'],
'highlight_groups': ['battery_empty', 'battery_gradient', 'battery'],
'gradient_level': 100
}
])
@ -849,13 +849,13 @@ class TestBat(TestCommon):
{
'contents': '++++++++',
'draw_inner_divider': False,
'highlight_group': ['battery_full', 'battery_gradient', 'battery'],
'highlight_groups': ['battery_full', 'battery_gradient', 'battery'],
'gradient_level': 0
},
{
'contents': '--',
'draw_inner_divider': False,
'highlight_group': ['battery_empty', 'battery_gradient', 'battery'],
'highlight_groups': ['battery_empty', 'battery_gradient', 'battery'],
'gradient_level': 100
}
])
@ -983,10 +983,10 @@ class TestVim(TestCase):
segment_info = vim_module._get_segment_info()
self.assertEqual(self.vim.file_name(pl=pl, segment_info=segment_info), None)
self.assertEqual(self.vim.file_name(pl=pl, segment_info=segment_info, display_no_file=True), [
{'contents': '[No file]', 'highlight_group': ['file_name_no_file', 'file_name']}
{'contents': '[No file]', 'highlight_groups': ['file_name_no_file', 'file_name']}
])
self.assertEqual(self.vim.file_name(pl=pl, segment_info=segment_info, display_no_file=True, no_file_text='X'), [
{'contents': 'X', 'highlight_group': ['file_name_no_file', 'file_name']}
{'contents': 'X', 'highlight_groups': ['file_name_no_file', 'file_name']}
])
with vim_module._with('buffer', '/tmp/abc') as segment_info:
self.assertEqual(self.vim.file_name(pl=pl, segment_info=segment_info), 'abc')
@ -1033,7 +1033,7 @@ class TestVim(TestCase):
vim_module._set_cursor(50, 0)
self.assertEqual(self.vim.line_percent(pl=pl, segment_info=segment_info), '50')
self.assertEqual(self.vim.line_percent(pl=pl, segment_info=segment_info, gradient=True), [
{'contents': '50', 'highlight_group': ['line_percent_gradient', 'line_percent'], 'gradient_level': 50 * 100.0 / 101}
{'contents': '50', 'highlight_groups': ['line_percent_gradient', 'line_percent'], 'gradient_level': 50 * 100.0 / 101}
])
finally:
vim_module._bw(segment_info['bufnr'])
@ -1057,7 +1057,7 @@ class TestVim(TestCase):
vim_module._set_cursor(49, 0)
self.assertEqual(self.vim.position(pl=pl, segment_info=segment_info), '50%')
self.assertEqual(self.vim.position(pl=pl, segment_info=segment_info, gradient=True), [
{'contents': '50%', 'highlight_group': ['position_gradient', 'position'], 'gradient_level': 50.0}
{'contents': '50%', 'highlight_groups': ['position_gradient', 'position'], 'gradient_level': 50.0}
])
vim_module._set_cursor(0, 0)
self.assertEqual(self.vim.position(pl=pl, segment_info=segment_info), 'Top')
@ -1067,7 +1067,7 @@ class TestVim(TestCase):
vim_module._set_cursor(0, 0)
self.assertEqual(self.vim.position(pl=pl, segment_info=segment_info, position_strings={'top': 'Comienzo', 'bottom': 'Final', 'all': 'Todo'}), 'Todo')
self.assertEqual(self.vim.position(pl=pl, segment_info=segment_info, gradient=True), [
{'contents': 'All', 'highlight_group': ['position_gradient', 'position'], 'gradient_level': 0.0}
{'contents': 'All', 'highlight_groups': ['position_gradient', 'position'], 'gradient_level': 0.0}
])
finally:
vim_module._bw(segment_info['bufnr'])
@ -1078,10 +1078,10 @@ class TestVim(TestCase):
self.assertEqual(self.vim.line_current(pl=pl, segment_info=segment_info), '1')
self.assertEqual(self.vim.col_current(pl=pl, segment_info=segment_info), '1')
self.assertEqual(self.vim.virtcol_current(pl=pl, segment_info=segment_info), [{
'highlight_group': ['virtcol_current_gradient', 'virtcol_current', 'col_current'], 'contents': '1', 'gradient_level': 100.0 / 80,
'highlight_groups': ['virtcol_current_gradient', 'virtcol_current', 'col_current'], 'contents': '1', 'gradient_level': 100.0 / 80,
}])
self.assertEqual(self.vim.virtcol_current(pl=pl, segment_info=segment_info, gradient=False), [{
'highlight_group': ['virtcol_current', 'col_current'], 'contents': '1',
'highlight_groups': ['virtcol_current', 'col_current'], 'contents': '1',
}])
def test_modified_buffers(self):
@ -1096,32 +1096,32 @@ class TestVim(TestCase):
with replace_attr(self.vcs, 'guess', get_dummy_guess(status=lambda: None)):
with replace_attr(self.vcs, 'tree_status', lambda repo, pl: None):
self.assertEqual(branch(segment_info=segment_info, status_colors=False), [
{'divider_highlight_group': 'branch:divider', 'highlight_group': ['branch'], 'contents': 'foo'}
{'divider_highlight_group': 'branch:divider', 'highlight_groups': ['branch'], 'contents': 'foo'}
])
self.assertEqual(branch(segment_info=segment_info, status_colors=True), [
{'divider_highlight_group': 'branch:divider', 'highlight_group': ['branch_clean', 'branch'], 'contents': 'foo'}
{'divider_highlight_group': 'branch:divider', 'highlight_groups': ['branch_clean', 'branch'], 'contents': 'foo'}
])
with replace_attr(self.vcs, 'guess', get_dummy_guess(status=lambda: 'DU')):
with replace_attr(self.vcs, 'tree_status', lambda repo, pl: 'DU'):
self.assertEqual(branch(segment_info=segment_info, status_colors=False), [
{'divider_highlight_group': 'branch:divider', 'highlight_group': ['branch'], 'contents': 'foo'}
{'divider_highlight_group': 'branch:divider', 'highlight_groups': ['branch'], 'contents': 'foo'}
])
self.assertEqual(branch(segment_info=segment_info, status_colors=True), [
{'divider_highlight_group': 'branch:divider', 'highlight_group': ['branch_dirty', 'branch'], 'contents': 'foo'}
{'divider_highlight_group': 'branch:divider', 'highlight_groups': ['branch_dirty', 'branch'], 'contents': 'foo'}
])
with replace_attr(self.vcs, 'guess', get_dummy_guess(status=lambda: 'U')):
with replace_attr(self.vcs, 'tree_status', lambda repo, pl: 'U'):
self.assertEqual(branch(segment_info=segment_info, status_colors=False, ignore_statuses=['U']), [
{'divider_highlight_group': 'branch:divider', 'highlight_group': ['branch'], 'contents': 'foo'}
{'divider_highlight_group': 'branch:divider', 'highlight_groups': ['branch'], 'contents': 'foo'}
])
self.assertEqual(branch(segment_info=segment_info, status_colors=True, ignore_statuses=['DU']), [
{'divider_highlight_group': 'branch:divider', 'highlight_group': ['branch_dirty', 'branch'], 'contents': 'foo'}
{'divider_highlight_group': 'branch:divider', 'highlight_groups': ['branch_dirty', 'branch'], 'contents': 'foo'}
])
self.assertEqual(branch(segment_info=segment_info, status_colors=True), [
{'divider_highlight_group': 'branch:divider', 'highlight_group': ['branch_dirty', 'branch'], 'contents': 'foo'}
{'divider_highlight_group': 'branch:divider', 'highlight_groups': ['branch_dirty', 'branch'], 'contents': 'foo'}
])
self.assertEqual(branch(segment_info=segment_info, status_colors=True, ignore_statuses=['U']), [
{'divider_highlight_group': 'branch:divider', 'highlight_group': ['branch_clean', 'branch'], 'contents': 'foo'}
{'divider_highlight_group': 'branch:divider', 'highlight_groups': ['branch_clean', 'branch'], 'contents': 'foo'}
])
def test_file_vcs_status(self):
@ -1131,7 +1131,7 @@ class TestVim(TestCase):
with vim_module._with('buffer', '/foo') as segment_info:
with replace_attr(self.vim, 'guess', get_dummy_guess(status=lambda file: 'M')):
self.assertEqual(file_vcs_status(segment_info=segment_info), [
{'highlight_group': ['file_vcs_status_M', 'file_vcs_status'], 'contents': 'M'}
{'highlight_groups': ['file_vcs_status_M', 'file_vcs_status'], 'contents': 'M'}
])
with replace_attr(self.vim, 'guess', get_dummy_guess(status=lambda file: None)):
self.assertEqual(file_vcs_status(segment_info=segment_info), None)
@ -1148,11 +1148,11 @@ class TestVim(TestCase):
self.assertEqual(trailing_whitespace(), None)
vim_module.current.buffer[0] = ' '
self.assertEqual(trailing_whitespace(), [{
'highlight_group': ['trailing_whitespace', 'warning'],
'highlight_groups': ['trailing_whitespace', 'warning'],
'contents': '1',
}])
self.assertEqual(trailing_whitespace(), [{
'highlight_group': ['trailing_whitespace', 'warning'],
'highlight_groups': ['trailing_whitespace', 'warning'],
'contents': '1',
}])
vim_module.current.buffer[0] = ''
@ -1185,7 +1185,7 @@ class TestVim(TestCase):
vim_module.current.buffer[0] = ' '
self.assertEqual(self.vim.tab_modified_indicator(pl=pl, segment_info=segment_info), [{
'contents': '+',
'highlight_group': ['tab_modified_indicator', 'modified_indicator'],
'highlight_groups': ['tab_modified_indicator', 'modified_indicator'],
}])
vim_module._undo()
self.assertEqual(self.vim.tab_modified_indicator(pl=pl, segment_info=segment_info), None)
@ -1197,7 +1197,7 @@ class TestVim(TestCase):
self.assertEqual(self.vim.modified_indicator(pl=pl, segment_info=segment_info), None)
self.assertEqual(self.vim.tab_modified_indicator(pl=pl, segment_info=segment_info), [{
'contents': '+',
'highlight_group': ['tab_modified_indicator', 'modified_indicator'],
'highlight_groups': ['tab_modified_indicator', 'modified_indicator'],
}])
def test_csv_col_current(self):
@ -1216,55 +1216,55 @@ class TestVim(TestCase):
buffer[:] = ['1;2;3', '4;5;6']
vim_module._set_cursor(1, 1)
self.assertEqual(csv_col_current(), [{
'contents': '1', 'highlight_group': ['csv:column_number', 'csv']
'contents': '1', 'highlight_groups': ['csv:column_number', 'csv']
}])
vim_module._set_cursor(2, 3)
self.assertEqual(csv_col_current(), [{
'contents': '2', 'highlight_group': ['csv:column_number', 'csv']
'contents': '2', 'highlight_groups': ['csv:column_number', 'csv']
}])
vim_module._set_cursor(2, 3)
self.assertEqual(csv_col_current(display_name=True), [{
'contents': '2', 'highlight_group': ['csv:column_number', 'csv']
'contents': '2', 'highlight_groups': ['csv:column_number', 'csv']
}, {
'contents': ' (2)', 'highlight_group': ['csv:column_name', 'csv']
'contents': ' (2)', 'highlight_groups': ['csv:column_name', 'csv']
}])
buffer[:0] = ['Foo;Bar;Baz']
vim_module._set_cursor(2, 3)
self.assertEqual(csv_col_current(), [{
'contents': '2', 'highlight_group': ['csv:column_number', 'csv']
'contents': '2', 'highlight_groups': ['csv:column_number', 'csv']
}, {
'contents': ' (Bar)', 'highlight_group': ['csv:column_name', 'csv']
'contents': ' (Bar)', 'highlight_groups': ['csv:column_name', 'csv']
}])
if sys.version_info < (2, 7):
raise SkipTest('csv module in Python-2.6 does not handle multiline csv files well')
buffer[len(buffer):] = ['1;"bc', 'def', 'ghi', 'jkl";3']
vim_module._set_cursor(5, 1)
self.assertEqual(csv_col_current(), [{
'contents': '2', 'highlight_group': ['csv:column_number', 'csv']
'contents': '2', 'highlight_groups': ['csv:column_number', 'csv']
}, {
'contents': ' (Bar)', 'highlight_group': ['csv:column_name', 'csv']
'contents': ' (Bar)', 'highlight_groups': ['csv:column_name', 'csv']
}])
vim_module._set_cursor(7, 6)
self.assertEqual(csv_col_current(), [{
'contents': '3', 'highlight_group': ['csv:column_number', 'csv']
'contents': '3', 'highlight_groups': ['csv:column_number', 'csv']
}, {
'contents': ' (Baz)', 'highlight_group': ['csv:column_name', 'csv']
'contents': ' (Baz)', 'highlight_groups': ['csv:column_name', 'csv']
}])
self.assertEqual(csv_col_current(name_format=' ({column_name:.1})'), [{
'contents': '3', 'highlight_group': ['csv:column_number', 'csv']
'contents': '3', 'highlight_groups': ['csv:column_number', 'csv']
}, {
'contents': ' (B)', 'highlight_group': ['csv:column_name', 'csv']
'contents': ' (B)', 'highlight_groups': ['csv:column_name', 'csv']
}])
self.assertEqual(csv_col_current(display_name=True, name_format=' ({column_name:.1})'), [{
'contents': '3', 'highlight_group': ['csv:column_number', 'csv']
'contents': '3', 'highlight_groups': ['csv:column_number', 'csv']
}, {
'contents': ' (B)', 'highlight_group': ['csv:column_name', 'csv']
'contents': ' (B)', 'highlight_groups': ['csv:column_name', 'csv']
}])
self.assertEqual(csv_col_current(display_name=False, name_format=' ({column_name:.1})'), [{
'contents': '3', 'highlight_group': ['csv:column_number', 'csv']
'contents': '3', 'highlight_groups': ['csv:column_number', 'csv']
}])
self.assertEqual(csv_col_current(display_name=False), [{
'contents': '3', 'highlight_group': ['csv:column_number', 'csv']
'contents': '3', 'highlight_groups': ['csv:column_number', 'csv']
}])
finally:
vim_module._bw(segment_info['bufnr'])

View File

@ -8,8 +8,8 @@ if test -z "$POWERLINE_NO_ZSH_ZPYTHON" ; then
powerline-reload-config
}
function set_theme() {
typeset -A POWERLINE_CONFIG
POWERLINE_CONFIG=(
typeset -A POWERLINE_CONFIG_OVERRIDES
POWERLINE_CONFIG_OVERRIDES=(
ext.shell.theme $1
)
powerline-reload-config
@ -23,7 +23,7 @@ else
}
fi
source powerline/bindings/zsh/powerline.zsh
typeset -gA POWERLINE_CONFIG POWERLINE_THEME_CONFIG
typeset -gA POWERLINE_CONFIG_OVERRIDES POWERLINE_THEME_CONFIG
set_theme_option default_leftonly.segment_data.hostname.args.only_if_ssh false
set_theme_option default.segment_data.hostname.args.only_if_ssh false
set_theme default_leftonly