Commit Graph

53 Commits

Author SHA1 Message Date
ZyX 8d00ba781c Remove unneeded # NOQA comments
It appears that something has changed and it no longer complains about double
declaration in else or except blocks.
2014-09-01 00:25:24 +04:00
ZyX 06211cbe63 Unify imports
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

.
2014-09-01 00:25:24 +04:00
ZyX 0e98bc2d4f Fix style in a number of places
- Fixes lines where line with N tab indent is followed by a line with N+2 tab 
  indent or greater (most of such lines were already fixed in 
  ae92d83eae, but regex used there has one flow: 
  it does not catches lines where N=0 for which case first `\+` needs to be 
  replaced with `*`).
- Replace print(…, file=sys.stderr) with sys.stderr.write in powerline-daemon.
2014-08-31 21:29:03 +04:00
ZyX 7e7803f680 Make powerline-render respect user locale as well
Closes #1023
2014-08-27 22:38:52 +04:00
ZyX 70e7088b04 Do not replace ascii with UTF-8 in powerline-daemon and python client
Assuming ascii was expected to be used when LANG=C it did not work in any case:
in this case preferred encoding is “ANSI_X3.4-1968”. Same for
`sys.getfilesystemencoding()`.
2014-08-27 22:34:13 +04:00
ZyX d88d87f6af Do not make daemon output zero byte
This byte is useless and can be seen in zsh output (strange that it did not 
cause bugs so far, at least none I know about). It may have been needed if any 
client was supposed to hold connection with daemon for a few runs, but all 
current clients work in “request → output response → exit” fashion without 
caring about terminating newline and definitely without preserving connection to 
daemon accross runs.
2014-08-26 21:13:56 +04:00
ZyX 0232d3215b Add --socket argument to all clients
Makes it not needed to kill daemon for testing, but disables implicit
`powerline-config shell command` testing.
2014-08-23 15:19:00 +04:00
ZyX 74d147a0be Use `open` to open file descriptors in place of `file`
Reason: there is no `file()` in Python 3.

Fix was originally presented by @kovidgoyal in [3deb69][1], but I cannot
cherry-pick this commit, because its commit message is highly undescriptive.

Fixes #1008

[1]: 3deb6988c8
2014-08-23 04:34:44 +04:00
ZyX b8049fab87 Add ext.*.components configuration support
Also fixes various problems in shell bindings.

Closes #969
2014-08-10 16:26:22 +04:00
ZyX 203a374b54 Do not use argparge for parsing --env and --cwd
It took 2/3 of do_render call according to profiler. New variant takes only 1/6.

WARNING: This commit will break all powerline installations with running daemon
because it changes communication protocol. You must kill and restart all your
powerline daemons for powerline to function properly.

Highlight @kovidgoyal
2014-08-04 03:02:05 +04:00
ZyX cfb107724f Exclude renderer_arg from daemon powerline objects cache
It may easily change between runs from one client and only affects segment_info 
which is regenerated always.
2014-08-04 00:17:41 +04:00
ZyX 3d1f9bfbbd Allow multiple arguments to `powerline[-lint] --config_path` 2014-08-03 22:22:59 +04:00
ZyX ea7f3b6501 Add powerline-daemon --quiet 2014-08-02 22:20:06 +04:00
ZyX 9290c2a23b Make daemon work with aboveleft shell key 2014-08-02 21:31:01 +04:00
ZyX 05384e31e4 Add `powerline-config shell command` and use it in all shell bindings 2014-08-02 21:31:00 +04:00
ZyX 95dcef8bf8 Some style fixes 2014-08-02 21:30:51 +04:00
Kim Silkebækken a122e73b9b Add files from @kovidgoyal's powerline-daemon repo
Minor changes have been applied:

- Removed copyright info and GPL 3 license since Powerline is MIT (needs
  confirmation from kovidgoyal before merge)
- The `powerline-client` script is renamed to `powerline`, and calls the
  daemon or `powerline-render` (the previous `powerline`) to render
  a statusline
- Minor coding style corrections to match the rest of the project
- Python 3 support is removed for now due to setuptools failing with
  binary scripts

Todo:

- Automatically attempt to launch powerline-daemon the first time
  powerline is run if the daemon isn't already running?
- pip install -e fails with binary files (it appears that pip recodes
  the powerline binary to ASCII, the compiled powerline script must be
  copied manually to ~/.local/bin after pip install -e has been run)
2014-08-02 18:45:18 +04:00
ZyX 1447be1ddc Add missing imports in powerline-config
They matter when script is used without properly installing powerline, so that 
importing `powerline.bindings.config` does not work.
2014-07-23 01:47:46 +04:00
ZyX 44ce483ee5 Use powerline.shell.run_cmd to get tmux version
Closes #912
2014-07-10 21:27:42 +04:00
ZyX-I 828c953f84 Merge pull request #880 from ZyX-I/powerline-config-script
[RFC] Powerline config script
2014-06-25 21:58:04 +04:00
ZyX 61006d8fe1 Add support for above lines as described in #462
Support is not mirrored in shell bindings yet
2014-06-24 21:33:21 +04:00
ZyX 7b1d7bbb9e Use scripts/powerline-config to source tmux configuration
Ref #872
2014-05-24 13:45:21 +04:00
ZyX 25212a7dd6 Use os.path.realpath() before os.path.abspath()
Closes #454
Fixes #413
2014-02-16 01:25:10 +04:00
ZyX 8096f2e8e4 Also rename variables in python files 2014-01-30 08:46:22 +04:00
ZyX becc8ee59c Support zsh “modes” (different keymaps like when using vicmd/viins pair)
Fixes #508
2014-01-26 22:08:37 +04:00
ZyX b5f051f71c Fix powerline-lint tests
Some notes on the commit:

1. As external_ip and email_imap_alert segments seem to be removed corresponding
   segment_data keys also were removed.
2. Various files that import vim module now have the usual workaround that sets
   vim local to dummy object on error.
3. Syntastic check was failing because it did not specify which highlighting
   groups it uses in documentation. I made it specify them and also moved format
   strings to keywords. Same for some other plugin-local themes.
4. powerline-lint script got --debug argument. Pretty useless currently though:
   it only makes it output traceback for ImportError when failing to import
   module to stderr.
5. Moved themes/vim/plugin/*.json to themes/vim/plugin_*.json.
6. Fixed powerline-lint that ignored problems from values.
2013-11-03 01:48:16 +04:00
ZyX f83ca080ba Fix typo in scripts/powerline 2013-05-06 19:13:31 +04:00
ZyX 26ad068265 Fix tmux cwd segment
Fixes #467

Still needs colors for cwd:current_folder, cwd and cwd:divider
2013-05-02 15:19:56 +04:00
ZyX 4c426df5e0 Move --config and --theme_option processing to finish_args 2013-05-02 14:13:43 +04:00
ZyX b883ac6ee8 Use same modeline in scripts/* as in other files 2013-04-13 19:34:55 +04:00
ZyX 4d1dc0658b Remove unexistent kwargs 2013-04-01 00:01:51 +04:00
ZyX 3ebc16a48c Replace pl.environ/getcwd/home with segment_info 2013-03-30 21:55:00 +04:00
ZyX 80ddbfbf9a Split Powerline.__init__ into __init__ and create_renderer
Target: with long-living Powerline objects periodically reload configuration 
recreating renderer. Use file watchers to watch for configuration. Configuration 
should be able to be safely reloaded in non-blocking mode in a separate thread 
up to the time when it comes to recreating renderer.

This commit does not add anything that actually reloads the configuration, 
multiple runs of .create_renderer were not tested.
2013-03-25 18:24:16 +04:00
ZyX 7370876c35 Make scripts/powerline use os.environ['PWD'] for .getcwd() if present
Closes #330
2013-03-24 19:49:54 +04:00
ZyX b1f9edab4c Remove get_segment_info and passing segment_info through globals 2013-03-24 05:23:33 +04:00
ZyX b0495d028f Do not let daemon threads be stopped while being updated 2013-03-18 07:56:25 +04:00
ZyX d27f7a0411 Add most configuration checks
Changes:

- Add main configuration, colors.json, almost full themes and colorschemes
  checks
- Make powerline.lint.check return whether it had problems
- Make powerline-lint fail if .check reported problems
- Make tests run powerline-lint
- Add the script to the list of the installed scripts

Fixes #278
2013-03-11 19:17:18 +04:00
Kim Silkebækken 40fe38f641 Move argparser to powerline.shell so it can be re-used 2013-03-11 07:52:24 +01:00
Foo 43d9639534 Fix zsh/zpython issue 2013-02-24 22:23:43 +01:00
ZyX f211bb6c74 Add ability to override configuration options
Related changes:
- Moved all non-ASCII symbols into `segment_data`
- Added --config_path, replaced nargs='*' with better action='append'
- Added g:powerline_config_path vim option
- Added ipython overrides (via additional arguments to setup() or c.Powerline)

TODO: support for non-string scalars in vim overrides.

Fixes #231
2013-02-24 22:22:13 +01:00
ZyX d12299c18c Add a way to specify renderer options on command-line, added tmux_escape
Note: tmux escaping does not fix things, on my system it produces
![Gap between ... and directory name](http://img-fotki.yandex.ru/get/6439/9151298.2/0_93b4c_5d9a317f_orig.png)
Fixes #199
2013-02-11 07:15:46 +01:00
Kim Silkebækken 29793259e1 Improve argument handling in powerline script
Modules can now be any string, and an informative error message will be
written to sys.stdout if the module doesn't exist. The
`last_pipe_status` argument will also automatically be split into
a list.
2013-01-28 17:29:02 +01:00
Kim Silkebækken 7a1d7ecaf4 Add width argument to shell script 2013-01-28 07:40:42 +01:00
Kim Silkebækken 091400c84f Join tmux/prompt shell scripts into one common script 2013-01-28 07:16:55 +01:00
ZyX 17639a9e25 Add last_status and last_pipe_status segments 2013-01-28 06:52:10 +01:00
Kim Silkebækken f175a6babb Fix issue with $pipestatus
$pipestatus is a space-separated int list and not a single int.
2013-01-22 16:45:31 +01:00
Kim Silkebækken 30f98f6dc2 Add exit code/pipe status args in powerline-prompt
Refs #90.
2013-01-22 13:22:35 +01:00
Kim Silkebækken f800872c9e Default to no mode in renderer.render() method 2013-01-22 09:06:30 +01:00
Kim Silkebækken 2b0c01482b Improve side handling in prompt/tmux scripts 2013-01-22 09:04:57 +01:00
Kim Silkebækken 3ee6e55025 Handle Py2/3 Unicode differences when writing to stdout
Closes #94.
2013-01-22 08:05:37 +01:00