Monday, May 25, 2015

Re: Does trigger any event?

On 2015-05-25 05:12:21 +0000, Nikolay Pavlov said:

> 2015-05-25 1:12 GMT+03:00 Justin M. Keyes <justinkz@gmail.com>:
>> On Sun, May 24, 2015 at 5:19 AM, Nicola <nvitacolonna@gmail.com> wrote:
>>> Hi,
>>> am I right that <C-w><C-o> does not trigger any event? I have a custom
>>> status line, which does not get updated when I close all other windows. For
>>> now, I have this workaround:
>>>
>>> nnoremap <C-w>o <C-w>o:call RefreshStatusLines()<CR>
>>> nnoremap <C-w><C-w> <C-w>o:call RefreshStatusLines()<CR>
>>>
>>> I was wondering whether there is a better way to detect when the user makes
>>> the active window the only visible one.
>>
>> No such event.

Ok, I see that there is a WinResized event in `h todo`, so it is something
that is not implemented yet.

>> But you can force statusline redraw by assigning an
>> option to itself:
>>
>> let &readonly=&readonly
>>
>> Although, I just noticed that Vim has a :redrawstatus command.

Thanks, both seem to work. I can probably dispose of my
RefreshStatusLines() then.

>> Is
>> there any need for the "let &ro=&ro" hack mentioned in ":help
>> 'statusline'", given the existence of :redrawstatus?
>
> It is not needed. Status line redraw is being triggered by closing the
> window, no redraw is the problem of the custom status line, not Vim.
> RefreshStatusLines function is thus obviously *not* being used from
> the &statusline in this case.

I'm not sure I'm following you: what is the point of calling a function whose
purpose is to redraw the status line from the status line itself? For
reference,
the code I'm using is here:

https://github.com/lifepillar/lifepillar-vim-config/blob/master/vimrc#L482

I'm far from being a Vim expert, so I may well be doing things suboptimally.

> I know this because powerline does *not* use anything, but "switch
> highlight group" and "display raw text" statusline segments and it
> still immediately occupies all space after closing the window (== it
> does not use %= segments, so to occupy all space Vim must recompute
> status line or it will be displayed using the previous window size).

How do you get right-aligned elements in the status line without %=?

I have used Airline, but not Powerline, in the past, and it has the
same problem
(after <C-w>o the status line is not updated). Isn't Airline's codebase
derived from
Powerline?

Nicola


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: