Merge pull request #1090 from ZyX-I/update-documentation

Improve documentation
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2014-09-20 20:10:25 +04:00
commit 9eb6f996fa
52 changed files with 261 additions and 252 deletions

View File

@ -34,24 +34,24 @@ Features
* **Support for prompts and statuslines in many applications.** Originally
created exclusively for vim statuslines, the project has evolved to
provide statuslines in tmux and several WMs, and prompts for shells like
bash/zsh and other applications. It's simple to write renderers for any
other applications that Powerline doesn't yet support.
bash/zsh and other applications. Its simple to write renderers for any
other applications that Powerline doesnt yet support.
* **Configuration and colorschemes written in JSON.** JSON is
a standardized, simple and easy to use file format that allows for easy
user configuration across all of Powerline's supported applications.
user configuration across all of Powerlines supported applications.
* **Fast and lightweight, with daemon support for even better performance.**
Although the code base spans a couple of thousand lines of code with no
goal of "less than X lines of code", the main focus is on good performance
goal of “less than X lines of code”, the main focus is on good performance
and as little code as possible while still providing a rich set of
features. The new daemon also ensures that only one Python instance is
launched for prompts and statuslines, which provides excellent
performance.
*But I hate Python / I don't need shell prompts / this is just too much
*But I hate Python / I dont need shell prompts / this is just too much
hassle for me / what happened to the original vim-powerline project / …*
You should check out some of the Powerline derivatives. The most lightweight
and feature-rich alternative is currently Bailey Ling's `vim-airline
and feature-rich alternative is currently Bailey Lings `vim-airline
<https://github.com/bling/vim-airline>`_ project.
------

View File

@ -22,7 +22,7 @@ html_show_copyright = False
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
if not on_rtd: # only import and set the theme if were building docs locally
try:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'

View File

@ -87,29 +87,29 @@ You can move the segment dictionaries around to change the segment
positions, or remove the entire dictionary to remove the segment from the
prompt or statusline.
.. note:: It's essential that the contents of all your configuration files
is valid JSON! It's strongly recommended that you run your configuration
.. note:: Its essential that the contents of all your configuration files
is valid JSON! Its strongly recommended that you run your configuration
files through ``jsonlint`` after changing them.
Some segments need a user configuration to work properly. Here's a couple of
Some segments need a user configuration to work properly. Heres a couple of
segments that you may want to customize right away:
**E-mail alert segment**
You have to set your username and password (and possibly server/port)
for the e-mail alert segment. If you're using GMail it's recommended
for the e-mail alert segment. If youre using GMail its recommended
that you `generate an application-specific password
<https://accounts.google.com/IssuedAuthSubTokens>`_ for this purpose.
Open a theme file, scroll down to the ``email_imap_alert`` segment and
set your ``username`` and ``password``. The server defaults to GMail's
set your ``username`` and ``password``. The server defaults to GMails
IMAP server, but you can set the server/port by adding a ``server`` and
a ``port`` argument.
**Weather segment**
The weather segment will try to find your location using a GeoIP lookup,
so unless you're on a VPN you probably won't have to change the location
so unless youre on a VPN you probably wont have to change the location
query.
If you want to change the location query or the temperature unit you'll
If you want to change the location query or the temperature unit youll
have to update the segment arguments. Open a theme file, scroll down to
the weather segment and update it to include unit/location query
arguments:

View File

@ -177,7 +177,7 @@ Color definitions
* A cterm color index.
* A list with a cterm color index and a hex color string (e.g. ``[123,
"aabbcc"]``). This is useful for colorschemes that use colors that
aren't available in color terminals.
arent available in color terminals.
``gradients``
Gradient definitions, consisting of a dict where the key is the name of the
@ -236,7 +236,7 @@ override those from each previous file. It is required that either
``mode_translations``
Mode-specific highlighting for extensions that support it (e.g. the vim
extension). It's an easy way of changing a color in a specific mode.
extension). Its an easy way of changing a color in a specific mode.
Consists of a dict where the key is the mode and the value is a dict
with the following options:
@ -308,7 +308,7 @@ ascii Theme without any unicode characters at all
``dividers``
Defines the dividers used in all Powerline extensions. This option
should usually only be changed if you don't have a patched font, or if
should usually only be changed if you dont have a patched font, or if
you use a font patched with the legacy font patcher.
The ``hard`` dividers are used to divide segments with different

View File

@ -15,7 +15,7 @@ always absolute.
Segments are regular Python functions, and they may accept arguments. All
arguments should have a default value which will be used for themes that
don't provide an ``args`` dict.
dont provide an ``args`` dict.
More information is available in :ref:`Writing segments <dev-segments>` section.

View File

@ -90,8 +90,8 @@ Patched fonts
This method is the fallback method and works for every terminal, with the
exception of :ref:`rxvt-unicode <tips-and-tricks-urxvt>`.
Download the font of your choice from `powerline-fonts`_. If you can't find
your preferred font in the `powerline-fonts`_ repo, you'll have to patch your
Download the font of your choice from `powerline-fonts`_. If you cant find
your preferred font in the `powerline-fonts`_ repo, youll have to patch your
own font instead.
.. _powerline-fonts: https://github.com/Lokaltog/powerline-fonts

View File

@ -10,7 +10,7 @@ automatically do most of the configuration for you.
* `Arch Linux (AUR), Python 3 version <https://aur.archlinux.org/packages/python-powerline-git/>`_
* Gentoo Live ebuild in `raiagent <https://github.com/leycec/raiagent>`_ overlay
If you're running a distribution without an official package you'll have to
If youre running a distribution without an official package youll have to
follow the installation guide below:
1. Install Python 3.2+ or Python 2.6+ with ``pip``. This step is
@ -34,8 +34,8 @@ Fonts installation
Fontconfig
----------
This method only works on Linux. It's the recommended method if your
terminal emulator supports it as you don't have to patch any fonts, and it
This method only works on Linux. Its the recommended method if your
terminal emulator supports it as you dont have to patch any fonts, and it
generally works well with any coding font.
#. Download the latest version of the symbol font and fontconfig file::
@ -54,16 +54,16 @@ generally works well with any coding font.
fc-cache -vf ~/.fonts/
#. Install the fontconfig file. For newer versions of fontconfig the config
path is ``~/.config/fontconfig/conf.d/``, for older versions it's
path is ``~/.config/fontconfig/conf.d/``, for older versions its
``~/.fonts.conf.d/``::
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
If you can't see the custom symbols, please close all instances of your
If you cant see the custom symbols, please close all instances of your
terminal emulator. You may need to restart X for the changes to take
effect.
If you *still* can't see the custom symbols, double-check that you have
If you *still* cant see the custom symbols, double-check that you have
installed the font to a valid X font path, and that you have installed the
fontconfig file to a valid fontconfig path. Alternatively try to install
a :ref:`patched font <installation-patched-fonts>`.
@ -87,9 +87,9 @@ After installing the patched font you need to update Gvim or your terminal
emulator to use the patched font. The correct font usually ends with *for
Powerline*.
If you can't see the custom symbols, please close all instances of your
If you cant see the custom symbols, please close all instances of your
terminal emulator. You may need to restart X for the changes to take
effect.
If you *still* can't see the custom symbols, double-check that you have
If you *still* cant see the custom symbols, double-check that you have
installed the font to a valid X font path.

View File

@ -45,7 +45,7 @@ Vim installation
================
Any terminal vim version with Python 3.2+ or Python 2.6+ support should work,
but if you're using MacVim you need to install it using the following command::
but if youre using MacVim you need to install it using the following command::
brew install macvim --env-std --override-system-vim

View File

@ -20,24 +20,24 @@ Features
* **Support for prompts and statuslines in many applications.** Originally
created exclusively for vim statuslines, the project has evolved to
provide statuslines in tmux and several WMs, and prompts for shells like
bash/zsh and other applications. It's simple to write renderers for any
other applications that Powerline doesn't yet support.
bash/zsh and other applications. Its simple to write renderers for any
other applications that Powerline doesnt yet support.
* **Configuration and colorschemes written in JSON.** JSON is
a standardized, simple and easy to use file format that allows for easy
user configuration across all of Powerline's supported applications.
user configuration across all of Powerlines supported applications.
* **Fast and lightweight, with daemon support for even better performance.**
Although the code base spans a couple of thousand lines of code with no
goal of "less than X lines of code", the main focus is on good performance
goal of “less than X lines of code”, the main focus is on good performance
and as little code as possible while still providing a rich set of
features. The new daemon also ensures that only one Python instance is
launched for prompts and statuslines, which provides excellent
performance.
*But I hate Python / I don't need shell prompts / this is just too much
*But I hate Python / I dont need shell prompts / this is just too much
hassle for me / what happened to the original vim-powerline project / …*
You should check out some of the Powerline derivatives. The most lightweight
and feature-rich alternative is currently Bailey Ling's `vim-airline
and feature-rich alternative is currently Bailey Lings `vim-airline
<https://github.com/bling/vim-airline>`_ project.
Screenshots

View File

@ -47,7 +47,7 @@ In the ``~/.Xdefaults`` add the following::
I noticed that Source Code Pro has the glyphs there already, but the pixel size
of the fonts play a role in whether or not the > or the < separators showing up
or not. Using font size 12, glyphs on the right hand side of the powerline are
present, but the ones on the left don't. Pixel size 14, brings the reverse
present, but the ones on the left dont. Pixel size 14, brings the reverse
problem. Font size 13 seems to work just fine.
Reloading powerline after update

View File

@ -13,14 +13,14 @@ System-specific issues
Common issues
=============
I'm using tmux and Powerline looks like crap, what's wrong?
Im using tmux and Powerline looks like crap, whats wrong?
-----------------------------------------------------------
* You need to tell tmux that it has 256-color capabilities. Add this to your
:file:`.tmux.conf` to solve this issue::
set -g default-terminal "screen-256color"
* If you're using iTerm2, make sure that you have enabled the setting
* If youre using iTerm2, make sure that you have enabled the setting
:guilabel:`Set locale variables automatically` in :menuselection:`Profiles -->
Terminal --> Environment`.
* Make sure tmux knows that terminal it is running in support 256 colors. You

View File

@ -2,19 +2,27 @@
Troubleshooting on Linux
************************
I can't see any fancy symbols, what's wrong?
I cant see any fancy symbols, whats wrong?
--------------------------------------------
* Make sure that you've configured gvim or your terminal emulator to use
* Make sure that youve configured gvim or your terminal emulator to use
a patched font.
* You need to set your ``LANG`` and ``LC_*`` environment variables to
a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your Linux distro's
a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your Linux distros
documentation for information about setting these variables correctly.
* Make sure that vim is compiled with the ``--with-features=big`` flag.
* If you're using rxvt-unicode, make sure that it's compiled with the
* If youre using rxvt-unicode make sure that its compiled with the
``--enable-unicode3`` flag.
* If youre using xterm make sure you have told it to work with unicode. You may
need ``-u8`` command-line argument, ``uxterm`` shell wrapper that is usually
shipped with xterm for this or ``xterm*utf8`` property set to ``1`` or ``2``
in ``~/.Xresources`` (applied with ``xrdb``). Note that in case ``uxterm`` is
used configuration is done via ``uxterm*…`` properties and not ``xterm*…``.
The fancy symbols look a bit blurry or "off"!
In any case the only absolute requirement is launching xterm with UTF-8
locale.
The fancy symbols look a bit blurry or “off”!
---------------------------------------------
* Make sure that you have patched all variants of your font (i.e. both the

View File

@ -2,21 +2,21 @@
Troubleshooting on OS X
***********************
I can't see any fancy symbols, what's wrong?
I cant see any fancy symbols, whats wrong?
--------------------------------------------
* If you're using iTerm2, please update to `this revision
* If youre using iTerm2, please update to `this revision
<https://github.com/gnachman/iTerm2/commit/8e3ad6dabf83c60b8cf4a3e3327c596401744af6>`_
or newer.
* You need to set your ``LANG`` and ``LC_*`` environment variables to
a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your Linux distro's
a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your Linux distros
documentation for information about setting these variables correctly.
The colors look weird in the default OS X Terminal app!
-------------------------------------------------------
* The arrows may have the wrong colors if you have changed the "minimum
contrast" slider in the color tab of your OS X settings.
* The arrows may have the wrong colors if you have changed the minimum
contrast” slider in the color tab of your OS X settings.
* The default OS X Terminal app is known to have some issues with the
Powerline colors. Please use another terminal emulator. iTerm2 should work
fine.
@ -24,8 +24,8 @@ The colors look weird in the default OS X Terminal app!
The colors look weird in iTerm2!
--------------------------------
* The arrows may have the wrong colors if you have changed the "minimum
contrast" slider in the color tab of your OS X settings.
* The arrows may have the wrong colors if you have changed the minimum
contrast” slider in the color tab of your OS X settings.
* Please disable background transparency to resolve this issue.
Statusline is getting wrapped to the next line in iTerm2

View File

@ -12,11 +12,11 @@ The vim plugin requires a vim version with Python support compiled in. You
can check if your vim supports Python by running ``vim --version | grep
+python``.
If your vim version doesn't have support for Python, you'll have to compile
If your vim version doesnt have support for Python, youll have to compile
it with the ``--enable-pythoninterp`` flag (``--enable-python3interp`` if
you want Python 3 support instead). Note that this also requires the related
Python headers to be installed on your system. Please consult your
distribution's documentation for details on how to compile and install
distributions documentation for details on how to compile and install
packages.
Vim version 7.4 or newer is recommended for performance reasons, but Powerline

View File

@ -25,7 +25,7 @@ directory:
set rtp+={repository_root}/powerline/bindings/vim
If you're using pathogen and don't want Powerline functionality in any other
If youre using pathogen and dont want Powerline functionality in any other
applications, simply add Powerline as a bundle and point the path above to the
Powerline bundle directory, e.g.
``~/.vim/bundle/powerline/powerline/bindings/vim``.

View File

@ -33,7 +33,7 @@ def read_to_log(pl, client):
while True:
start_time = monotonic()
s = powerline.render(side='right')
request = "powerline_widget:set_markup('" + s.replace('\\', '\\\\').replace("'", "\\'") + "')\n"
request = 'powerline_widget:set_markup(\'' + s.replace('\\', '\\\\').replace('\'', '\\\'') + '\')\n'
client = Popen(['awesome-client'], shell=False, stdout=PIPE, stderr=PIPE, stdin=PIPE)
client.stdin.write(request.encode('utf-8'))
client.stdin.close()

View File

@ -31,7 +31,7 @@ _powerline_init_tmux_support() {
# TMUX variable may be unset to create new tmux session inside this one
_POWERLINE_TMUX="$TMUX"
trap "_powerline_tmux_set_columns" WINCH
trap '_powerline_tmux_set_columns' WINCH
_powerline_tmux_set_columns
test "x$PROMPT_COMMAND" != "x${PROMPT_COMMAND/_powerline_tmux_set_pwd}" ||

View File

@ -8,7 +8,7 @@ from powerline import Powerline as PowerlineCore
class Powerline(base._TextBox):
def __init__(self, timeout=2, text=" ", width=bar.CALCULATED, **config):
def __init__(self, timeout=2, text=' ', width=bar.CALCULATED, **config):
base._TextBox.__init__(self, text, width, **config)
self.timeout_add(timeout, self.update)
self.powerline = PowerlineCore(ext='wm', renderer_module='pango_markup')

View File

@ -1,7 +1,7 @@
if-shell 'test -z "$POWERLINE_CONFIG_COMMAND"' 'set-environment -g POWERLINE_CONFIG_COMMAND powerline-config'
# Don't version-check for this core functionality -- anything too old to
# support these options likely won't work well with powerline
# Dont version-check for this core functionality -- anything too old to
# support these options likely wont work well with powerline
set -g status on
set -g status-utf8 on
set -g status-interval 2

View File

@ -61,24 +61,24 @@ function s:rcmd(s)
endfunction
try
let s:can_replace_pyeval = !exists('g:powerline_pyeval')
call s:rcmd("try:")
call s:rcmd(" powerline_appended_path = None")
call s:rcmd(" try:")
call s:rcmd(" ".s:import_cmd."")
call s:rcmd(" except ImportError:")
call s:rcmd(" import sys, vim")
call s:rcmd(" powerline_appended_path = vim.eval('expand(\"<sfile>:h:h:h:h:h\")')")
call s:rcmd(" sys.path.append(powerline_appended_path)")
call s:rcmd(" ".s:import_cmd."")
call s:rcmd(" import vim")
call s:rcmd(" powerline_instance = VimPowerline()")
call s:rcmd(" powerline_instance.setup(pyeval=vim.eval('s:pyeval'), pycmd=vim.eval('s:pycmd'), can_replace_pyeval=int(vim.eval('s:can_replace_pyeval')))")
call s:rcmd(" del VimPowerline")
call s:rcmd(" del powerline_instance")
call s:rcmd("except Exception:")
call s:rcmd(" import traceback, sys")
call s:rcmd(" traceback.print_exc(file=sys.stdout)")
call s:rcmd(" raise")
call s:rcmd('try:')
call s:rcmd(' powerline_appended_path = None')
call s:rcmd(' try:')
call s:rcmd(' '.s:import_cmd.'')
call s:rcmd(' except ImportError:')
call s:rcmd(' import sys, vim')
call s:rcmd(' powerline_appended_path = vim.eval("expand(\"<sfile>:h:h:h:h:h\")")')
call s:rcmd(' sys.path.append(powerline_appended_path)')
call s:rcmd(' '.s:import_cmd.'')
call s:rcmd(' import vim')
call s:rcmd(' powerline_instance = VimPowerline()')
call s:rcmd(' powerline_instance.setup(pyeval=vim.eval("s:pyeval"), pycmd=vim.eval("s:pycmd"), can_replace_pyeval=int(vim.eval("s:can_replace_pyeval")))')
call s:rcmd(' del VimPowerline')
call s:rcmd(' del powerline_instance')
call s:rcmd('except Exception:')
call s:rcmd(' import traceback, sys')
call s:rcmd(' traceback.print_exc(file=sys.stdout)')
call s:rcmd(' raise')
execute s:pycmd s:pystr
unlet s:pystr
let s:launched = 1
@ -99,61 +99,61 @@ finally
echomsg 'should set g:powerline_pycmd to "py3" to make it load correctly.'
endif
echohl None
call s:rcmd("def powerline_troubleshoot():")
call s:rcmd(" import sys")
call s:rcmd(" import vim")
call s:rcmd(" if sys.version_info < (2, 6):")
call s:rcmd(" print('Too old python version: ' + sys.version + ' (first supported is 2.6)')")
call s:rcmd(" elif sys.version_info[0] == 3 and sys.version_info[1] < 2:")
call s:rcmd(" print('Too old python 3 version: ' + sys.version + ' (first supported is 3.2)')")
call s:rcmd(" try:")
call s:rcmd(" import powerline")
call s:rcmd(" except ImportError:")
call s:rcmd(" print('Unable to import powerline, is it installed?')")
call s:rcmd(" else:")
call s:rcmd(" if not vim.eval('expand(\"<sfile>\")').startswith('/usr/'):")
call s:rcmd(" import os")
call s:rcmd(" powerline_dir = os.path.realpath(os.path.normpath(powerline.__file__))")
call s:rcmd(" powerline_dir = os.path.dirname(powerline.__file__)")
call s:rcmd(" this_dir = os.path.realpath(os.path.normpath(vim.eval('expand(\"<sfile>:p\")')))")
call s:rcmd(" this_dir = os.path.dirname(this_dir)") " powerline/bindings/vim/plugin
call s:rcmd(" this_dir = os.path.dirname(this_dir)") " powerline/bindings/vim
call s:rcmd(" this_dir = os.path.dirname(this_dir)") " powerline/bindings
call s:rcmd(" this_dir = os.path.dirname(this_dir)") " powerline
call s:rcmd(" if os.path.basename(this_dir) != 'powerline':")
call s:rcmd(" print('Check your installation:')")
call s:rcmd(" print('this script is not in powerline[/bindings/vim/plugin] directory,')")
call s:rcmd(" print('neither it is installed system-wide')")
call s:rcmd(" real_powerline_dir = os.path.realpath(powerline_dir)")
call s:rcmd(" real_this_dir = os.path.realpath(this_dir)")
call s:rcmd(" this_dir_par = os.path.dirname(real_this_dir)")
call s:rcmd(" powerline_appended_path = globals().get('powerline_appended_path')")
call s:rcmd(" if powerline_appended_path is not None and this_dir_par != powerline_appended_path:")
call s:rcmd(" print('Check your installation: this script is symlinked somewhere')")
call s:rcmd(" print('where powerline is not present: {0!r} != {1!r}.'.format(")
call s:rcmd(" real_this_dir, powerline_appended_path))")
call s:rcmd(" elif real_powerline_dir != real_this_dir:")
call s:rcmd(" print('It appears that you have two powerline versions installed:')")
call s:rcmd(" print('one in ' + real_powerline_dir + ', other in ' + real_this_dir + '.')")
call s:rcmd(" print('You should remove one of this. Check out troubleshooting section,')")
call s:rcmd(" print('it contains some information about the alternatives.')")
call s:rcmd(" try:")
call s:rcmd(" from powerline.lint import check")
call s:rcmd(" except ImportError:")
call s:rcmd(" print('Failed to import powerline.lint.check, cannot run powerline-lint')")
call s:rcmd(" else:")
call s:rcmd(" try:")
call s:rcmd(" paths = powerline_instance.get_config_paths()")
call s:rcmd(" except NameError:")
call s:rcmd(" pass")
call s:rcmd(" else:")
call s:rcmd(" from powerline.lint.markedjson.error import echoerr")
call s:rcmd(" ee = lambda *args, **kwargs: echoerr(*args, stream=sys.stdout, **kwargs)")
call s:rcmd(" check(paths=paths, echoerr=ee, require_ext='vim')")
call s:rcmd("try:")
call s:rcmd(" powerline_troubleshoot()")
call s:rcmd("finally:")
call s:rcmd(" del powerline_troubleshoot")
call s:rcmd('def powerline_troubleshoot():')
call s:rcmd(' import sys')
call s:rcmd(' import vim')
call s:rcmd(' if sys.version_info < (2, 6):')
call s:rcmd(' print("Too old python version: " + sys.version + " (first supported is 2.6)")')
call s:rcmd(' elif sys.version_info[0] == 3 and sys.version_info[1] < 2:')
call s:rcmd(' print("Too old python 3 version: " + sys.version + " (first supported is 3.2)")')
call s:rcmd(' try:')
call s:rcmd(' import powerline')
call s:rcmd(' except ImportError:')
call s:rcmd(' print("Unable to import powerline, is it installed?")')
call s:rcmd(' else:')
call s:rcmd(' if not vim.eval(''expand("<sfile>")'').startswith("/usr/"):')
call s:rcmd(' import os')
call s:rcmd(' powerline_dir = os.path.realpath(os.path.normpath(powerline.__file__))')
call s:rcmd(' powerline_dir = os.path.dirname(powerline.__file__)')
call s:rcmd(' this_dir = os.path.realpath(os.path.normpath(vim.eval(''expand("<sfile>:p")'')))')
call s:rcmd(' this_dir = os.path.dirname(this_dir)') " powerline/bindings/vim/plugin
call s:rcmd(' this_dir = os.path.dirname(this_dir)') " powerline/bindings/vim
call s:rcmd(' this_dir = os.path.dirname(this_dir)') " powerline/bindings
call s:rcmd(' this_dir = os.path.dirname(this_dir)') " powerline
call s:rcmd(' if os.path.basename(this_dir) != "powerline":')
call s:rcmd(' print("Check your installation:")')
call s:rcmd(' print("this script is not in powerline[/bindings/vim/plugin] directory,")')
call s:rcmd(' print("neither it is installed system-wide")')
call s:rcmd(' real_powerline_dir = os.path.realpath(powerline_dir)')
call s:rcmd(' real_this_dir = os.path.realpath(this_dir)')
call s:rcmd(' this_dir_par = os.path.dirname(real_this_dir)')
call s:rcmd(' powerline_appended_path = globals().get("powerline_appended_path")')
call s:rcmd(' if powerline_appended_path is not None and this_dir_par != powerline_appended_path:')
call s:rcmd(' print("Check your installation: this script is symlinked somewhere")')
call s:rcmd(' print("where powerline is not present: {0!r} != {1!r}.".format(')
call s:rcmd(' real_this_dir, powerline_appended_path))')
call s:rcmd(' elif real_powerline_dir != real_this_dir:')
call s:rcmd(' print("It appears that you have two powerline versions installed:")')
call s:rcmd(' print("one in " + real_powerline_dir + ", other in " + real_this_dir + ".")')
call s:rcmd(' print("You should remove one of this. Check out troubleshooting section,")')
call s:rcmd(' print("it contains some information about the alternatives.")')
call s:rcmd(' try:')
call s:rcmd(' from powerline.lint import check')
call s:rcmd(' except ImportError:')
call s:rcmd(' print("Failed to import powerline.lint.check, cannot run powerline-lint")')
call s:rcmd(' else:')
call s:rcmd(' try:')
call s:rcmd(' paths = powerline_instance.get_config_paths()')
call s:rcmd(' except NameError:')
call s:rcmd(' pass')
call s:rcmd(' else:')
call s:rcmd(' from powerline.lint.markedjson.error import echoerr')
call s:rcmd(' ee = lambda *args, **kwargs: echoerr(*args, stream=sys.stdout, **kwargs)')
call s:rcmd(' check(paths=paths, echoerr=ee, require_ext="vim")')
call s:rcmd('try:')
call s:rcmd(' powerline_troubleshoot()')
call s:rcmd('finally:')
call s:rcmd(' del powerline_troubleshoot')
execute s:pycmd s:pystr
unlet s:pystr
unlet s:pycmd

View File

@ -36,7 +36,7 @@ _powerline_init_tmux_support() {
}
chpwd_functions+=( _powerline_tmux_set_pwd )
trap "_powerline_tmux_set_columns" SIGWINCH
trap '_powerline_tmux_set_columns' SIGWINCH
_powerline_tmux_set_columns
_powerline_tmux_set_pwd
fi
@ -111,7 +111,7 @@ _powerline_setup_prompt() {
emulate -L zsh
for f in "${precmd_functions[@]}"; do
if [[ "$f" = "_powerline_set_jobnum" ]]; then
if [[ "$f" = '_powerline_set_jobnum' ]]; then
return
fi
done

View File

@ -24,25 +24,25 @@ def print_cycles(objects, outstream=sys.stdout, show_progress=False):
'''
def print_path(path):
for i, step in enumerate(path):
# next "wraps around"
# next “wraps around”
next = path[(i + 1) % len(path)]
outstream.write(" %s -- " % str(type(step)))
outstream.write(' %s -- ' % str(type(step)))
written = False
if isinstance(step, dict):
for key, val in step.items():
if val is next:
outstream.write("[%s]" % repr(key))
outstream.write('[%s]' % repr(key))
written = True
break
if key is next:
outstream.write("[key] = %s" % repr(val))
outstream.write('[key] = %s' % repr(val))
written = True
break
elif isinstance(step, (list, tuple)):
for i, item in enumerate(step):
if item is next:
outstream.write("[%d]" % i)
outstream.write('[%d]' % i)
written = True
elif getattr(type(step), '__getattribute__', None) in (object.__getattribute__, type.__getattribute__):
for attr in chain(dir(step), getattr(step, '__dict__', ())):
@ -55,18 +55,18 @@ def print_cycles(objects, outstream=sys.stdout, show_progress=False):
break
if not written:
outstream.write(repr(step))
outstream.write(" ->\n")
outstream.write("\n")
outstream.write(' ->\n')
outstream.write('\n')
def recurse(obj, start, all, current_path):
if show_progress:
outstream.write("%d\r" % len(all))
outstream.write('%d\r' % len(all))
all[id(obj)] = None
referents = gc.get_referents(obj)
for referent in referents:
# If we've found our way back to the start, this is
# If weve found our way back to the start, this is
# a cycle, so print it out
if referent is start:
try:
@ -78,13 +78,13 @@ def print_cycles(objects, outstream=sys.stdout, show_progress=False):
outstream.write('Cyclic reference: %i\n' % id(referent))
print_path(current_path)
# Don't go back through the original list of objects, or
# Dont go back through the original list of objects, or
# through temporary references to the object, since those
# are just an artifact of the cycle detector itself.
elif referent is objects or isinstance(referent, FrameType):
continue
# We haven't seen this object before, so recurse
# We havent seen this object before, so recurse
elif id(referent) not in all:
recurse(referent, start, all, current_path + (obj,))

View File

@ -41,27 +41,27 @@ def load_inotify():
if not name:
raise INotifyError('Cannot find C library')
libc = ctypes.CDLL(name, use_errno=True)
for function in ("inotify_add_watch", "inotify_init1", "inotify_rm_watch"):
for function in ('inotify_add_watch', 'inotify_init1', 'inotify_rm_watch'):
if not hasattr(libc, function):
raise INotifyError('libc is too old')
# inotify_init1()
prototype = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, use_errno=True)
init1 = prototype(('inotify_init1', libc), ((1, "flags", 0),))
init1 = prototype(('inotify_init1', libc), ((1, 'flags', 0),))
# inotify_add_watch()
prototype = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_char_p, ctypes.c_uint32, use_errno=True)
add_watch = prototype(('inotify_add_watch', libc), (
(1, "fd"), (1, "pathname"), (1, "mask")))
(1, 'fd'), (1, 'pathname'), (1, 'mask')))
# inotify_rm_watch()
prototype = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_int, use_errno=True)
rm_watch = prototype(('inotify_rm_watch', libc), (
(1, "fd"), (1, "wd")))
(1, 'fd'), (1, 'wd')))
# read()
prototype = ctypes.CFUNCTYPE(ctypes.c_ssize_t, ctypes.c_int, ctypes.c_void_p, ctypes.c_size_t, use_errno=True)
read = prototype(('read', libc), (
(1, "fd"), (1, "buf"), (1, "count")))
(1, 'fd'), (1, 'buf'), (1, 'count')))
_inotify = (init1, add_watch, rm_watch, read)
return _inotify

View File

@ -66,15 +66,14 @@ except ImportError:
# shutil.which was added in python-3.3. Here is what was added:
# Lib/shutil.py, commit 5abe28a9c8fe701ba19b1db5190863384e96c798
def which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""Given a command, mode, and a PATH string, return the path which
'''Given a command, mode, and a PATH string, return the path which
conforms to the given mode on the PATH, or None if there is no such
file.
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
of os.environ.get("PATH"), or can be overridden with a custom search
``mode`` defaults to os.F_OK | os.X_OK. ``path`` defaults to the result
of ``os.environ.get('PATH')``, or can be overridden with a custom search
path.
"""
'''
# Check that a given file can be accessed with the correct mode.
# Additionally check that `file` is not a directory, as on Windows
# directories pass the os.access check.
@ -85,7 +84,7 @@ except ImportError:
and not os.path.isdir(fn)
)
# If we're given a path with a directory part, look it up directly rather
# If were given a path with a directory part, look it up directly rather
# than referring to PATH directories. This includes checking relative to the
# current directory, e.g. ./script
if os.path.dirname(cmd):
@ -94,20 +93,20 @@ except ImportError:
return None
if path is None:
path = os.environ.get("PATH", os.defpath)
path = os.environ.get('PATH', os.defpath)
if not path:
return None
path = path.split(os.pathsep)
if sys.platform == "win32":
if sys.platform == 'win32':
# The current directory takes precedence on Windows.
if os.curdir not in path:
path.insert(0, os.curdir)
# PATHEXT is necessary to check on Windows.
pathext = os.environ.get("PATHEXT", "").split(os.pathsep)
pathext = os.environ.get('PATHEXT', '').split(os.pathsep)
# See if the given file matches any of the expected path extensions.
# This will allow us to short circuit when given "python.exe".
# This will allow us to short circuit when given 'python.exe'.
# If it does match, only test that one, otherwise we have to try
# others.
if any(cmd.lower().endswith(ext.lower()) for ext in pathext):
@ -115,7 +114,7 @@ except ImportError:
else:
files = [cmd + ext for ext in pathext]
else:
# On other platforms you don't have things like PATHEXT to tell you
# On other platforms you dont have things like PATHEXT to tell you
# what file suffixes are executable, so just pass on cmd as-is.
files = [cmd]

View File

@ -102,7 +102,7 @@ class ThreadedSegment(Segment, MultiRunnedThread):
def shutdown(self):
self.shutdown_event.set()
if self.daemon and self.is_alive():
# Give the worker thread a chance to shutdown, but don't block for
# Give the worker thread a chance to shutdown, but dont block for
# too long
self.join(0.01)

View File

@ -252,7 +252,7 @@ def debug():
'''Test run guess(), repo.branch() and repo.status()
To use::
python -c "from powerline.lib.vcs import debug; debug()" some_file_to_watch.
python -c 'from powerline.lib.vcs import debug; debug()' some_file_to_watch.
'''
import sys
dest = sys.argv[-1]

View File

@ -50,8 +50,8 @@ class Repository(object):
Without file argument: returns status of the repository:
:"D?": dirty (tracked modified files: added, removed, deleted, modified),
:"?U": untracked-dirty (added, but not tracked files)
:'D?': dirty (tracked modified files: added, removed, deleted, modified),
:'?U': untracked-dirty (added, but not tracked files)
:None: clean (status is empty)
With file argument: returns status of this file: The status codes are

View File

@ -64,13 +64,13 @@ class GitRepository(object):
:None: repository clean
With file argument: returns status of this file. Output is
equivalent to the first two columns of "git status --porcelain"
equivalent to the first two columns of ``git status --porcelain``
(except for merge statuses as they are not supported by libgit2).
'''
if path:
gitd = git_directory(self.directory)
# We need HEAD as without it using fugitive to commit causes the
# current file's status (and only the current file) to not be updated
# current files status (and only the current file) to not be updated
# for some reason I cannot be bothered to figure out.
return get_file_status(
directory=self.directory,

View File

@ -41,13 +41,13 @@ class Repository(object):
Without file argument: returns status of the repository:
:"D?": dirty (tracked modified files: added, removed, deleted, modified),
:"?U": untracked-dirty (added, but not tracked files)
:'D?': dirty (tracked modified files: added, removed, deleted, modified),
:'?U': untracked-dirty (added, but not tracked files)
:None: clean (status is empty)
With file argument: returns status of this file: "M"odified, "A"dded,
"R"emoved, "D"eleted (removed from filesystem, but still tracked),
"U"nknown, "I"gnored, (None)Clean.
With file argument: returns status of this file: `M`odified, `A`dded,
`R`emoved, `D`eleted (removed from filesystem, but still tracked),
`U`nknown, `I`gnored, (None)Clean.
'''
if path:
return get_file_status(

View File

@ -75,7 +75,7 @@ def check_matcher_func(ext, match_name, data, context, echoerr):
if not callable(func):
echoerr(context='Error while loading matcher functions',
problem='loaded "function" {0} is not callable'.format(match_function),
problem='loaded “function” {0} is not callable'.format(match_function),
problem_mark=match_name.mark)
return True, False, True

View File

@ -39,7 +39,7 @@ def import_function(function_type, name, data, context, echoerr, module):
if not callable(func):
echoerr(context='Error while checking segments (key {key})'.format(key=context.key),
context_mark=name.mark,
problem='imported "function" {0} from module {1} is not callable'.format(name, module),
problem='imported “function” {0} from module {1} is not callable'.format(name, module),
problem_mark=module.mark)
return None

View File

@ -5,10 +5,12 @@ from powerline.lint.markedjson.loader import Loader
def load(stream, Loader=Loader):
"""
Parse the first YAML document in a stream
and produce the corresponding Python object.
"""
'''Parse JSON value and produce the corresponding Python object
:return:
(hadproblem, object) where first argument is true if there were errors
during loading JSON stream and second is the corresponding JSON object.
'''
loader = Loader(stream)
try:
r = loader.get_single_data()

View File

@ -43,9 +43,9 @@ class Composer:
if not self.check_event(events.StreamEndEvent):
event = self.get_event()
raise ComposerError(
"expected a single document in the stream",
'expected a single document in the stream',
document.start_mark,
"but found another document",
'but found another document',
event.start_mark
)
@ -109,8 +109,8 @@ class Composer:
# key_event = self.peek_event()
item_key = self.compose_node(node, None)
# if item_key in node.value:
# raise ComposerError("while composing a mapping", start_event.start_mark,
# "found duplicate key", key_event.start_mark)
# raise ComposerError('while composing a mapping', start_event.start_mark,
# 'found duplicate key', key_event.start_mark)
item_value = self.compose_node(node, item_key)
# node.value[item_key] = item_value
node.value.append((item_key, item_value))

View File

@ -94,7 +94,7 @@ class BaseConstructor:
if not isinstance(node, nodes.ScalarNode):
raise ConstructorError(
None, None,
"expected a scalar node, but found %s" % node.id,
'expected a scalar node, but found %s' % node.id,
node.start_mark
)
return node.value
@ -103,7 +103,7 @@ class BaseConstructor:
if not isinstance(node, nodes.SequenceNode):
raise ConstructorError(
None, None,
"expected a sequence node, but found %s" % node.id,
'expected a sequence node, but found %s' % node.id,
node.start_mark
)
return [

View File

@ -57,10 +57,10 @@ class Mark:
def __str__(self):
snippet = self.get_snippet()
where = (" in \"%s\", line %d, column %d" % (
where = (' in "%s", line %d, column %d' % (
self.name, self.line + 1, self.column + 1))
if snippet is not None:
where += ":\n" + snippet
where += ':\n' + snippet
if type(where) is str:
return where
else:

View File

@ -88,7 +88,7 @@ class Parser:
token = self.peek_token()
self.echoerr(
None, None,
("expected '<stream end>', but found %r" % token.id), token.start_mark
('expected \'<stream end>\', but found %r' % token.id), token.start_mark
)
return events.StreamEndEvent(token.start_mark, token.end_mark)
else:
@ -141,8 +141,8 @@ class Parser:
else:
token = self.peek_token()
raise ParserError(
"while parsing a flow node", start_mark,
"expected the node content, but found %r" % token.id,
'while parsing a flow node', start_mark,
'expected the node content, but found %r' % token.id,
token.start_mark
)
return event
@ -160,14 +160,14 @@ class Parser:
if self.check_token(tokens.FlowSequenceEndToken):
token = self.peek_token()
self.echoerr(
"While parsing a flow sequence", self.marks[-1],
("expected sequence value, but got %r" % token.id), token.start_mark
'While parsing a flow sequence', self.marks[-1],
('expected sequence value, but got %r' % token.id), token.start_mark
)
else:
token = self.peek_token()
raise ParserError(
"while parsing a flow sequence", self.marks[-1],
("expected ',' or ']', but got %r" % token.id), token.start_mark
'while parsing a flow sequence', self.marks[-1],
('expected \',\' or \']\', but got %r' % token.id), token.start_mark
)
if not self.check_token(tokens.FlowSequenceEndToken):
@ -197,14 +197,14 @@ class Parser:
if self.check_token(tokens.FlowMappingEndToken):
token = self.peek_token()
self.echoerr(
"While parsing a flow mapping", self.marks[-1],
("expected mapping key, but got %r" % token.id), token.start_mark
'While parsing a flow mapping', self.marks[-1],
('expected mapping key, but got %r' % token.id), token.start_mark
)
else:
token = self.peek_token()
raise ParserError(
"while parsing a flow mapping", self.marks[-1],
("expected ',' or '}', but got %r" % token.id), token.start_mark
'while parsing a flow mapping', self.marks[-1],
('expected \',\' or \'}\', but got %r' % token.id), token.start_mark
)
if self.check_token(tokens.KeyToken):
token = self.get_token()
@ -214,8 +214,8 @@ class Parser:
else:
token = self.peek_token()
raise ParserError(
"while parsing a flow mapping", self.marks[-1],
("expected value, but got %r" % token.id), token.start_mark
'while parsing a flow mapping', self.marks[-1],
('expected value, but got %r' % token.id), token.start_mark
)
elif not self.check_token(tokens.FlowMappingEndToken):
token = self.peek_token()
@ -226,14 +226,14 @@ class Parser:
if expect_key:
raise ParserError(
"while parsing a flow mapping", self.marks[-1],
("expected string key, but got %r" % token.id), token.start_mark
'while parsing a flow mapping', self.marks[-1],
('expected string key, but got %r' % token.id), token.start_mark
)
else:
token = self.peek_token()
raise ParserError(
"while parsing a flow mapping", self.marks[-1],
("expected ':', but got %r" % token.id), token.start_mark
'while parsing a flow mapping', self.marks[-1],
('expected \':\', but got %r' % token.id), token.start_mark
)
token = self.get_token()
event = events.MappingEndEvent(token.start_mark, token.end_mark)
@ -250,6 +250,6 @@ class Parser:
token = self.peek_token()
raise ParserError(
"while parsing a flow mapping", self.marks[-1],
("expected mapping value, but got %r" % token.id), token.start_mark
'while parsing a flow mapping', self.marks[-1],
('expected mapping value, but got %r' % token.id), token.start_mark
)

View File

@ -7,7 +7,7 @@ from powerline.lint.markedjson.error import MarkedError, Mark, NON_PRINTABLE
from powerline.lib.unicode import unicode
# This module contains abstractions for the input stream. You don't have to
# This module contains abstractions for the input stream. You dont have to
# looks further, there are no pretty code.
@ -24,7 +24,7 @@ class Reader(object):
# Reader accepts
# - a file-like object with its `read` method returning `str`,
# Yeah, it's ugly and slow.
# Yeah, its ugly and slow.
def __init__(self, stream):
self.name = None
self.stream = None

View File

@ -39,7 +39,7 @@ class SimpleKey:
class Scanner:
def __init__(self):
"""Initialize the scanner."""
'''Initialize the scanner.'''
# It is assumed that Scanner and Reader will have a common descendant.
# Reader do the dirty work of checking for BOM and converting the
# input data to Unicode. It also adds NUL to the end.
@ -168,17 +168,17 @@ class Scanner:
return self.fetch_value()
# Is it a double quoted scalar?
if ch == '\"':
if ch == '"':
return self.fetch_double()
# It must be a plain scalar then.
if self.check_plain():
return self.fetch_plain()
# No? It's an error. Let's produce a nice error message.
# No? Its an error. Lets produce a nice error message.
raise ScannerError(
"while scanning for the next token", None,
"found character %r that cannot start any token" % ch,
'while scanning for the next token', None,
'found character %r that cannot start any token' % ch,
self.get_mark()
)
@ -186,7 +186,7 @@ class Scanner:
def next_possible_simple_key(self):
# Return the number of the nearest possible simple key. Actually we
# don't need to loop through the whole dictionary. We may replace it
# dont need to loop through the whole dictionary. We may replace it
# with the following code:
# if not self.possible_simple_keys:
# return None
@ -211,11 +211,11 @@ class Scanner:
del self.possible_simple_keys[level]
def save_possible_simple_key(self):
# The next token may start a simple key. We check if it's possible
# The next token may start a simple key. We check if its possible
# and save its position. This function is called for
# SCALAR(flow), '[', and '{'.
# The next token might be a simple key. Let's save it's number and
# The next token might be a simple key. Lets save its number and
# position.
if self.allow_simple_key:
self.remove_possible_simple_key()
@ -364,7 +364,7 @@ class Scanner:
def scan_flow_scalar(self):
# See the specification for details.
# Note that we loose indentation rules for quoted scalars. Quoted
# scalars don't need to adhere indentation because " and ' clearly
# scalars dont need to adhere indentation because " and ' clearly
# mark the beginning and the end of them. Therefore we are less
# restrictive then the specification requires. We only need to check
# that document separators are not included in scalars.
@ -386,7 +386,7 @@ class Scanner:
'n': '\x0A',
'f': '\x0C',
'r': '\x0D',
'\"': '\"',
'"': '\"',
'\\': '\\',
}
@ -417,8 +417,8 @@ class Scanner:
for k in range(length):
if self.peek(k) not in '0123456789ABCDEFabcdef':
raise ScannerError(
"while scanning a double-quoted scalar", start_mark,
"expected escape sequence of %d hexdecimal numbers, but found %r" % (
'while scanning a double-quoted scalar', start_mark,
'expected escape sequence of %d hexdecimal numbers, but found %r' % (
length, self.peek(k)),
self.get_mark()
)
@ -427,8 +427,8 @@ class Scanner:
self.forward(length)
else:
raise ScannerError(
"while scanning a double-quoted scalar", start_mark,
("found unknown escape character %r" % ch), self.get_mark()
'while scanning a double-quoted scalar', start_mark,
('found unknown escape character %r' % ch), self.get_mark()
)
else:
return chunks
@ -444,13 +444,13 @@ class Scanner:
ch = self.peek()
if ch == '\0':
raise ScannerError(
"while scanning a quoted scalar", start_mark,
"found unexpected end of stream", self.get_mark()
'while scanning a quoted scalar', start_mark,
'found unexpected end of stream', self.get_mark()
)
elif ch == '\n':
raise ScannerError(
"while scanning a quoted scalar", start_mark,
"found unexpected line end", self.get_mark()
'while scanning a quoted scalar', start_mark,
'found unexpected line end', self.get_mark()
)
else:
chunks.append(whitespaces)

View File

@ -382,7 +382,7 @@ class Spec(object):
:param function msg_func:
Function that should accept checked value and return message that
describes the problem with this value. Default value will emit
something like length of ["foo", "bar"] is not greater then 10.
something like length of ['foo', 'bar'] is not greater then 10.
:return: self.
'''
@ -560,7 +560,7 @@ class Spec(object):
:param function msg_func:
Function that should accept checked value and return message that
describes the problem with this value. Default value will emit
something like "xyz" must be one of {"abc", "def", "ghi"}.
something like "xyz" must be one of {'abc', 'def', 'ghi'}.
:return: self.
'''

View File

@ -248,7 +248,7 @@ class Renderer(object):
current_width = 0
if not width:
# No width specified, so we don't need to crop or pad anything
# No width specified, so we dont need to crop or pad anything
if output_width:
current_width = self._render_length(theme, segments, self.compute_divider_widths(theme))
return construct_returned_value(''.join([

View File

@ -14,24 +14,24 @@ class I3barRenderer(Renderer):
@staticmethod
def hlstyle(*args, **kwargs):
# We don't need to explicitly reset attributes, so skip those calls
# We dont need to explicitly reset attributes, so skip those calls
return ''
def hl(self, contents, fg=None, bg=None, attr=None):
segment = {
"full_text": contents,
"separator": False,
"separator_block_width": 0, # no seperators
'full_text': contents,
'separator': False,
'separator_block_width': 0, # no seperators
}
if fg is not None:
if fg is not False and fg[1] is not False:
segment['color'] = "#{0:06x}".format(fg[1])
segment['color'] = '#{0:06x}'.format(fg[1])
if bg is not None:
if bg is not False and bg[1] is not False:
segment['background_color'] = "#{0:06x}".format(bg[1])
# i3bar "pseudo json" requires one line at a time
return json.dumps(segment) + ",\n"
segment['background_color'] = '#{0:06x}'.format(bg[1])
# i3bar “pseudo json” requires one line at a time
return json.dumps(segment) + ',\n'
renderer = I3barRenderer

View File

@ -12,7 +12,7 @@ class PangoMarkupRenderer(Renderer):
@staticmethod
def hlstyle(*args, **kwargs):
# We don't need to explicitly reset attributes, so skip those calls
# We dont need to explicitly reset attributes, so skip those calls
return ''
def hl(self, contents, fg=None, bg=None, attr=None):

View File

@ -82,7 +82,7 @@ class ShellRenderer(Renderer):
If an argument is None, the argument is ignored. If an argument is
False, the argument is reset to the terminal defaults. If an argument
is a valid color or attribute, it's added to the ANSI escape code.
is a valid color or attribute, its added to the ANSI escape code.
'''
ansi = [0]
if fg is not None:

View File

@ -13,7 +13,7 @@ class TmuxRenderer(Renderer):
def hlstyle(self, fg=None, bg=None, attr=None):
'''Highlight a segment.'''
# We don't need to explicitly reset attributes, so skip those calls
# We dont need to explicitly reset attributes, so skip those calls
if not attr and not bg and not fg:
return ''
tmux_attr = []

View File

@ -128,7 +128,7 @@ class VimRenderer(Renderer):
If an argument is None, the argument is ignored. If an argument is
False, the argument is reset to the terminal defaults. If an argument
is a valid color or attribute, it's added to the vim highlight group.
is a valid color or attribute, its added to the vim highlight group.
'''
# In order not to hit E541 two consequent identical highlighting
# specifiers may be squashed into one.
@ -137,7 +137,7 @@ class VimRenderer(Renderer):
return ''
self.prev_highlight = (fg, bg, attr)
# We don't need to explicitly reset attributes in vim, so skip those
# We dont need to explicitly reset attributes in vim, so skip those
# calls
if not attr and not bg and not fg:
return ''

View File

@ -101,7 +101,7 @@ class CwdSegment(Segment):
# user most probably deleted the directory
# this happens when removing files from Mercurial repos for example
pl.warn('Current directory not found')
return "[not found]"
return '[not found]'
else:
raise
if shorten_home:
@ -549,7 +549,7 @@ weather = with_docstring(WeatherSegment(),
'''Return weather from Yahoo! Weather.
Uses GeoIP lookup from http://freegeoip.net/ to automatically determine
your current location. This should be changed if you're in a VPN or if your
your current location. This should be changed if youre in a VPN or if your
IP address is registered at another location.
Returns a list of colorized icon and temperature segments depending on
@ -1060,7 +1060,7 @@ class NowPlayingSegment(Segment):
set ..
set n
For the information we are looking for we don't really care if we're on
For the information we are looking for we dont really care if were on
the tag level or the set level. The dictionary comprehension in this
method takes anything in ignore_levels and brings the key inside that
to the first level of the dictionary.

View File

@ -133,8 +133,8 @@ def visual_range(pl, segment_info, CTRL_V_text='{rows} x {vcols}', v_text_onelin
vcols Number of virtual columns in the selection
========= =============================================================
'''
sline, scol, soff = [int(v) for v in vim_funcs['getpos']("v")[1:]]
eline, ecol, eoff = [int(v) for v in vim_funcs['getpos'](".")[1:]]
sline, scol, soff = [int(v) for v in vim_funcs['getpos']('v')[1:]]
eline, ecol, eoff = [int(v) for v in vim_funcs['getpos']('.')[1:]]
svcol = vim_funcs['virtcol']([sline, scol, soff])
evcol = vim_funcs['virtcol']([eline, ecol, eoff])
rows = abs(eline - sline) + 1
@ -304,7 +304,7 @@ def file_size(pl, suffix='B', si_prefix=False):
string appended to the file size
:param bool si_prefix:
use SI prefix, e.g. MB instead of MiB
:return: file size or None if the file isn't saved or if the size is too big to fit in a number
:return: file size or None if the file isnt saved or if the size is too big to fit in a number
'''
# Note: returns file size in &encoding, not in &fileencoding. But returned
# size is updated immediately; and it is valid for any buffer

View File

@ -163,6 +163,6 @@ class Theme(object):
elif segment['align'] == 'c':
segment['contents'] = segment['contents'].center(segment['width'])
# We need to yield a copy of the segment, or else mode-dependent
# segment contents can't be cached correctly e.g. when caching
# segment contents cant be cached correctly e.g. when caching
# non-current window contents for vim statuslines
yield segment.copy()

View File

@ -148,7 +148,7 @@ class VimPowerline(Powerline):
try:
if (
bool(int(vim.eval("has('gui_running') && argc() == 0")))
bool(int(vim.eval('has(\'gui_running\') && argc() == 0')))
and not vim.current.buffer.name
and len(vim.windows) == 1
):

View File

@ -398,7 +398,7 @@ def main():
daemonize()
if use_filesystem:
# Create a locked pid file containing the daemon's PID
# Create a locked pid file containing the daemons PID
if lockpidfile() is None:
if not args.quiet:
sys.stderr.write(

View File

@ -79,7 +79,7 @@ setup(
author_email='kim.silkebaekken+vim@gmail.com',
url='https://github.com/Lokaltog/powerline',
license='MIT',
# XXX Python 3 doesn't allow compiled C files to be included in the scripts
# XXX Python 3 doesnt allow compiled C files to be included in the scripts
# list below. This is because Python 3 distutils tries to decode the file to
# ASCII, and fails when powerline-client is a binary.
#

View File

@ -33,7 +33,7 @@ class TestVimConfig(TestCase):
)
with open(os.path.join(cfg_path, 'config.json'), 'r') as f:
local_themes_raw = json.load(f)['ext']['vim']['local_themes']
# Don't run tests on external/plugin segments
# Dont run tests on external/plugin segments
local_themes = dict((k, v) for (k, v) in local_themes_raw.items())
self.assertEqual(len(buffers), len(local_themes) - 1)
outputs = {}