If somebody needs to readd it he should make better code, specifically:
- Functions and variables necessary for supporting Control-P need to be defined
in a separate initialiazation function that is only called if Control-P was
found.
- Segments that show different information must be defined as separate segments
that may be put into configuration file.
- Segment functions must not know side they are on.
- Segment functions must not emit `priority`, it must go to configuration file.
- Segment functions must have proper documentation.
- Segment functions must not emit `width` and `align` keys.
- String `Loading...` or the equivalent must be overridable from configuration,
same for other interface strings (e.g. what is shown when `regex` is true).
- Segment functions must have names that make it clear what they emit.
Closes#1244
Note: some modules (i.e wthr and bat) have their names in order to avoid the
situation when module name matches segment name:
import powerline.segments.common.weather
will import weather segment because `powerline.segments.common` contains line
`from powerline.segments.common.weather import weather`.
Fixes#1083
Now imports follow the following structure:
1. __future__ line: exactly one line allowed:
from __future__ import (unicode_literals, division, absolute_import, print_function)
(powerline.shell is the only exception due to problems with argparse).
2. Standard python library imports in a form `import X`.
3. Standard python library imports in a form `from X import Y`.
4. and 5. 2. and 3. for third-party (non-python and non-powerline imports).
6. 3. for powerline non-test imports.
7. and 8. 2. and 3. for powerline testing module imports.
Each list entry is separated by exactly one newline from another import. If
there is module docstring it goes between `# vim:` comment and `__future__`
import. So the structure containing all items is the following:
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
'''Powerline super module'''
import sys
from argparse import ArgumentParser
import psutil
from colormath.color_diff import delta_e_cie2000
from powerline.lib.unicode import u
import tests.vim as vim_module
from tests import TestCase
.
- This segment displays the number of attached tmux clients to the
currently running session.
- The minimum argument is used to specify a threshold for when the
segment should be visible.
Fixes#661Closes#662
Conflicts:
docs/source/index.rst
powerline/config_files/colorschemes/shell/default.json
powerline/config_files/colorschemes/shell/solarized.json
powerline/config_files/colorschemes/tmux/default.json
powerline/config_files/colorschemes/vim/default.json
powerline/config_files/colorschemes/vim/solarized.json
powerline/config_files/colorschemes/wm/default.json
tests/test_segments.py
Most of the files are empty and need to be copied or rewritten from the
old docs. Font patching docs have been removed entirely and will be
moved to the powerline-fontpatcher repo.
Ref #769
Used python version is controlled by `g:powerline_pycmd`. User configuration now
has top priority: if `g:powerline_pyeval` is set powerline will not try to use
`pyeval()` emulation in old Vim versions.
Closes#937 as WONTFIX
tmux configuration has become very fragmented between versions due to a
combination of new features and deprecation of older options. As such,
version checking for tmux became a requirement to allow maximum
functionality along with version-appropriate configuration. However,
wrapping nearly every line with `if-shell` is tedious and becomes
virtually unreadable.
This enhancement to tmux version-checking creates a logical
configuration file structure that reflects the development of tmux. As
additional configurations are added and tmux development continues, this
structure can be leveraged appropriately and extended as needed.
Rather than having multiple `if-shell` checks for the same version, each
version or version group with specific requirements can be checked only
once. This leads to simpler and fewer `if-shell` version checks. It also
reduces the ambiguity introduced by complex `if-shell` commands that
include an 'else' conditional.
A caveat to adding this enhancement is the additional requirement of the
end user to add a tmux variable definition (`POWERLINE_BINDINGS_DIR`) to
his/her `~/.tmux.conf` file. For existing tmux users leveraging
powerline, this may prove to be a slight one-time nuisance immediately
after upgrading. Without this definition, there is no way to determine
the location of the additional tmux powerline config files that have
been added with this enhancement. The docs have also been updated in
this commit to reflect this initial configuration requirement change.
Also added are some additional troubleshooting notes that point to
definition of this variable as a potential issue. Powerline will
continue to work without the definition of `POWERLINE_BINDINGS_DIR`, but
some of the functionality will be reduced and the appearance incomplete
(i.e. colors).
Ultimately, the caveat above is a small price to pay in exchange for a
framework that can be leveraged for proper version-appropriate
configuration of tmux going forward.