From 861f7dc1797fb38b3fb503cf621f30e44791f586 Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 20 Feb 2013 20:57:44 +0400 Subject: [PATCH] Fix &stl reset to global value when new file is loaded Fixes #241 Ref #240 --- powerline/bindings/vim/plugin/powerline.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/powerline/bindings/vim/plugin/powerline.vim b/powerline/bindings/vim/plugin/powerline.vim index c6d6423b..d2344b8c 100644 --- a/powerline/bindings/vim/plugin/powerline.vim +++ b/powerline/bindings/vim/plugin/powerline.vim @@ -52,6 +52,9 @@ function! s:GetWinID(winnr) if empty(r) let r = s:pyeval('str(uuid.uuid4())') call setwinvar(a:winnr, 'window_id', r) + endif + " Without this condition it triggers unneeded statusline redraw + if getwinvar(a:winnr, '&statusline') isnot# '%!Powerline("'.r.'")' call setwinvar(a:winnr, '&statusline', '%!Powerline("'.r.'")') endif return r @@ -64,9 +67,11 @@ function! Powerline(window_id) endfunction function! PowerlineNew() - return Powerline(s:GetWinID(winnr())) + call map(range(1, winnr('$')), 's:GetWinID(v:val)') endfunction +" Is immediately changed when Powerline() function is run. Good for global +" value. set statusline=%!PowerlineNew() function! PowerlineRegisterCachePurgerEvent(event)