Commit Graph

97 Commits

Author SHA1 Message Date
ZyX b845cc25b4 Fix tests on python-2.6
csv module does not appear to work will with multiline strings in csv, 
especially incomplete.
2014-11-10 01:08:37 +03:00
ZyX d392cf3322 Add support for csv files
Equivalent to airline csv Christian Brabandt plugin integration, but uses Python
own facilities.

Note: filetype detection is out of the scope of the powerline responsibilities.
      CSV is supported by powerline, but only as long as filetype detection is
      done by Vim correctly. By default CSV files are neither detected nor
      highlighted.

Some known differences between powerline code and @chrisbra plugin with
corresponding airline integration:

1. Detection work differently. I cannot say which is better because I have not
   tested it much, but it is definitely different.
2. My variant is able to detect whether there is (no) header. (Of course,
   relying on Python code.) Airline is using a setting. (Both do not allow
   manual per-filetype setting.) Of course, user can force either variant (no
   headers at all or headers always).
3. My variant makes it possible to configure header output format, including
   truncating it at 15 characters (the default).
4. CSV plugin does not work with multiline CSV items (in some dialects one can
   use code like `abc;"I<CR>am<CR>multiline<CR>string"`). See `:h csv-column` on
   how to fix this if possible (will require also changing `<sid>WColumn`
   function because currently it only works with one line).
5. AFAIK Python does not such a thing as “fixed width CSV”. Thus I do not work
   with this, but CSV plugin does. Not sure whether it is different with
   space-separated CSV files though.
2014-11-09 23:54:49 +03:00
ZyX d1ac624c7f Fix broken tests 2014-10-12 00:36:53 +04:00
ZyX 8b1a502f0d Add ignore_statuses option to branch segments
Closes #1080
2014-09-26 00:34:32 +04:00
ZyX 3f2aabb77b Refactor Vim and common branch segments to share code 2014-09-26 00:20:58 +04:00
ZyX fcf5702b7f Use pwd.getpwuid or getpass.getuser to get current user name 2014-09-21 15:26:27 +04:00
ZyX bb5977c8eb Fix tests with <psutil-2.0 2014-09-21 15:11:01 +04:00
ZyX 26365a9620 Split powerline.segments.common into a number of modules
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
2014-09-21 02:00:37 +04:00
ZyX 48e06cbf9e Refactor weather segment to use KwThreaded segment
Problem: weather segment used to set its state (i.e. user location) once and 
remember it forever.
2014-09-20 13:52:24 +04:00
ZyX e7d0c8368e Add code that will return bytes() from vim functions in Python-3 2014-09-14 17:21:11 +04:00
ZyX 667cd4bce5 Assume highlight group is always an iterable
According to the documentation and linter `'highlight_group': 'string'` was not
correct even at the current stage, but it worked. This commit fixes this
situation.
2014-09-05 20:00:20 +04:00
ZyX 54e12b1515 Use new functionality to replace tabbuflister and single_tab segment 2014-09-05 20:00:19 +04:00
ZyX c5ca1b23c4 Use class setup/teardown methods to use vim module mock 2014-09-05 20:00:19 +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 849c34ea72 Replace all unicode defaults with defaults from ASCII theme
Closes #1034
2014-08-29 20:47:44 +04:00
ZyX e4565dd3e8 Make attached_clients segment use provided tmux bindings 2014-08-24 21:07:19 +04:00
Matthew M. Keeler 88515ab472 Show Count of Attached Tmux Sessions
- 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 #661
Closes #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
2014-08-24 20:56:59 +04:00
ZyX d7a674deaa Add support for shell-specific path shortening
Fixes #502
2014-08-24 19:54:28 +04:00
ZyX 04c0030fe1 Refactor cwd segment into a class and add shorten_home argument 2014-08-24 19:50:54 +04:00
ZyX 173c4d6e76 Add internal_ip segment
Closes #857
2014-08-24 01:20:25 +04:00
ZyX da48e9d84e Add tests 2014-08-22 09:08:58 +04:00
ZyX ae92d83eae Fix powerline style
Specifically I searched for all lines that are more then one tab off compared to 
the previous line with

    BufGrep /\(^\t\+\)\S.*\n\1\t\t\+/

and replaced them with something more appropriate. Most of time this resulted in 
a few more newlines, but there are cases when I used mixed tabs/spaces 
indentation+alignment.
2014-08-15 20:58:19 +04:00
ZyX 7882583dcb Update continuation segment tests 2014-08-12 08:16:26 +04:00
ZyX 117661e186 Add tests for visual_range 2014-08-05 22:49:53 +04:00
ZyX 74a3c9a0ca Add file_scheme segment
Fixes #207
2014-08-03 23:58:34 +04:00
ZyX 120a9cc8fa Add winnr segment
Closes #705
2014-08-03 13:25:58 +04:00
ZyX f877516e54 Add bufnr segment
Ref #705
2014-08-03 13:25:58 +04:00
ZyX 6cf0c485fa Add single_tab segment 2014-08-03 12:53:53 +04:00
ZyX 85f252652e Add tabnr segment 2014-08-03 12:53:53 +04:00
Collin Grady f615d85172 Added line_count segment for vim.
Returns total number of lines in current buffer.

Addresses #556
2014-08-03 05:54:57 +00:00
ZyX 9e8c115eea Add trailing whitespace segment
Note: by default this segment is disabled. Until #923 it may only be enabled by
copying the whole file and changing "enabled" to "true". After #923 it may be
enabled by having `~/.config/powerline/themes/vim/default.json` with the
following contents:

    {
        "segment_data": {
            "trailing_whitespace": {
                "display": true
            }
        }
    }

Fixes #388
2014-08-02 18:39:16 +04:00
ZyX 3ac75eeca6 Add window_title tests 2014-07-10 22:33:10 +04:00
ZyX a0a5b44173 Use battery_full and battery_empty for displaying hearts
Red hearts for battery full are still more optimal in case white hearts are for
empty (though I do not understand why they have to be red). Cannot agree about
per cents though: red is better for empty then white is if there are no related
parts to compare.
2014-07-10 18:35:24 +04:00
ZyX 39316c429b Reverse the gradient in battery segment
Closes #910
2014-07-10 18:35:23 +04:00
ZyX c570a98065 Add watcher option
Ref #818
2014-06-28 21:10:15 +04:00
ZyX e51d7a9dd3 Add fuzzy_time(unicode_text) argument 2014-03-13 20:54:07 +04:00
ZyX 3f1e621f1d Add ellipsis argument to cwd segment 2014-03-13 20:47:06 +04:00
ZyX c3b4654bfb Fix flake8 complaints 2014-03-13 20:41:54 +04:00
ZyX 55858e1a9d Fix tests for new psutil 2014-03-13 20:05:52 +04:00
ZyX 8718bf76ce Add tests for continuation segment 2014-02-16 20:41:01 +04:00
ZyX 66d98e7def Improved battery segment:
- Ignore `steps` if gamify is False.
- Add `full_heart` and `empty_heart` keywords.
- Document `format` keyword.
- Replace `draw_soft_divider` with `draw_inner_divider`.
2014-02-09 13:44:06 +04:00
Joshua Perry c4fb09a418 Update tests to support parameter on _get_capacity() 2014-02-09 02:36:19 +04:00
ZyX e7820efe56 Make powerline work with non-utf filenames
Fixes #281
2014-01-26 21:01:19 +04:00
ZyX 64e23d346e Merge branch 'patch-1' into develop
Fixes #724
2014-01-23 18:45:46 +04:00
ZyX b75d2b531f Add tests 2014-01-23 18:45:09 +04:00
EinfachToll 10cd7b78f0 More test cases for position segment 2014-01-23 09:23:53 +01:00
EinfachToll 90132fe386 Small fixes for new position segment
- use vim_funcs
- use a dictionary instead of a tuple for translation strings
2014-01-21 15:48:05 +01:00
EinfachToll 7aa978fdba New fixed segment showing position of current view
Solves #539
Fixed version of #540 and #579
Works now for split windows and wrapped lines.
2014-01-15 10:32:04 +01:00
Kenny Root c33d56e73c Add arg to optionally suppress user segment
This adds the option to common.user to suppress display if the username
matches the given string in the new "hide_user" argument.
2014-01-13 23:57:41 -08:00
Kenny Root 54e7fe91ba Fix common.user test
The username was being cached from previous tests, so clear it before
running this test.
2014-01-10 14:15:54 -08:00