Commit Graph

23 Commits

Author SHA1 Message Date
Kim Silkebækken 254473419b Remove unnecessary init file 2012-12-17 15:01:56 +01:00
Kim Silkebækken f074c1fb29 Move the vim example to a separate plugin folder
When Powerline is installed as a package in the system-wide
site-packages folder it can easily be enabled by adding a simple python
statement to the user's vimrc file.

Otherwise it can be added by doing a :source
path/to/plugin/vim/powerline.vim in vimrc, but the other way of doing it
works without specifying the full path as long as Powerline is installed
somewhere in sys.path.
2012-12-13 22:01:33 +01:00
ZyX 175fb1b58e Don’t change windows using windo, use setwinvar() instead 2012-12-13 21:09:41 +04:00
Kim Silkebækken c5555d5637 Update all examples to work with the latest changes 2012-12-13 14:59:16 +01:00
Kim Silkebækken dd4c90fc68 Cache and retrieve segment contents for non-current vim windows
This resolves the issue with non-current windows using the contents of
the currently selected window.
2012-12-13 13:16:09 +01:00
Kim Silkebækken 04993264e4 Move more vim stuff into the renderer 2012-12-12 18:15:21 +01:00
Kim Silkebækken 8960d15cf5 Update vim statusline example
The statusline example mostly works now, even with different modes. The
main problem is still non-current windows, which receive the contents of
the currently active window for most segments.
2012-12-12 12:38:01 +01:00
Kim Silkebækken 240bd6217d Remove powerline render() method 2012-12-10 20:17:44 +01:00
Kim Silkebækken 90f8f94468 Update vim statusline example
A major issue is that we currently can't pass any windows' mode on to
the segment rendering method, so non-current windows don't get
highlighted correctly, and segments don't get removed if they have 'nc'
in their exclude_modes setting, and statuslines in non-current windows
don't get resized until the window is focused again.
2012-12-10 20:00:26 +01:00
Kim Silkebækken 5d2214db52 Make the examples work with the new project structure 2012-12-06 15:07:41 +01:00
Kim Silkebækken 091840ac67 Fix terminal prompt example 2012-11-26 16:18:26 +01:00
Kim Silkebækken 07b23f5418 Add tmux statusline example 2012-11-26 16:18:15 +01:00
Kim Silkebækken 6a9bb45157 Fix hard divider rendering issue
Hard dividers (for segments with different background colors) are now
always drawn, regardless of the draw_divider option, because it looks
horrible when segments with different bg colors don't have a divider
between them.

This resolves an issue with the filename and modified flag
in the default theme where the filename segment had to set the
draw_divider flag based on the contents of the modified flag to be
rendered correctly.
2012-11-26 15:14:39 +01:00
Kim Silkebækken addb7ccf73 Fix various rendering issues
Another rendering pass is necessary before calculating the filler
segment's lengths, because center segments may lose their separators
after removing low-priority segments.

Some unicode and variable assignment issues has been resolved so
everything renders correctly.
2012-11-21 12:21:01 +01:00
Kim Silkebækken 1d3c259070 Improve rendering performance
This change removes the Segment class as this takes forever to remove
from the segment array when removing low-priority segments. It has
instead been replaced by a wrapper function that works the same and
returns a working dict of all segment properties.

The regex substitution bottleneck in the vim example has been fixed by
using a single-character percent placeholder in vim segments which is
later replaced with a double percent using str.replace().
2012-11-21 11:33:10 +01:00
Kim Silkebækken f4e3d01d07 Improve rendering performance
This commit almost doubles the segment rendering performance. This is
accomplished by caching a lot of data like highlighting groups, moving
some calculations out of loops, and by performing less function calls
overall.

When a width is specified the main speed improvement comes from avoiding
rendering the raw segments over and over until the statusline is short
enough. Instead, the raw rendering is stored as a segment property and
the combined length of all these renderings is used when removing
low-priority segments instead. This results in a maximum of two
rendering passes.

Some "less pythonic" solutions have been chosen some places for
performance reasons, e.g. joining strings instead of appending and
joining lists.

Overall this commit appears to make the performance equal or better than
the legacy vimscript implementation. Later optimizations (in particular
finding another method than remove() for removing low-priority segments)
may make this version of Powerline far superior both in terms of
functionality and performance.
2012-11-21 09:57:16 +01:00
Kim Silkebækken 6c5316a058 Make vim example work with split and inactive windows
This commit introduces a bunch of changes. Most importantly, it ensures
that split windows and inactive windows work as expected. This is
accomplished with some clever workarounds for vim's statusline
limitations.

Vim statuslines evaluated using the %! statusline item are always
evaluated in the buffer context and not in the statusline's owner
window's context, and this made the previous implementation show the
same statusline for all windows. The only way to ensure that the correct
statusline is rendered to the correct window is to walk through all
windows, and setting the statuslines with a reference to the current
window number every time the current window is changed. This is
accomplished by a set of BufEnter, BufLeave, etc. autocommands.

The Syntastic segment has been temporarily removed due to errors when
referencing the statusline function before Syntastic has been loaded.
2012-11-20 21:22:21 +01:00
Kim Silkebækken a532da4834 Fix issues with the terminal prompt example 2012-11-17 16:42:34 +01:00
Kim Silkebækken 4cb0559be4 Fix whitespace issues so pyflakes doesn't complain 2012-11-17 12:21:24 +01:00
ZyX 0f6d24b1e8 Made it work on older vims 2012-11-17 14:08:38 +03:59
ZyX 708306c6ba Avoid invoking vim parser as much as possible in case vim is recent enough 2012-11-17 13:58:28 +03:59
Kim Silkebækken 572df1ded0 Fix filename issues in vim example 2012-11-16 17:16:30 +01:00
Kim Silkebækken 1d1021992f Update vim and terminal examples
The examples have been moved into their own directory. The vim example
now uses pyeval() and vim.bindeval() and loads the Python file through
an import (so it gets compiled) for speed improvements.
2012-11-16 17:05:55 +01:00