Commit Graph

62 Commits

Author SHA1 Message Date
ZyX 219b81d23d Fix tcsh escaping 2014-01-27 00:10:48 +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 9edee8ad11 Remove backslash escaping on zsh and fish 2014-01-26 21:44:32 +04:00
ZyX 693ba8a559 Use .copy() on character_translations before modifying 2014-01-26 21:00:22 +04:00
ZyX ecff281304 Handle non-printable characters properly
Fixes #723
2014-01-26 21:00:22 +04:00
ZyX ad35b48942 Add VimEnviron object 2013-05-19 13:17:59 +04:00
ZyX 9f20fb1f3f Move some functions from VimL to python code
Should be faster with new interfaces, but that is not the case

Should remove zero that can be viewed temporary in place of statusline in new 
windows

Target: ressurect setup function like source_plugin (but in place of sourcing 
something code is moved to python) to make it possible to do the following 
sequence:

1. Install powerline via pip
2. Add a line to the vimrc like

        py from powerline.vim import setup as setup_powerline; setup_powerline(); del setup_powerline

3. See new fancy statusline

Currently there are no convenient options to use powerline installed by pip in 
vim. powerline/bindings/vim/plugin/powerline.vim will do what it does: check for 
appropriate python versions available, fix sys.path and so on, but it won’t 
create autocommands, set options or define PowerlinePyeval function.

Note: may be rebased on top of the develop.
2013-05-19 13:17:58 +04:00
ZyX 495f87a527 Remove debugging lines 2013-05-02 16:06:52 +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
Kim Silkebækken 51a9bbdbce Merge remote-tracking branch 'zyx-i/ipython-shutdown' into develop 2013-04-08 11:38:04 +02:00
ZyX 8dcbb031aa Make IPython renderer shutdown properly 2013-04-07 13:19:20 +04:00
ZyX 66cdb36231 Use xml.sax.saxutils.escape in place of xmlrpclib.escape
The latter is not available in python 3
2013-04-07 04:42:36 +04:00
ZyX 3c613bc1b7 Use xmlrpclib.escape for escaping in PangoMarkupRenderer 2013-04-07 04:20:35 +04:00
ZyX 878255aff0 Make Tmux and PangoMarkup Renderers merge arguments like shell one
For PangoMarkup it is pretty useless currently (segment_info does not contain 
anything useful).

Note: this does its job by replacing default behavior.

Source of issue: previous default used either segment_info argument (containing 
{"args": args, "environ": os.environ}) or default segment_info, shell renderer 
merged default segment_info with .render() argument. Now segment_info is merged 
by default and old behavior moved to vim renderer which is the only one that is 
designed to use this.

Fixes #391
2013-04-03 23:09:40 +04:00
ZyX 3ebc16a48c Replace pl.environ/getcwd/home with segment_info 2013-03-30 21:55:00 +04:00
ZyX 854216810e Change spaces in vim renderer 2013-03-30 21:52:05 +04:00
ZyX 1351207462 Some fixes for flake8 2013-03-24 19:59:56 +04:00
ZyX ed435f8063 Add required pl argument to segments
Fixes #340
Ref #330
2013-03-24 19:44:01 +04:00
Kim Silkebækken 5caeac26bf Merge remote-tracking branch 'zyx-i/fix-356' into develop 2013-03-24 16:18:44 +01:00
ZyX 33592145ae Also fix VimRenderer.strwidth
Fixes #356
2013-03-24 05:56:55 +04:00
ZyX b517df774b Fix bytes handling on python3
Fixes #356
2013-03-24 05:45:52 +04:00
ZyX c4e5ff8b49 Added support for all powerline prompts (in2, out, rewrite)
Also fixed problem with prompt not really updating.

Fixes #141
2013-03-24 05:23:33 +04:00
ZyX 83ed36903c Fix bold attr that may leak into next segment 2013-03-24 05:23:33 +04:00
ZyX abe0b1a647 Add support for .startup and .shutdown methods 2013-03-15 19:31:08 +04:00
Kim Silkebækken 747c75c1c4 Merge remote-tracking branch 'zyx-i/fix-322' into develop 2013-03-15 14:15:26 +01:00
ZyX 6f3703e312 Improve ambiwidth handling, readd additional_escapes
Fixes #307
2013-03-12 13:11:59 +01:00
ZyX b2b05cb81c Removed underscore_to_camelcase
No need to bother both developers (that need to create class names compatible 
with file name, which is not obvious if not looking into main Powerline class) 
and computer (that needs to recompute class name each time) if it is possible to 
bother only developers (or only computer, but this contributes to higher startup 
times).

About not obvious: when you look into zsh_prompt.py and see only 
ZshPromptRenderer name you only think that powerline upstream is following 
strict code style. You don’t think there is a technical reason for such naming, 
like you don’t think there is technical reason for having blank lines. When you 
look into zsh_prompt.py and see `renderer = ZshPromptRenderer` it is obvious 
that there is technical reason for writing code this way because new variable is 
never used in the module itself.
2013-03-11 22:22:18 +04:00
ZyX 696478593d Move some functions out of classes
No need to have static methods that are not supposed to be overridden and that 
do not benefit from `self' argument they do not receive
2013-03-11 22:13:43 +04:00
ZyX 551a2685f4 Move add_local_theme and get_theme to vim renderer
In any case for all other extensions they are useless. (Except for ipython, but
it is TODO and I am not going to use matchers this way, simple dictionary
lookup is better in this case.)
2013-03-11 19:11:32 +04:00
Kim Silkebækken 111eaa27e8 Combine vim modelines and Python encoding declarations
Ref #314
2013-03-11 10:40:09 +01:00
Kim Silkebækken 6748701fcb Add vim modelines to all Python files
Added with `sed -i '2i# vim:fenc=utf-8:noet' `find -name '*.py'`` and
fixed in a couple of files without the UTF-8 encoding on top.

Ref #314
2013-03-11 08:11:25 +01:00
ZyX 2a39ed83d8 Use mode(1)
Otherwise all that fancy double-symbol modes are just not visible.
2013-03-03 21:03:19 +01:00
ZyX b8b0518e9b Replace 'NONE' with None for guifg/guibg.
No need in having string keys if we are in any case checking this for equality
later instead of embedding them as-is like cterm*
2013-02-24 22:22:24 +01:00
ZyX 2fa64c42d1 Move translation of modes into renderers/vim.py
Fixes #147
2013-02-24 15:29:31 +04:00
Kim Silkebækken 282cb43eef Fix various minor formatting issues
Closes #242.
2013-02-20 13:47:54 +01:00
ZyX e14f5e4208 Fix problem with wrong window ID/winnr after some window operations
Removed autocommands as well. Powerline() function is now responsible both for
displaying powerline and for updating statuslines. No cmdwin events not
triggered workaround nonsense anymore.

Fixes #237
Fixes #236
Fixes #222
Fixes #232
2013-02-20 07:34:36 +01:00
ZyX d638f1d6ea Remove non-current window caching
API changes done:
- memoize additional_key function now accepts all function arguments
- get_theme now receives matcher_info
- render now receives segment_info and matcher_info, but segments and themes
  were removed
- due to very different ways of obtaining column information col_current
  splitted back to col_current and virtcol_current. The former should be false
  in case of horizontal scrollbind (when &scrollopt contains hor)
- added requires_segment_info decorator for convenience

Other changes:
- removed all vim function calls that were possible to remove
- removed direct vim.eval calls
2013-02-12 10:33:58 +01:00
ZyX 28547930cc Add screen_escape option
Refs #199.
2013-02-11 07:15:51 +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
ZyX 52635d05ae Add support for italic and underline attributes in shell renderer 2013-02-11 07:15:19 +01:00
ZyX e18665c5fe Purge out constants from classes, lowercase TERM_24_BIT
Remove recursive import as well
2013-02-11 07:43:13 +04:00
ZyX 9a0b970b07 Clear highlight groups on ColorScheme event
Closes #196
Fixes #153
Fixes #194
2013-02-10 13:54:44 +01:00
ZyX 4202bd2ee6 Use escape_hl_* variables for prompts deriving from ShellRenderer
This is faster then super() calls and also more convenient.
Fixes #142 just as well
Conflicts:
	powerline/renderers/bash_prompt.py
	powerline/renderers/ipython.py
	powerline/renderers/shell.py
	powerline/renderers/zsh_prompt.py
2013-02-10 13:54:15 +01:00
ZyX a6b3bc93ab Don’t mess with hl()+contents
What does hl() mean? It looks like “highlight an empty string”, but is actually
“reset highlight style”. In addition if you are writing “hl()” function for new
renderer you need to care about “contents” variable (in two places!: None for
super() call and (contents or u'') after super() call) though function is
actually doing nothing with it. It is just inconvenient.
2013-02-10 13:53:18 +01:00
ZyX 2e5b9383a5 Properly escape color codes in bash
Closes #177.
Closes #179.
2013-02-06 09:15:13 +01:00
ZyX 7a25ab1d53 Fix “'NoneType' object is not iterable” error
Fixes #158
2013-02-04 00:19:04 +04:00
Kim Silkebækken bfdb7f8028 Refactor segment rendering
This commit introduces the following changes to themes and segment
rendering:

- Spacer segments are now regular string/function type segments with
  "width": "auto" in the themes.
- The "rjust"/"ljust" properties have been replaced by the "width"
  option combined with a new "align" option.
- Renderer._render_segments() is now a generator which renders each
  segment separately, and assigns the rendered contents to
  "_rendered_hl" and "_rendered_raw" in the segment dict.
- Renderer.render() returns the segments by joining the "_rendered_hl"
  values for each segment.
- Spacer segment widths are calculated in the render() method, and
  assigned to "_space_left" and "_space_right" in the segment dict.
  These spaces are then applied in Renderer._render_segments().
- All space characters are converted to no-break spaces (U+00A0) in the
  "_rendered_hl" property.

Refs #113.
Refs #154.
2013-02-01 16:22:08 +01:00
Kim Silkebækken fb7a0d46e6 Rename AwesomeRenderer to PangoMarkupRenderer
Awesome WM uses the Pango Text Attribute Markup Language
(http://developer.gnome.org/pango/stable/PangoMarkupFormat.html), and
since other applications and window managers may use the same markup
language it's better to have a common renderer for this markup language.
2013-01-30 09:54:31 +01:00
Kim Silkebækken bda7384aa7 Add Awesome WM widget 2013-01-28 12:30:11 +01:00
Kim Silkebækken 1e4c3612ee Pass segment contents to renderer hl() methods
This allows the hl() methods to wrap highlighting code *around* the
segment contents, this is required for e.g. Pango markup in Awesome
statuslines (segments must be wrapped in <span ...>...</span> tags).
2013-01-28 11:51:26 +01:00