From 6c187d94d80e632639176936f748ae6b08ea0377 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 15 Aug 2014 18:00:09 +0400 Subject: [PATCH] Call powerline.new_window early under certain conditions Fixes #250 for the GUI. --- powerline/vim.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/powerline/vim.py b/powerline/vim.py index df009856..1e83b2ce 100644 --- a/powerline/vim.py +++ b/powerline/vim.py @@ -218,6 +218,24 @@ def setup(pyeval=None, pycmd=None, can_replace_pyeval=True): powerline.update_renderer() __main__.powerline = powerline + if ( + bool(int(vim.eval("has('gui_running') && argc() == 0"))) + and not vim.current.buffer.name + and len(vim.windows) == 1 + ): + # Hack to show startup screen. Problems in GUI: + # - Defining local value of &statusline option while computing global + # value purges startup screen. + # - Defining highlight group while computing statusline purges startup + # screen. + # This hack removes the “while computing statusline” part: both things + # are defined, but they are defined right now. + # + # The above condition disables this hack if no GUI is running, Vim did + # not open any files and there is only one window. Without GUI + # everything works, in other cases startup screen is not shown. + powerline.new_window() + # Cannot have this in one line due to weird newline handling (in :execute # context newline is considered part of the command in just the same cases # when bar is considered part of the command (unless defining function